FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Menus again

5 posters

Go down

Menus again Empty Menus again

Post  StasIsLovE Wed Sep 30, 2009 5:50 pm

Hi!

I am beginning a game project, idea is to use sio2, but first thing I did was to run into a wall with menus, I tried to look for info and reading old posts here but can't really find the answer.

I found that menus can be solved with widgets, I looked at tutorial 7, even though it is hard to grasp I might be able to make a menu given couple of days trying to understand the tutorial and hacking away in the template, but the problem is that I would like for player to be able to type the name, hence need for the keyboard, also I need several levels of menus before game start choosing different parameters.

I suspect that I don't really understand how things work good enough yet so the question might be stupid, but:

Is it possible to use a standard view with buttons from interface builder as in any other app, and then when the menu choices are done have a button "start" that loads an opengl view, initiates sio2 engine and hence only loads relevant resources based on choices from the menu?

Or perhaps there is a way to just get keyboard inside sio2 engine, and as I understand if one is to use widgets for menus one has to initialize a 2d window, draw menus, and when done release it and start a 3d window, and same thing when one is to come back to menus?

And for multilevel menus, just dealoc root widget and load new widget every time menu level changes?

Sorry about numerous questions but it is really hard to understand such things from tutorials.

StasIsLovE

Posts : 7
Join date : 2009-09-30

Back to top Go down

Menus again Empty Re: Menus again

Post  oioioi Thu Oct 01, 2009 1:07 am

You can have UIkit stuff on top of the gl view. I got a text box(from UIKit) on top of my gl view in one of my menu pages, worls perfect

oioioi

Posts : 136
Join date : 2008-12-02
Location : Norway

Back to top Go down

Menus again Empty Re: Menus again

Post  StasIsLovE Thu Oct 01, 2009 4:15 am

Sounds promising, thanks, I guess UIkit stuff includes UIviews as well, so that I can have multiple levels of menu sliding iPhone style and table view for hight score e.t.c.

StasIsLovE

Posts : 7
Join date : 2009-09-30

Back to top Go down

Menus again Empty Re: Menus again

Post  yarri Thu Oct 01, 2009 3:11 pm

Hi, there was a previous post about this here:
https://sio2interactive.forumotion.net/sio2-engine-f3/integrating-sio2-with-obj-c-classes-t791.htm

And you can see the combination of UIKit views, tables, etc live on the RideNGive Lite app:
http://itunes.com/apps/ridengivelite

--yarri

PS: I seems controversial, but I've integrated Cocos2D for menu and widget animation... works great.

yarri

Posts : 81
Join date : 2009-04-10

Back to top Go down

Menus again Empty Re: Menus again

Post  StasIsLovE Thu Oct 01, 2009 3:47 pm

Thanks, and sorry for not being able to find the thread myself, now I think I have everything I need to set up a template for my game. study

Looks like his might actually result in a game! bounce

StasIsLovE

Posts : 7
Join date : 2009-09-30

Back to top Go down

Menus again Empty Re: Menus again

Post  StasIsLovE Fri Oct 09, 2009 4:02 pm

Allright, trying to use UIViews for menus might have worked, I spent some time on it commenting out GLView an putting menus instead hoping to load GLView when "play" is pressed, but it seems to be quite complicated with delegate and all, needless to say few couple of days trying, no luck.

Meanwhile I consulted with my friend and he is telling me that the sane thing to do is just leave template as it is (except for refactoring et.c. which is already done) and create menus inside game engine, so I gave it a shot.

So I'v been hacking at widgets, and I can manage to create "buttons" and push them, e.t.c. now the next problem is hierarchy and how to implement it.

Because right now there is a load() function (as in tutorial) that loads images and initiates widgets, tap functions that detects when a widget is taped, and it is all rendered..

But there are some design questions:

1. How do I create menu hierarchy? Do I load all buttons in my load() function even those for submenus or is there a way to load widgets before they are to be displayed? Guess I can do the same thing I do in load() function but do it in widgetTaped() function to load next set of widgets to be displayed.

2. Render loop specifically states which widgets to render, that is: sio2WidgetRender(myWidget, sio2->_SIO2window, 0); hence I can't just render another set of widgets as it is now, what is the method to say stop rendering myWidget and start rendering myWidget2 in render loop?

My idea is when myWidget is taped there is a flag: bool myWidgetTaped that will be set to true and in render function have a case statement that does case myWidgetTaped: sio2WidgetRender(myWidget1, sio2->_SIO2window, 0); etc. rendering different widgets depending on the flag. But i have a feeling that there is a better way to create multi leveled menus.

Can someone share how to do hierarchical menus the proper way?

Thanks.

StasIsLovE

