PDA

View Full Version : Testers wanted: TBGL_MouseGetPos* with RenderMatrix2D support



Petr Schreiber
12-01-2019, 18:52
Hi,

as DirectuX suggested, it might be handy to have TBGL_MouseGetPosX & TBGL_MouseGetPosY aware of the RenderMatrix2D coordinates.

I attach version which should achieve the following:
- preserve backward compatibility for TBGL_MouseGetPosX & TBGL_MouseGetPosY
- add ability to specify %TBGL_2D or %TBGL_CLIENTAREA as parameters for these functions, controling their behaviour
- add TBGL_MouseInClient function to check whether mouse is in window client area

Just copy the DLL from the attachement to the Lib directory & try different scenarios.

Example:




uses "tbgl"


function tbmain()

dword hWin = tbgl_createWindowEx ("201x201 - ESC to quit", 201, 201, 32, %TBGL_WS_WINDOWED or %TBGL_WS_DONTSIZE)
tbgl_showWindow

tbgl_useDepth false


tbgl_resetKeyState()


while tbgl_isWindow(hWin)

tbgl_clearFrame


tbgl_renderMatrix2D(-100, 100, 100, -100, %TBGL_PIXEL_PERFECT_2D)

tbgl_polygonlook %GL_LINE
tbgl_color 255, 0, 0
tbgl_rect(-100, -100, 100, 100)


tbgl_drawFrame

if tbgl_getWindowKeyState(hWin, %VK_ESCAPE) then
exit while
end if

if tbgl_mouseInClient then
tbgl_setwindowtitle(hWin, tbgl_mousegetposx(%TBGL_2D) + " " + tbgl_mousegetposy(%TBGL_2D))
else
tbgl_setwindowtitle(hWin, "Mouse is out of the client area")
end if
wend


tbgl_destroyWindow

end function



Thank you for your help,
Petr

DirectuX
12-01-2019, 22:50
Just copy the DLL from the attachement to the Lib directory & try different scenarios.


Thank you for your help,
Petr

Hi, Petr,

I can't see the attachment...

Petr Schreiber
12-01-2019, 23:49
Hi Sebastian,

I re-uploaded the attachment - it got rejected as DLL, but once ZIPped, it can be attached nicely :)


Petr

ErosOlmi
13-01-2019, 11:37
Your attached TBGL works fine here

Petr Schreiber
13-01-2019, 12:47
Thank you Eros,

works okay here as well, integrated & documented & will be present in next thinBasic release :)


Petr

Lionheart008
07-02-2019, 12:55
good morning, the mouse example doesn't work here properly, the rectangle window frame appears however when I am drag mouse over little window frame I have got an error something with 2d-matrix etcpp... I am using windows 10 with 64 bit, and have downloaded last thinbasic and tbgl package, regards, frank

Lionheart008
09-02-2019, 10:23
picture see below I have forgotten to send, thanks :-)

DirectuX
10-02-2019, 11:02
picture see below I have forgotten to send, thanks :-)

Hi Lionheart008,
on your screenshot there are 3 parenthesis at the end of the line 34 ,
there should be 2.