mirror of
				https://github.com/Drezil/dear-imgui.hs.git
				synced 2025-10-31 13:11:07 +01:00 
			
		
		
		
	Add getCursorPos (#176)
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							0cc654f190
						
					
				
				
					commit
					ea3ad959f9
				
			| @@ -110,6 +110,7 @@ module DearImGui | ||||
|   , Raw.endGroup | ||||
|  | ||||
|   , setCursorPos | ||||
|   , Raw.getCursorPos | ||||
|   , Raw.alignTextToFramePadding | ||||
|  | ||||
|     -- * ID stack | ||||
|   | ||||
| @@ -90,6 +90,7 @@ module DearImGui.Raw | ||||
|   , popItemWidth | ||||
|   , beginGroup | ||||
|   , endGroup | ||||
|   , getCursorPos | ||||
|   , setCursorPos | ||||
|   , getCursorScreenPos | ||||
|   , alignTextToFramePadding | ||||
| @@ -1671,6 +1672,20 @@ setCursorPos :: (MonadIO m) => Ptr ImVec2 -> m () | ||||
| setCursorPos posPtr = liftIO do | ||||
|   [C.exp| void { SetCursorPos(*$(ImVec2* posPtr)) } |] | ||||
|  | ||||
| -- | Get cursor position in window-local coordinates. | ||||
| -- | ||||
| -- Useful to overlap draw using 'setCursorPos'. | ||||
| -- | ||||
| -- Wraps @ImGui::SetCursorPos()@ | ||||
| getCursorPos :: (MonadIO m) => m ImVec2 | ||||
| getCursorPos = liftIO do | ||||
|   C.withPtr_ \ptr -> | ||||
|     [C.block| | ||||
|       void { | ||||
|         *$(ImVec2 * ptr) = GetCursorPos(); | ||||
|       } | ||||
|     |] | ||||
|  | ||||
| -- | Cursor position in absolute coordinates. | ||||
| -- | ||||
| -- Useful to work with 'DrawList' API. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user