Tidy up image example (#96)

This commit is contained in:
Alexander Bondarenko
2021-09-12 14:56:43 +03:00
committed by GitHub
parent f3b85899f2
commit 88326420b8
3 changed files with 105 additions and 78 deletions

View File

@ -559,22 +559,18 @@ arrowButton strIdPtr dir = liftIO do
(0 /=) <$> [C.exp| bool { ArrowButton($(char* strIdPtr), $(ImGuiDir dir)) } |]
-- | Image Area to draw a texture
-- | Image Area to draw a texture.
--
-- Wraps @ImGui::Image()
-- For OpenGL: The @userTextureIDPtr@ points to the texture memory (eg. @0x0000000000000001@)
--
-- For OpenGL: The userTextureIDPtr points to the texture memory (eg. 0x0x0000000000000001), it is the number from glBindTexture.
-- Eg:
-- glBindTexture GL_TEXTURE_2D $ textureID texture
-- -- fill textureID
-- image (intPtrToPtr $ fromIntegral textureID) (ImVec2 500 500)(ImVec2 0 0)(ImVec2 1 1)(ImVec4 1 1 1 1)(ImVec4 0 0 0 0)
-- See @examples/sdl/Image.hs@ for the whole process.
--
-- See https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples#About-texture-coordinates and under examples/sdl/Image.hs
image :: (MonadIO m) => Ptr ()-> Ptr ImVec2 -> Ptr ImVec2 -> Ptr ImVec2 -> Ptr ImVec4 -> Ptr ImVec4 -> m()
-- Wraps @ImGui::Image()@.
image :: (MonadIO m) => Ptr () -> Ptr ImVec2 -> Ptr ImVec2 -> Ptr ImVec2 -> Ptr ImVec4 -> Ptr ImVec4 -> m ()
image userTextureIDPtr sizePtr uv0Ptr uv1Ptr tintColPtr borderColPtr = liftIO do
[C.exp| void {
[C.exp| void {
Image(
$(void* userTextureIDPtr),
$(void* userTextureIDPtr),
*$(ImVec2* sizePtr),
*$(ImVec2* uv0Ptr),
*$(ImVec2* uv1Ptr),