Is there a preprocessor for OUYA ?
Monkey Forums/Monkey Programming/Is there a preprocessor for OUYA ?
| ||
Is there a preprocessor TARGET for OUYA ? - checking the source it seems to be just using "android" ? /Stu |
| ||
Thats it. OUYA is based on Android Jelly Bean 4.1. The only parts OUYA added are the controllers and their IAP, which all 4 work beautifully using Monkey v75d :) |
| ||
Yea but i was thinking we need to detect if the screen is touch or not, i.e. menu handling changes to use up/down to move thru choices etc ... /Stu |
| ||
Literally just about to come over to make exactly the same request! I'm about to add a "public global IsOuya=1" to the top of my proggy. Would be handy if we could somehow distinguish between Ouya and Standard, whilst keeping the TARGET stuff the same. Perhaps if we could gain access to TARGET_NAME in the preprocessor, we could do some extra juicy stuff without breaking previously made differences. |
| ||
Oh yeah, I TOTALLY agree with you both! +1 on TARGET_NAME. It would be so much easier to be able to distiguish any target that way in addition to just the TARGET. |
| ||
you could add #TARGET_NAME="ouya" in the CONFIG.MONKEY. also, the Ouya CONFIG.MONKEY needs to have the gamepad enabled (it's off by default). |
| ||
I believe it already has #TARGET_NAME="Android (Ouya) Game" in the TARGET.MONKEY file. The problem is that you can't use #TARGET_NAME as a preprocessor directive. I'll play with putting the directive in the CONFIG.MONKEY file though. Maybe it will work from there? I'll try it out tonight. |
| ||
true, but you could add "#OUYA=true". |
| ||
I did not think you could use/make customized preprocessor directives like that in monkey. I tried doing that and worked well :) Thanks for that tip Adam! |
| ||
Hi, I'm not new to this, but your tip left me baffled. Care to explain that a bit!? I've added #OUYA=True into config.monkey, but... then what!?! Currently using the following code for testing.. #If TARGET="android" Crash() #End (where Crash isn't defined, so the compiler will stop when either of the Android targets are selected.) If you could explain how I could make that OUYA specific, that'd be great. |
| ||
Should be able to use it the same manner:#If OUYA Crash() #End I made a simple test: ' This will actually be in the CONFIG.MONKEY for the android_ouya target ' For demonstration purposes I added it here #OUYA=True Import mojo Class MyApp Extends App Method OnCreate() SetUpdateRate 15 End Method OnUpdate() End Method OnRender() Scale DeviceWidth/400.0,DeviceHeight/440.0 Cls #If OUYA DrawText " OUYA is True",20,0 #Else DrawText " OUYA is False",20,0 #End End End Function Main() New MyApp End This will work on ANY platform. I tested this on HTML5 for this demonstration, so what Adam provided is EXTREMELY cool :) If you place the directive in the app code, then you will need to set it to False manually to use the code on other platforms than the OUYA. If it's in the CONFIG.MONKEY file, its set and forget. Just use it like you would with any other preprocessor directive :) AGAIN, THANKS ADAM! |
| ||
OK, that's pretty much how I thought it would work. .. So, it's good to know that it actually isn't physically working, then. #OUYA=True #If OUYA Crash() #End Does indeed work, but if I, instead, put the #OUYA=True into Config.Monkey it point blank stops working. Sod it, I'm going with the "Const isOuya=1" method, at least I know that works.. Additionally, beware the overscan, guys! |
| ||
To my knowledge, the Config.Monkey file is only translated once when you build it the first time. To have the chances to it effect your app, you need to delete the build folder. At least it was like that some versions ago. |
| ||
I don't think that has changed any Mike. I forgot to mention that you'd need to delete the build :) |
| ||
+9999 to #TARGET_NAME in code. I have a semi-working FirefoxOS target, just needing this... |
| ||
OK, like ElectricBoogaloo, I have tried this on the OUYA (since I got back home and in front of it). Simply adding #OUYA=True to the CONFIG.MONKEY doesn't do ANYTHING - even after blowing away the BUILD folder and re-compiling the project. That said, if I simply add it to the TOP of my main file, it does work for the entire app :) It does somewhat suck in that I now need to set it to True or False, but thats far better than having a variable that adds more code bulk to the compiled game overall. I think I can live with that. Its not that big a problem. Even with this found, I would ideally love to still see access to #TARGET_NAME in code. |
| ||
+1 on the #TARGET_NAME suggestion. Monkey forums needs a voting platform for ideas IMO :) |
| ||
Also please add being able to grab the user name of the OUYA account (and also Google account please) as this would be very useful for online high scores so that one person doesn't fill up a board and they have one entry each. Thanks :) |