Posts : 7
Join date : 2009-09-30

Back to top Go down

Menus again Empty Re: Menus again

Post  sio2interactive Fri Oct 09, 2009 4:32 pm

Check the source of the MeditationGarden... there's a great and complete example there...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Menus again Empty Re: Menus again

Post  StasIsLovE Fri Oct 09, 2009 5:02 pm

Looks like I have to make a decision in near future, wether or not to commit to this project, several things I have tried to find in the forum point me to Meditation Garden, but I can't spend money just to try out, being a student and all.

Have to sleep on it, but it looks like a Meditation Garden purchase coming up... How does that work, since it is just a pay pal transfer?
Seems to be low on documentation on that front as well. Wink

StasIsLovE

Posts : 7
Join date : 2009-09-30

Back to top Go down

Menus again Empty Re: Menus again

Post  sio2interactive Fri Oct 09, 2009 6:58 pm

Well, All the tutorials are the basics in order to keep everything simple, from there its up to you to take it to the next level and link everything together. Depending of your experience and programming skills you might not need it... Personally, me only the SDK would be enough, but everyone have different skills... so...

MeditationGarden is only there to help you and show you how to put everything together and what the "next level" (while still keeping things as simple as I can while raising the bar a bit) can be...

Concerning the purchase, its pretty straight forward, as soon I receive the request I send you the link and the key in order for you to download & open the file by email.

For the documentation, everything is commented and the archive contain a video tutorial explaining how the architecture is build and show you how to export & link everything back as well as other info, extra script etc...In other words, you have access to all the source code, 2D & 3D assets, all original files .xcf, .blend etc... (everything for you to recompile from scratch)
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Menus again Empty Re: Menus again

Post  StasIsLovE Fri Oct 09, 2009 7:59 pm

I got menus working...

It is moving forward, slowly I understand SIO2 a bit more, which gives me hope that if I commit to this project I can finish it. bounce

Yes, Meditation Garden will certainly speed things up if nothing else, there is only one thing I must test fist (tomorrow) to see if it is feasible to do, and if it is, well then I am sold.

Thanks for your answers, it was certainly helpful.

StasIsLovE

Posts : 7
Join date : 2009-09-30

Back to top Go down

Menus again Empty Re: Menus again

Post  hamxiaoz Sun Oct 11, 2009 9:51 pm

Hi, since you got menus working, would you mind sharing your answers to your own questions?
I'm having the same question as you did several weeks ago... Thanks in advance.

hamxiaoz

Posts : 1
Join date : 2009-10-11

Back to top Go down

Menus again Empty Re: Menus again

Post  StasIsLovE Mon Oct 12, 2009 7:20 am

Hi I did the thing mentioned above:

First in template.mm load function create your button widgets for the main menu. In same file do myButtonDown(void*, void*, vec2 *){....} in which you do the same thing as you did in load but for the set of widgets you want to appear when that button is pressed. And have a global flag that decide what to render in renderer, so it looks like:

templateRenderer(){
if(globalFlag==0){
sio2WidgetRender(firstWidget, ...);
sio2WidgetRender(anotherWidget,...);
....
}else if(globalFlag==1){
sio2WidgetRender(nextWidget,....)
.....
} .....
}

myButtonDown(void *, void*, vec 2*){
// load next widgets
globalFlag = 1
// free first widgets if you like
}

templateLoad(){
//load widgets
yourWidget->sio2widgettapdown = myButtonDown;
globalFlag = 0;
// call to renderer
}


But it will be a lot of code when you create lots of widgets everywhere clogging your template making it ugly, so I created a class in new file called BasicWidget which has everything that all widgets share such as loading images, creating material, making widgets.

Then I have a new class for every button like PlayButtonClass that inherence from BasicWidget class and just have playButton specific things in it. Also instead of using flag = 1 e.t.c. i #define MAIN_MENU 0 #define OPTIO_MENU 1 etc. so it looks like:

#define MAIN_MENU 0
#define ....
....

PlayButton *myPlayWidget;
....

templateRender(
if(flag==MAIN_MENU){
sio2WidgetRender(myPlayWidget->widget,...);
....
}....
)

templateLoad(){
myPlayWidget = new PlayButton;
myPlayWidget->widget->sio2widgettapdown = yourTapDownFunc;
}

And so on.... Hope that helped, I don't know if it is the best way to do it though, but it works and it loads menus lazily, and deallocs not used menus right away, I have not made any back buttons but it should be easy, just call templateLoad function in your backButtonTapDown(){} and since menus are deallocated when they are not used there should be no leak.

StasIsLovE

Posts : 7
Join date : 2009-09-30

Back to top Go down

Menus again Empty Re: Menus again

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum