Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Tier 1 - Android - Rolling Menu

Author
Message
JHA
21
Years of Service
User Offline
Joined: 30th Dec 2003
Location: Massachusetts, USA
Posted: 2nd Dec 2013 21:21 Edited at: 2nd Dec 2013 22:05
Hello All,

I have a need to allow the users of my app to select a number, which corresponds to a day of the month, so it would be from 1 to 31, depending on the month.

Is there a good way to display the rolling menus that you see in some apps, or would I have to create it myself?

If I have to create it myself, does anyone have any ideas how to go about it?

EDIT: Or even a calendar option of some sort.

Thank you,
JHA
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 3rd Dec 2013 05:00
You'll have to create it yourself. AppGameKit is designed so that you need to create almost all UI elements.
There's 2 approaches to this that immediately come to mind:
One is where you have multiple text objects that stack on top of each other, this is kind of a pain, but an example can be found here of how to move the digits:
http://forum.thegamecreators.com/?m=forum_view&t=208163&b=41
The example is for a score counter in that case, but it'll give you an idea of how to do it.
The other way to do it is by creating an image that has all of your digits on it and then using SetSpriteUV commands to make the image and SetImageWrapU SetImageWrapV
Read this for that method:
http://www.appgamekit.com/documentation/Reference/Sprite/SetSpriteUVOffset.htm

Using UV is probably the simplest, but it will require a sprite for those 10 digits (or 12). I went with the text object method because I wanted the text clean and to keep my assets low. The code for a sprite with all the numbers would be easier though.

JHA
21
Years of Service
User Offline
Joined: 30th Dec 2003
Location: Massachusetts, USA
Posted: 3rd Dec 2013 17:41 Edited at: 3rd Dec 2013 17:42
Thank you Naphier!

Quote: "AGK is designed so that you need to create almost all UI elements."

Ah! I thought that since AppGameKit uses the device's Keyboard, that it would use those types of menus too. I guess those app makers must have created their own menus too.


I tried looking at your Score Counter example, but it doesn't display anything but the word "Operations" in the middle of the screen.

Should I be calling something in the Do-Loop?


I did not know about the SetSpriteUVOffset command, so that seems like a viable option. I was thinking of making something similar, but since that command already exists, it should be that much easier to implement.

Thanks again!
JHA
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 3rd Dec 2013 17:46 Edited at: 3rd Dec 2013 17:52
Oops! Looks like I left in a "SetTextVisible" call in there. Just find it and comment it out and it works fine

EDIT: Since AppGameKit is cross platform it is really hard to make native basic UI elements like dialogue boxes and such that work on all platforms. If you use Message() you'll see the only native UI element that AppGameKit has on every platform. I think it would have been possible for them to use native UI elements that you often see in Android and iOS apps, but I imagine it would add a lot of overhead to the bytecode file. Also personally I like to have the UI match the design of my app, but I do like the look of a lot of Android UI elements. Hopefully we can build a solid UI library with the help of the community. I may take a stab at it after my current game because I've made a lot of redundant code just in the name of UI.

JHA
21
Years of Service
User Offline
Joined: 30th Dec 2003
Location: Massachusetts, USA
Posted: 3rd Dec 2013 17:52
That did it. Thanks.

You might want to correct that in the "UI Functions Project" post from Daniel Foreman too.
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 3rd Dec 2013 17:53
Good note, thanks!

xCept
22
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 3rd Dec 2013 22:57
I faithfully ported the default UIPickerView from iOS to AppGameKit some time ago for one project I had originally developed in Objective C, complete with physics for snap back and fast scrolling. The AppGameKit port was never released due to a few lingering limitations, mostly due to slow memblock manipulation even with as many optimizations as I could make.



However it was designed specifically around that app and I can't recall how modular I developed it. I basically generate each item on-the-fly as a new sprite and position them one below the next. It supported at least two columns with the left being the main category and the right being individual items very much like the UI Picker.
JHA
21
Years of Service
User Offline
Joined: 30th Dec 2003
Location: Massachusetts, USA
Posted: 4th Dec 2013 16:44
Thanks xCept. That is GORGEOUS!!

That was my original thinking, that I would create individual sprites and put them one next to the other. I may still do that, but am looking into the SetSpriteUV commands, at the moment.

Thanks for the inspiration!

Login to post a reply

Server time is: 2025-05-23 16:15:08
Your offset time is: 2025-05-23 16:15:08