Hi Charles
I would Like to know what is "lastkey" in the OpenGL Keyboardcode example ? Its more a function? A usual variable it cant be possible... If I Change lastkey to lastkey2 example doesn't Work anymore
See my Code below
$ FileName "t.exe"
'uses RTL64
'
int width = 640
int height = 160
string title = "Key codes2"
$ fontA = "Arial",FW_SEMIBOLD
sys bu,ert '*
string ers
string cr=chr(13,10)
macro keydown
case 27 : 'no action
case 32 : 'no action
end macro
'
function guistate() as sys
return @bu
end function
'undef bu 'end bu scope
sys b = guistate()
if ert
print ers cr ert
endif
bind b
sys hWndMain,hInst,inst,hDC,hRC
int pixelform
int mposx,mposy
int sposx,sposy
int eposx,eposy
int iposx,iposy
int mmove,bleft,bmid,bright,bwheel
int pause
int bkey,keyd,lastkey2,lastchar2
int running
int key[256]
end bind
uses OpenglSceneFrame
indexbase 1
sub initialize(sys hWnd)
========================
end sub
sub Release(sys hwnd)
=====================
end sub
sub scene(sys hWnd)
'==================
DozyFrame
glClearColor 0.5, 0.5, 0.7, 0
glPushMatrix
gltranslatef -1.5,0.,-1.0
glscalef .25,.3,.01
glColor3f .99,.99,.00
gprint "Last key pressed: "
glColor3f .99,.99,.99
int lastkey2 '=lastkey ' doesnt go
'int lastkey2=lastkey ' go
if lastkey2
gprint lastkey2 " = 0x" hex(lastkey2)
else
gprint "(none)"
end if
glPopMatrix
end sub
Thanks, Frank
Hi Frank, Lastkey is a global variable set by WM_KEYDOWN in winutil.inc
Good morning Charles and thank you for Infos
But I am Thinking thats Not all and more complicated as I noticed with mousemessages keyboardmessages functions and so on.. I was often wondering what this lastkey / lastchar command or variable is doing in consoleG . I am Sure its Not easy to program all this Things but its looking in this example for example so easy :) Compliments for your OpenGL headers and Features thats a great Job you did :)
Nice thursday spring will come soon in Germany
Hi frank,
This demonstrates keyboard and mouse states you can use:
$ FileName "t.exe"
'uses RTL64
'
% Title "Keyboard and Mouse Variables"
% NoEscape
uses consoleG
BeginScript
procedure main()
================
cls 0.5,0.5,0.7
color 1,1,1
scale 2
move 2,-1
pushstate
print "LastKey " lastkey " = 0x" hex(lastkey)
popstate
move 0,-1
pushstate
print "LastChar " lastchar " = 0x" hex(lastchar)
popstate
move 0,-1
pushstate
print "keystate(Shift) / keystate(Control) " KeyState(VK_SHIFT)>>15 " / " KeyState(VK_CONTROL)>>15
popstate
move 0,-2
pushstate
print "sposx,sposy " sposx ", " sposy
popstate
move 0,-1
pushstate
print "mposx,mposy " mposx ", " mposy
popstate
move 0,-1
pushstate
print "bleft,bmid,bright " bleft ", " bmid ", " bright
popstate
move 0,-1
pushstate
print "bwheel " bwheel
popstate
move 0,-1
end procedure
EndScript
Our German Monarch :)
(https://people.com/thmb/xO0HCOkmLyvrFIZcGdy9ExK4cRM=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc():focal(587x461:589x463)/Coronation-of-King-Charles-III-30506-1424c319f54247b2951fa0fe173ca81a.jpg)
Thank you Charles a good consoleG OpenGL example :) I Like IT
Btw Last Summer we bet with Friends that Charles wont be King for one year