Forum Replies Created
-
AuthorPosts
-
I think for now enums are just 32 bits Uints in monkey2. I’ve had the opposite problem, I wanted more than 32 bits..
Bullet physics has been added to modules! (can’t wait to see mojo 3d)
For this occasion I udated the module section on http://turdus.be/monkey2docs/docs/It can be done with the std:std.process.Process class
here is a printable (.docx) version (it’s a 43 pages manual!):
https://github.com/mx2DocsCommunity/monkey2/blob/wipdocs/modules/monkey/docs/printableDocs.docxor in .md format if you want to convert it your way:
https://github.com/mx2DocsCommunity/monkey2/blob/wipdocs/modules/monkey/docs/printableDocs.mdnow at http://turdus.be/monkey2docs/mx2-printable-ref-manual.zip
extension added to user defined types section
encaplsulation (private,protected,public) added in misc sectionplease review if you have some time
There has been some docs additions from BRL recently.
The http://turdus.be/monkey2docs/docs has been updated with it (with some MarkDown corrections)
Like impixi, it’s welcome but can be part of 3rd party framework too. You probably have more interresting things to achieve.
But it would be nice if the KeyboardDevice (and others InputDevices) had a ‘Last(pressed)Button’ method in order to make controls setupscreen without the need of the OnKeyEvent method override (or other On(INPUT)Event)I made a little controls setup demo (without the use of ints, only Key) to show it. In the case I missed something.
Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394#Import "<std>"#Import "<mojo>"Using std..Using mojo..Global w_width:=600 'initial window sizeGlobal w_height:=100Class CtrlsOptions Extends Window'control KeysField kUp:Key=Key.UpField kDown:Key=Key.DownField kLeft:Key=Key.LeftField kRight:Key=Key.RightField kBoost:Key=Key.LeftShift'cycle fieldsField lastKey:=Key.NoneField screen:="Game"Field optionStep:=0Method New( title:String,width:Int,height:Int,flags:WindowFlags=WindowFlags.Resizable )Super.New( title,width,height,flags )EndMethod OnKeyEvent( event:KeyEvent ) OverridelastKey=event.KeyEnd MethodMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender()canvas.DrawText("F1 for game screen / F2 for Ctrls Setup screen",10,15)If Keyboard.KeyPressed(Key.F1) Then screen="Game"If Keyboard.KeyPressed(Key.F2) Then screen="Options"Select screenCase "Game"canvas.DrawText("Game",10,35)If Keyboard.KeyDown(kUp) Then canvas.DrawText("Up",400,40)If Keyboard.KeyDown(kDown) Then canvas.DrawText("Down",400,60)If Keyboard.KeyDown(kLeft) Then canvas.DrawText("Left",350,50)If Keyboard.KeyDown(kRight) Then canvas.DrawText("Right",450,50)If Keyboard.KeyDown(kBoost) Then canvas.DrawText("!Boost!",520,50)Case "Options"canvas.DrawText("Options",10,35)Select optionStepCase 0canvas.DrawText("Press the new up button",200,60)If lastKey<>Key.F2 And lastKey<>Key.F1kUp=lastKeyoptionStep+=1EndCase 1canvas.DrawText("Press the new down button",200,60)If lastKey<>Key.F2 And lastKey<>Key.F1 And lastKey<>kUpkDown=lastKeyoptionStep+=1EndCase 2canvas.DrawText("Press the new Left button",200,60)If lastKey<>Key.F2 And lastKey<>Key.F1 And lastKey<>kUp And lastKey<>kDownkLeft=lastKeyoptionStep+=1EndCase 3canvas.DrawText("Press the new Right button",200,60)If lastKey<>Key.F2 And lastKey<>Key.F1 And lastKey<>kUp And lastKey<>kDown And lastKey<>kLeftkRight=lastKeyoptionStep+=1EndCase 4canvas.DrawText("Press the new Boost button",200,60)If lastKey<>Key.F2 And lastKey<>Key.F1 And lastKey<>kUp And lastKey<>kDown And lastKey<>kLeft And lastKey<>kRightkBoost=lastKeyoptionStep=0screen="Game"EndEndEndEndEndFunction Main()New AppInstanceNew CtrlsOptions( "Ctrls",w_width,w_height )App.Run()Endusing the int allowed me to do what I wanted in the OnMouseEvent
I don’t undestand why you want to mix mouse events and key events… or you meant OnKeyEvent?
You want the player to be able to chose between mouse or key controls?I don’t really get what you’re trying to do here but I know you don’t have to be warned that hidden functionalities are subject to change..
Keys are Enums of type Key.
They are defined in mojo/input/keycodes.monkey2
you just have to
[/crayon]Monkey123[crayon-5cbaa0f5861f3022266246 inline="true" ]Field keyPress:Keyand then you can (or just do as Jesse wrote)
[/crayon]Monkey123[crayon-5cbaa0f5861fa858001170 inline="true" ]keyPress=Key.Xyou may also
[/crayon]Monkey123[crayon-5cbaa0f586200057185286 inline="true" ]Field i:int=Key.XBut you’ll lose it’s Enums properties (mainly the ability to |Key.Raw in this case, wich sould ALWAYS be used for WASD type controls IMO). And you wont be able to reconvert it to the ‘Key’ type easily.
If it’s of the ‘Key’ type you’ll be able to
`keyPressed=keyPressed.Y’
wich can be usefull if you call your keyPressed just k for example.I started to work on the docs to add some missing think. There’s a keyword index where you would have had a brief answer to the question. It is in total WIP but contains all the official infos + some I added.
http://turdus.be/monkey2docs/docs/
note that you can call the super method in you override with the Super keyword so you don’t have to rewrite all the super methods code.
[/crayon]Monkey123[crayon-5cbaa0f58aef2009481413 inline="true" ]Super.theMethodNamethere’s also the Pakz exmples that are great to start with https://github.com/Pakz001/Monkey2examples
There was a time numpad enter was doing nothing at all in ted2… Mark had corrected it as soon as I posted the issue. It must be a legacy of that numpad enter management.
looks like you had a prblem connecting with the monkey server. May be it was in maintennance and is OK now? I just tried and I could download all the available modules.
If you want admin rights on the fork just ask (and give your github id)..
-
AuthorPosts