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:
12345678910111213141516171819202122232425262728293031323334353637383940414243uses
"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
Last edited by Petr Schreiber; 12-01-2019 at 23:48.
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Hi Sebastian,
I re-uploaded the attachment - it got rejected as DLL, but once ZIPped, it can be attached nicely
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Your attached TBGL works fine here
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Thank you Eros,
works okay here as well, integrated & documented & will be present in next thinBasic release
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
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
you can't always get what you want, but if you try sometimes you might find, you get what you need
picture see below I have forgotten to send, thanks :-)
you can't always get what you want, but if you try sometimes you might find, you get what you need
Bookmarks