Forum Replies Created
-
AuthorPosts
-
I am looking on google and see that it probably is not possible with linked lists. I will start to look at stack and else I wil use a regular array.
I am getting the results in here:
Seems that using num lock does not change the keycodes. So It might not work.
code for
end – 217 ; pgdown – 219 ; pgup – 225 ; home – 223
when numlock – (211) is used the results are the same. So it might conflict with keypad numbers 1/end 3/pagedown 7/home 9/pagedown
Sorry, it is to difficult. I have no idea how to compile a project.
Edit: I am trying to reverse engineer something. Seems like event.Key compiler error says “expecting expression but encountered “”””
I am trying to figure out how to use event.key. I have not used it yet. Might take a while. Or maybe you could post something?
Ah, found it
thanks.
Also. On my laptop (acer) the keypad does not work. (ctrl home end ect.)
On my other laptop (msi) with extra keyboard the keypad also does not work. The keyboard(keypad) of the laptop itself does also not work.
Not to sure if this needs to be implemented yet.
edit: I just found that on the top right of the laptops there are page down home and end keys. These do work. Never had to use them before. Would be nice if the keypad home end ect would be implemented.
I just did this. Seems to work to.
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445#Import "<std>"#Import "<mojo>"Using std..Using mojo..Class MyWindow Extends WindowField m:= New String[3]Method New()m[0] = "000"m[1] = "010"m[2] = "000"End MethodMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender() ' Activate this method'canvas.Clear(Color.White)For Local y:=0 To 2For Local x:=0 To 2canvas.Color = Color.Blackcanvas.DrawRect(x*32+100,y*32+100,32,32)If m[y][x] = 48 Thencanvas.Color = Color.Greencanvas.DrawText("X",x*32+100,y*32+100)End IfIf m[y][x] = 49 Thencanvas.Color = Color.Bluecanvas.DrawText("X",x*32+100,y*32+100)End IfNextNext' if key escape then quitIf Keyboard.KeyReleased(Key.Escape) Then App.Terminate()End MethodEnd ClassFunction Main()New AppInstanceNew MyWindowApp.Run()End FunctionI want to keep certain code projects in a single text file so I can put it online on blogs and github and such.
One bug I keep encountering is that on lower resolution(hd) screen the Ted window is bigger then the screen. I need to run/compile before it switches to right proportions. On full hd this is not a problem.
I use this to exit the app. From my example git.
Monkey12345678910111213141516171819202122232425#Import "<std>"#Import "<mojo>"Using std..Using mojo..Class MyWindow Extends WindowMethod New()End methodMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender() ' Activate this method' if key escape then quitIf Keyboard.KeyReleased(Key.Escape) Then App.Terminate()End MethodEnd ClassFunction Main()New AppInstanceNew MyWindowApp.Run()End FunctionJuly 8, 2016 at 8:31 pm in reply to: How can I control the framerate / How does the loop loops? #1919The code insertion seems not to work? No idea what is happening.
July 8, 2016 at 8:25 pm in reply to: How can I control the framerate / How does the loop loops? #1917<pre class=”lang:monkey decode:true ” title=”Framerate”>#Import “<std>”
#Import “<mojo>”Using std..
Using mojo..Global instance:AppInstance
Class MyWindow Extends Window
Field timer:Timer
Method New()
timer = New Timer(10,OnUpdate)
End MethodMethod OnUpdate()
If Keyboard.KeyReleased(Key.Escape) Then instance.Terminate()
App.RequestRender()
End MethodMethod OnRender( canvas:Canvas ) Override
canvas.DrawText(“FPS:”+App.FPS,0,0)
End MethodEnd Class
Function Main()
instance = New AppInstanceNew MyWindow
App.Run()
End Function
This I used to change the framerate. Using a timer.I found that if you change the layout=”letterbox” line to something else then it works. I have not delved deep into Monkey2 to know what the problem might be.
edit:
btw – when I tried the fullscreen mode the first time my computer became very slow after ending the program. This for around 10 seconds. The mouse moved really slow and the music in the background played very weird. Never seen anything like this before on this gaming laptop.
It is just a test. Should locals not be freed automatically when the function is exited?
i thought i did something similar with monkey 1 and that worked without slowing down.
the texture flag gave a compile error as was in the first post here.
Thanks. I put the code in the codebox.
I modified the code a bit and it slows the computer down a lot. Maybe a memory leak?
In release mode it slows to a crawl.
Monkey1234567891011121314151617181920212223242526272829303132333435#Import "<std>"#Import "<mojo>"Using std..Using mojo..Class MyWindow Extends WindowMethod OnRender( canvas:Canvas ) OverrideIf Keyboard.KeyReleased(Key.Escape) Then App.Terminate()App.RequestRender()' create a pixmapLocal pixmap:=New Pixmap(640, 480)' clear the pixmappixmap.Clear(New Color(Rnd(0,1),Rnd(0,1),Rnd(0,1),1))'create a image with from the pixmapLocal img:=New Image(pixmap)' draw the imagecanvas.DrawImage(img,0,0)canvas.Color = Color.Blackcanvas.DrawRect(0,0,320,20)canvas.Color = Color.Whitecanvas.DrawText("FPS:"+App.FPS,0,0)End MethodEnd ClassFunction Main()New AppInstanceNew MyWindowApp.Run()End FunctionHow do you paste code?
-
AuthorPosts