Forum Replies Created
-
AuthorPosts
-
Any chance you can email me the project, it shouldn’t be that bad!
Good stuff! Purchased.
Thank you!
Universal Windows Platform app support with in-app billing would be too much to ask I’m afraid
Yeah, sorry, I just don’t wanna take on that much right now. To be honest, WinRT on monkey-x just about killed me!
But the situation is a little different this time thanks to SDL which does actually have a WinRT backend. Also, AngleGLES is apparently an ‘official’ lib for WinRT now, so the lack of OpenGL support is no longer an issue. Still, I’m sticking with ‘no’ for now.
Yes, wasn’t quite sure whether to go ‘live’ with it yet, but skidracer stuck it on the front page at bb.com last night and someone just bought a copy (thanks!) so it looks like it’s all go now. Adding admob to a project is still kind of ugly (esp. on ios) but it’s not technically hard and should all work OK. I have tested both banner/interstitial ads with both test and ‘real’ AdUnitIDs.
As per blog-plan, I also plan to release appstore/gamecenter style modules for around the same price, with a discount for buying all of ’em at once. This does mean 3d got put off a little, but all of this was well underway when 3d became a happening thing so I wanted to finish it up.
Pre-built v1.1.03 binaries for monkey2 are also up at itch.io here – actually, you’ll need them for admob!
https://blitzresearch.itch.io/monkey2
I like itch.io a lot – they go to a lot of effort for open source stuff, donation-ware etc, and they’re not arbitrarily selective about *who* they publish the way steam are, which for some reason really bugs me, as it turns publishing into a sort of lottery or something. The itch.io systems are really nice too, very easy to create pages, lots of options etc.
Guess I better announce all this soon now that the cat is truly out of the bag!
You need to add texture coordinates if there’s an ‘image’ param (should probably catch this…)
Texture coordinates represent coordinates within the image, where 0,0=top left, 1,0=top right, 1,1=bottom right, 0,1=bottom left, and fractional values are coordinates somewhere in between, eg: .5,.5= center.
Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768Namespace myapp#Import "<std>"#Import "<mojo>"Using std..Using mojo..Class MyWindow Extends WindowField image:ImageMethod New( title:String="Simple mojo app",width:Int=640,height:Int=480,flags:WindowFlags=Null )Super.New( title,width,height,flags )image = New Image(64,64)Local icanvas:Canvas = New Canvas(image)icanvas.Clear(New Color(0,0,0,0))icanvas.Color = New Color(1,0,0,1)icanvas.LineWidth = 4icanvas.DrawLine(0,0,63,0)icanvas.DrawLine(63,0,63,63)icanvas.DrawLine(63,63,0,63)icanvas.DrawLine(0,63,0,0)icanvas.Color = New Color(0,0,1,1)icanvas.DrawLine(0,0,63,63)icanvas.Color = New Color(0,1,0,1)icanvas.DrawLine(63,0,0,63)icanvas.Flush()EndMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender()'x,y verts to draw.Local verts:=New Float[]( Width/2,0,Width,Height/2,Width/2,Height,0,Height/2 )'s,t tex coordinates.Local texcoords:=New Float[]( 0,0,1,0,1,1,0,1 )'params:'4=draw quads (3=tris, 6=hexs etc, prims must be convex!)'1=draw 1 quad.'verts.Data=float ptr to vertex data.'8=verts pitch, ie: bytes between one vertex and the next, 2 floats=2*4=8.'texcoords.Data=float ptr to texture coordinates.'8 texcoords pitch...canvas.Color = New Color(1,1,1)canvas.DrawPrimitives( 4,1,verts.Data,8,texcoords.Data,8,Null,0,image,null )canvas.DrawImage(image,0,0)EndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndThanks for spending time with me
No problem at all – I want people to hammer this stuff and ask questions so I can make sure it works (and makes some sort of sense!) and so far it seems to be, so thank you!
With your sample, there is a black border (left and right) at startup.
Not doing quite the same thing here, but I think this is the difference between ‘real’ fullscreen and ‘fake’ fullscreen.
When you use WindowFlags.Fullscreen to create the window, it actually causes the display resolution to change. However, BeginFullScreen() with no parameters (as in the Alt-Tab handler) instead takes you into fake fullscreen, where the window is really just resized to the size of the desktop.
Try using BeginFullScreen( 800,600,60 ) instead in the Alt-Tab handler – this should also cause a display mode change.
This highlights a bit of a limitation with using WindowFlags.Fullscreen to go into fullscreen mode – you can’t select refresh rate this way.
> I’m finding Monkey 2 is quite slow to build to the Desktop target
Are you using v1.1.03?
There were some bugs in recent pre-v1.1.03 versions that meant mx2cc was compiling more that it should have been. If you using v1.1.03, then link times are likely the problems and there’s not much I can do about that.
I also need to get around to supporting msvc compilers, I have a feeling these will be significantly faster too. Looks like this is become semi-urgent!
Yeah, it’s probably odd if you’ve never encountered it before, but it allows the compiler to make more aggressive optimizations.
For example, there’s an algorithm that can optimally (ie: ‘perfectly’) allocate registers for expression trees simply by going down the ‘busiest’ branch of the tree first, allocating registers as necessary and freeing them after use (I think that’s how it worked…). Blitz3d used something like this from memory.
Little demo of drawing a full-view ‘diamond’.
The command’s a little intense because it’s supposed to handle many combinations of textured/untextured/colored/uncolored/indexed/nonindexed primitives. Uses float ptrs instead of float arrays for max flexibility too, ie: you can draw from DataBuffers etc.
Monkey12345678910'x,y verts to drawLocal verts:=New Float[]( Width/2,0,Width,Height/2,Width/2,Height,0,Height/2 )'params:'4=draw quads (3=tris, 6=hexs etc, prims must be convex!)'1=draw 1 quad.'verts.Data=float ptr to vertex data.'8=pitch, ie: bytes between one vertex and the next, 2 floats=2*4=8.canvas.DrawPrimitives( 4,1,verts.Data,8,Null,0,Null,0,Null,Null )But where’s the specific info about that?
There isn’t any yet as I haven’t written it! It’s on the to do list, along with 1001 other things.
But there’s nothing particularly tricky about it beyond what everyone has been using it for to date.
Well, there is no border as both the window and virtual res are 800,600, so the virtual display fits’ perfectly’. There will in fact be no border for any virtual res with the same aspect ratio as the window res.
Your window’s Style.BackgroundColor is also overwriting the window clear color. Style.BackgroundColor defaults to Color.None (ie: fully transparent) so normally you only ever see Window.ClearColor. This implies Style.BackgroundColor is drawn *after* ClearColor – in fact, ClearColor is drawn *before* everything else, as it’s a window property.
My advice would be to skip Style.BackgroundColor altogether for now and stick with canvas.Clear(), eg:
Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455#Import "<std>"#Import "<mojo>"Using std..Using mojo..Class Splash Extends WindowMethod New()Super.New("Splash",800,600,WindowFlags.Fullscreen)Self.Layout="letterbox"Self.ClearColor=Color.Green' Self.Style.BackgroundColor=Color.Red 'One way to clear virtual area, but let's use canvas.Clear in OnRender().Mouse.PointerVisible=FalseEndMethod OnMeasure:Vec2i() OverrideReturn New Vec2i( 800,400 ) 'Note: Different aspect ratio to window size or no border!EndMethod OnRender( canvas:Canvas ) OverrideRequestRender()canvas.Clear( Color.Red ) 'Another way to clear virtual area.EndMethod OnKeyEvent( event:KeyEvent ) OverrideIf event.Type=EventType.KeyDown ThenIf event.Key=Key.Enter And event.Modifiers & Modifier.AltIf Not Self.Fullscreen ThenSelf.BeginFullscreen()ElseSelf.EndFullscreen()EndEndIf event.Key=Key.EscapeApp.Terminate()EndEndEndEndFunction Main()New AppInstanceNew SplashApp.Run()EndFor examining/modifying filsystem, see std.filesystem namespace:
http://monkey2.monkey-x.com/mx2-docs/std-std-filesystem/
For reading writing to files, see std.stream.FileStream:
http://monkey2.monkey-x.com/mx2-docs/std-std-stream-FileStream/
…and the std.stream.Stream class it extends…
http://monkey2.monkey-x.com/mx2-docs/std-std-stream-Stream/
–myStack.Pop()+myStack.Pop()
There is no ‘correct’ order for evaluation here – c++ is free to evaluate args of operators in any order (except for ‘And’, ‘Or’ and ‘?’) so mx2 does this too. Ditto with monkey, perhaps even bmx?
Also be very careful with, eg: Blah( ReadInt(),ReadInt(),ReadInt() ) etc! This is generally the ‘classic’ example of this…
If you use the ‘letterbox’ layout, you should also implement ‘OnMeasure’.
This returns the ‘virtual’ size of the letterbox, while the size passed to the window constructor is the actual physical size of the window (or fullscreen).
Have a look at the viewlayout.monkey2 banana. Also, I tweaked your code above:
Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546Namespace myapp#Import "<std>"#Import "<mojo>"Using std..Using mojo..Class MyWindow Extends WindowMethod New()Super.New( "Splash",800,600,WindowFlags.Fullscreen )Self.Layout="letterbox"Self.ClearColor=New Color( 0.2039,0.1882,0.1529,1 ) ' 52 48 39Mouse.PointerVisible=FalseEndMethod OnMeasure:Vec2i() OverrideReturn New Vec2i( 512,283 )EndMethod OnRender( canvas:Canvas ) OverrideRequestRender()canvas.DrawText( "Hello World!",Width/2,Height/2,.5,.5 )EndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndLinking to stuff in the manuals as opposed to modules is still WIP, ditto samples.
Taumel, I don’t care what you consider swearing, this is my site and if you can’t play by my rules please get your kicks elsewhere.
-
AuthorPosts