About Monkey 2 › Forums › Monkey 2 Programming Help › [ANDROID] Build Error – DIDDY2 and Building Module Errors.
This topic contains 5 replies, has 3 voices, and was last updated by
therevills 1 year, 5 months ago.
-
AuthorPosts
-
November 18, 2017 at 5:43 pm #11806Monkey1234567891011121314151617181920212223242526272829303132333435Mx2cc version 1.1.08***** Making module 'diddy2' *****Parsing...Semanting...Translating...Compiling...[armeabi-v7a] Compile++ thumb: mx2_diddy2 <= diddy2_diddy2.cpp[armeabi-v7a] Compile++ thumb: mx2_diddy2 <= diddy2_functions.cppBuild error: System command 'ndk-build' failed.ndk-buildIn file included from jni/../src/diddy2_functions.cpp:4:C:/Apps/Coding/Monkey2-v1.1.08/modules\mojo/mojo.buildv1.1.08/android_release/include/mojo_graphics_2canvas.h:55:10: fatal error: 'monkey/monkey.buildv1.1.08/android_release/include/monkey_types.h' file not found#include "monkey/monkey.buildv1.1.08/android_release/include/monkey_types.h"^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~1 error generated.make: *** [obj/local/armeabi-v7a/objs/mx2_diddy2/__/src/diddy2_functions.o] Error 1***** Fatal mx2cc error *****Internal mx2cc build errorRebuild modules failed.Total time elapsed: 0 m 3 s.
I cannot get it to work with the current 1.108 version of MnkeyX2. Specifically, when trying to build anything for android, above, is the error. I’m trying to build for Android but also trying to rebuild the DIDDY2 module.
Thanks.
November 18, 2017 at 6:27 pm #11808It looks like you had not been building modules for Android. You have to do it once before you Can build you app or build a third party module.
November 19, 2017 at 12:08 am #11811Amon, I recommend you dont build Diddy2 as a module just yet… just import the main Diddy2 file in your file:
Monkey1#Import "../diddy2/diddy2"Here is a Diddy template:
Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192Namespace game#Import "assets/"#Import "../diddy2/diddy2"#Import "<mojo>"#Import "<std>"Using diddy2..Using mojo..Using std..Function Main()New MyDiddyApp("My Super Game", 1024, 768, 1024, 768)EndClass MyDiddyApp Extends DiddyAppMethod New(title:String, width:Int, height:Int, virtualResolutionWidth:Int, virtualResolutionHeight:Int, filterTextures:Bool = True)Super.New(title, width, height, virtualResolutionWidth, virtualResolutionHeight, filterTextures)LoadAssets()CreateScreens()Start(GetScreen(Screen.TITLE_SCREEN))EndMethod LoadAssets()AssetBank.LoadImage("title.png")EndMethod CreateScreens()AddScreen(New TitleScreen(Screen.TITLE_SCREEN))AddScreen(New GameScreen(Screen.GAME_SCREEN))EndEndClass TitleScreen Extends ScreenField titleImage:ImageField mxImage:ImageMethod New(title:String)Super.New(title)EndMethod Load() OverrideAssetBank.LoadImage("monkey2logo.png")EndMethod Start() OverridetitleImage = AssetBank.GetImage("title.png")mxImage = AssetBank.GetImage("monkey2logo.png")EndMethod Render(canvas:Canvas, tween:Float) Overridecanvas.DrawImage(titleImage, Window.VirtualResolution.X / 2, Window.VirtualResolution.X / 4)canvas.DrawImage(mxImage, Window.VirtualResolution.X - (mxImage.Width / 2) - 2, Window.VirtualResolution.Y - (mxImage.Height / 2) - 2)canvas.DrawText("Press Space to Play!", Window.VirtualResolution.X / 2, Window.VirtualResolution.Y - canvas.Font.Height * 2, .5)EndMethod Update(delta:Float) OverrideIf Keyboard.KeyDown(Key.Escape)MoveToScreen(ScreenBank.GetScreen(Screen.EXIT_SCREEN))EndIf Keyboard.KeyDown(Key.Space)MoveToScreen(ScreenBank.GetScreen(Screen.GAME_SCREEN))EndEndEndClass GameScreen Extends ScreenMethod New(title:String)Super.New(title)EndMethod Load() OverrideEndMethod Start() OverrideEndMethod Render(canvas:Canvas, tween:Float) Overridecanvas.DrawText("Game Screen!", Window.VirtualResolution.X / 2, Window.VirtualResolution.Y / 2, .5)EndMethod Update(delta:Float) OverrideIf Keyboard.KeyDown(Key.Escape)MoveToScreen(ScreenBank.GetScreen(Screen.TITLE_SCREEN))EndEndEndAnd have your folder structure as such:
Monkey1234567891011|-Projects|----|----diddy2|----|------|----diddy2.monkey2|----|----YourGame|----|------|----assets|----|------|------|----graphics|----|------|------|----sounds|----|------|------|----fonts|----|------|----game.monkey2November 19, 2017 at 4:02 pm #11824Thank you. Both of you helped to get it working which I appreciate.
Another error I am facing now is when I try to add my own screens. I wanted a Logo Screen so I created the class for it and extended the Screen Class. When I set it to start with the LOGO_SCREEN it spits an error stating that Screen has no member named LOGO_SCREEN.
If you can help, mr revills, I would appreciate it….
Thank you.
November 19, 2017 at 9:46 pm #11833ok, with a bit of trial and error and reading the source for ‘Screen’, you have to do the following to add new screens that are not hardcoded in the Screen class.
To add a new screen you must do the following In CreateScreen.
Monkey12345Method CreateScreens()>>>>> AddScreen(New LogoScreen("LOGO_SCREEN")) <<<<<<AddScreen(New TitleScreen(Screen.TITLE_SCREEN))AddScreen(New GameScreen(Screen.GAME_SCREEN))EndIf you want LOGO_SCREEN to be the first screen to start when your app runs you must modify ‘Start’ to:
Start(GetScreen(“LOGO_SCREEN”))
That’s all…
November 20, 2017 at 7:39 am #11845Yep you got it!
I’ve only created a few constants for the most common screens:
- Const EMPTY_SCREEN:String = “EmptyScreen”
Const EXIT_SCREEN:String = “ExitScreen”
Const GAME_SCREEN:String = “GameScreen”
Const TITLE_SCREEN:String = “TitleScreen”
Const OPTIONS_SCREEN:String = “OptionsScreen”
Const GAME_OVER_SCREEN:String = “GameOverScreen”
Const LEVEL_SELECT_SCREEN:String = “LevelSelectScreen” -
AuthorPosts
You must be logged in to reply to this topic.