Forum Replies Created
-
AuthorPosts
-
Here is the updated Monkey 2 App Template.
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475#Import "<std>"#Import "<mojo>"#Import "<mojox>"Using std..Using mojo..Using mojox..Global virtualResolution:=New Vec2i( 640,480 )Class MyApp Extends WindowField UpdateTimer:TimerField ticker:ULong = 0' Screen TitleField titlemsg:StringField title_y:IntField title_x:FloatMethod New( title:String,width:Int,height:Int,flags:WindowFlags=WindowFlags.Resizable )Super.New( title,width,height,flags)' Set OnActivated and OnDeactivated methods for when App loses or gain focus.App.Activated += OnActivatedApp.Deactivated += OnDeactivated' Load images, sounds and game data hereOnLoad()' Trigger OnUpdateUpdateTimer = New Timer(60, OnUpdate) ' start game timer at 60 HertzSwapInterval = 0EndMethod OnLoad()titlemsg="Click Minimize/Maximize Window "EndMethod OnUpdate()ticker += 1EndMethod OnRender( canvas:Canvas ) OverrideIf Not App.Active Then Returntitle_x=canvas.Font.TextWidth(titlemsg) 'get the titlemsg text lengthtitle_y=canvas.Font.Height*.5title_x=virtualResolution.X *.5-title_x *.5 'center it on the screenApp.RequestRender()canvas.DrawText(titlemsg, title_x, title_y)canvas.DrawText("FPS: " + App.FPS+" Ticker: " + ticker,10,64 )canvas.Flush()EndMethod OnActivated:Void()UpdateTimer.Suspended = FalseEndMethod OnDeactivated:Void()UpdateTimer.Suspended = TrueEndMethod OnMeasure:Vec2i() OverrideReturn virtualResolutionEndEndFunction Main()New AppInstanceNew MyApp( "MX2 Template",640,480 )App.Run()Endimpixi,
Thank you this looks much cleaner, one interesting thing is the FPS in my Original template runs at 60 frames per second , on yours the frame rate is much higher, on Windows and OSX.
This works great with mobile, I tested on iOS so far .
I tested on iOS 10.2 on iPhone 6 and when it goes to OnDeactivate the app sleeps, the behavior is different on PC running Windows 10 and the same on my MacBook Pro running OSX Sierra, they run on the back ground. I will run on my Android device.
nerobot
Thank you.
In case I am working on a game my game class should extend View and not Window. does that also apply for mobile devices? Or it depends on the type of app I am developing.
I donate regularly since last year and I got no heart yet.
Mark, intro.wav, intro.mp3 and intro.m4a are bigger than 512K, I sent you a google drive share link to your blitzmunter e-mail.
By the way there are some debug printing when the audio is active:
Active channels=1
Active channels=2
Active channels=3
Active channels=4
Active channels=5
Active channels=6Here is the intro.wav, it did not fit in the previous post.
Mark attached is the intro.wav you asked and four audio files for the dragon_wings, in the IDE the dragon_wings gives an I/O read error, but in other players I have it plays fine, such as Audacity , Windows Media Player and iTunes.
II use Audacity http://www.audacityteam.org/download/ to convert file formats, some may require a codec.
I don’t see FLAC as a popular for mat, but it does not hurt to add it to the list, the priority for this is low in my opinion.
My suggestions for the the audio formats supported by Monkey 2 should be, OGG, MP3, WAV and M4A
For Video JPG, MP4 and MOV
Attachments:
peterigz,
I tried <span class=”crayon-sy”>.</span><span class=”crayon-v”>MeasuredSize</span><span class=”crayon-sy”>.</span><span class=”crayon-i”>x and <span class=”crayon-sy”>.</span><span class=”crayon-v”>MeasuredSize</span><span class=”crayon-sy”>.y, they both returned 0.</span></span>
I use in Monkey 1 for about 4 years, and I love what they did to Monkey 2. I also used Pyro from Planiax http://www.playniax.com/pyro.html
They did a great job writing Pyro 2 for Monkey 2
Hello peterigz,
Thank you for your response, where did you find this information?
After creating a button with image or text when I try to get the Width and Height it returns 0
The button Width and Height are read only.
Monkey1234567891011pb=New PushButton("info")Print " pb W:"+pb.WidthPrint " pb H:"+pb.HeightbuttonUP=New Button( "",Image.Load("asset::pad_up.png" ))Print " buttonUP W:"+buttonUP.WidthPrint " buttonUP H:"+buttonUP.HeightAdamStrange very nice. I downloaded it and played a little bit.
Ethernault,
Just to confirm , I installed Emscripten on my MacOS and got the same screens on Windows 10 as on my previous post regarding the appearance on the Browser.
Hello Mark,
Below are some errors and warnings from the Xcode when I run any of the iOS projects generated by MX2, this is the latest development branch I got from Github.
<b>2017-01-06 10:15:34.039409 Touchtest[693:168838] [DYMTLInitPlatform] platform initialization successful</b>
<b>2017-01-06 10:15:35.619131 Touchtest[693:168664] [Common] _BSMachError: port 8a03; (os/kern) invalid capability (0x14) “Unable to insert COPY_SEND”</b>
<b>2017-01-06 10:15:35.622747 Touchtest[693:168664] [Common] _BSMachError: port 8a03; (os/kern) invalid capability (0x14) “Unable to insert COPY_SEND”</b>
<b>2017-01-06 10:15:49.868951 Touchtest[693:168664] [App] if we’re in the real pre-commit handler we can’t actually add any new fences due to CA restriction</b>
<b>2017-01-06 10:15:49.869134 Touchtest[693:168664] [App] if we’re in the real pre-commit handler we can’t actually add any new fences due to CA restriction</b>
<b>2017-01-06 10:15:56.530507 Touchtest[693:168664] [App] if we’re in the real pre-commit handler we can’t actually add any new fences due to CA restriction</b>
<b>2017-01-06 10:15:56.530859 Touchtest[693:168664] [App] if we’re in the real pre-commit handler we can’t actually add any new fences due to CA restriction</b>
I finally got it working on MacOS!
For some weird reason ./emsdk install latest was not downloading the entire emscripten-clang_e1.35.0.tar.gz!
I found out doing a sanity check ./emcc -v.
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.35.0
clang version 3.7.0 (https://github.com/kripken/emscripten-fastcomp-clang dbe68fecd03d6f646bd075963c3cc0e7130e5767) (https://github.com/kripken/emscripten-fastcomp 4e83be90903250ec5142edc57971ed4c633c5e25)
Target: x86_64-apple-darwin16.3.0
Thread model: posix
INFO:root:(Emscripten: Running sanity checks)
Jesse what is the Monkey2 default home directory?
-
AuthorPosts