SIO2 Menus - Using Widgets
+2
oioioi
Jawdy
6 posters
Page 2 of 2 • 1, 2
help
Hy!
Can you send me some informations about how did you create the menu with SIO2. I've searched alot on the internet but didn't found anything about this and I don't know how to do it.
my email address is bboyandru@yahoo.com , I'd be very thankfull for any response.
Can you send me some informations about how did you create the menu with SIO2. I've searched alot on the internet but didn't found anything about this and I don't know how to do it.
my email address is bboyandru@yahoo.com , I'd be very thankfull for any response.
bboyandru- Posts : 11
Join date : 2009-09-02
Re: SIO2 Menus - Using Widgets
bboyandru wrote:Hy!
Can you send me some informations about how did you create the menu with SIO2. I've searched alot on the internet but didn't found anything about this and I don't know how to do it.
Basically I used multiple SIO2Window->Render functions, one for each of the menu's and the main one for the actual game. Then using SIO2WidgetEnable and Disable, turned off the Widgets for menu's that aren't being displayed and turned on Widgets for the currently displayed Menu.
Re: SIO2 Menus - Using Widgets
That's one technique... I personally like to create multiple struct and each contain its own SIO2resource then I can load / unload / render the menu that I want at anytime during the game.
You can check the meditation garden source for this. Im using the same technique in there for the HUD.
You can check the meditation garden source for this. Im using the same technique in there for the HUD.
Re: SIO2 Menus - Using Widgets
Thank you for the replies, but I need some examples, if you can help me...
bboyandru- Posts : 11
Join date : 2009-09-02
Re: SIO2 Menus - Using Widgets
sio2interactive wrote:That's one technique... I personally like to create multiple struct and each contain its own SIO2resource then I can load / unload / render the menu that I want at anytime during the game.
You can check the meditation garden source for this. Im using the same technique in there for the HUD.
bboyandru wrote:Thank you for the replies, but I need some examples, if you can help me...
create a specific file for your menu in the header create a structure with all the widget you want
- Code:
typedef struct
{
SIO2resource *_resource;
SIO2widget *splashFond;
SIO2widget *splash1;
SIO2widget *splash2;
SIO2widget *menus1;
SIO2widget *selection;
SIO2widget *jouer;
SIO2widget *credits;
SIO2widget *options;
SIO2widget *classement;
} UImenus;
init all those widget in an init method in the cpp file and render it in a render method...
all of this can be found in the tutorials or in the meditation Garden source code (wich is only 100$.. and a damn good tutorial, without it my game would'nt be so advanced)
Re: SIO2 Menus - Using Widgets
https://sio2interactive.forumotion.net/sio2-engine-f3/animating-and-parenting-an-sio2widget-t457.htm#4842bboyandru wrote:Thank you for the replies, but I need some examples, if you can help me...
Francescu- Posts : 136
Join date : 2009-03-18
Re: SIO2 Menus - Using Widgets
sio2interactive wrote:You need to remove them from the resources... honestly me for menus I create separated SIO2resources and have 1 .sio2 with all my textures... after that I create a struct similar to the SIO2 ones and have like Init, Free, Render
Like that its really easy to Load/Unload a menu when you need it or don't need it...
Seems that I have trouble with menus too
Each time I try to free a menus it crashes in the sio2ResourceDispatchEvents method
at this line : SIO2widget *_SIO2widget = ( SIO2widget * )_SIO2resource->_SIO2widget[ i ];
my menus are simple, each of them have an SIO2resource, some widgets, callback event for widget, their own init free render method..
In fact it doesn't crashes at the free method but it crashes at the begining of the render method of the next menu.. (The first line of the render method is an nslog and it doesn't shows up, and the last line before calling the render method is also an nslog and it shows up)
but 1 time out of 5 it goes to the next menu..
this is my free method for the main menu..
- Code:
MENUS_PRINC *menusPrincFree( MENUS_PRINC *_menusPrinc )
{
sio2ResourceUnloadAll( _menusPrinc->_SIO2resource);
_menusPrinc->_SIO2resource = sio2ResourceFree( _menusPrinc->_SIO2resource );
NSLog(@"Menus Principal shutdown");
free (_menusPrinc);
return NULL;
}
Mayby it's too specific..
Re: SIO2 Menus - Using Widgets
You are freeing the menu while the event dispatcher is looping... Simply tag the menu destruction then execute it in the next rendering pass.
Re: SIO2 Menus - Using Widgets
What do you mean by "tag"?
LIke setting a boolean to true if the condition to pass to the next menu is respected? and then somewhere in the rendering method putting something like
if (boolean)
{
game->_menus1 = menus1Free(game->_menus1);
game_>menus2 = menus2Init;
}
I tried this but it crashes too
here's My render method simplified
so as I say in the code.. it crashes at a line that I think it isn't suposed to be called..
LIke setting a boolean to true if the condition to pass to the next menu is respected? and then somewhere in the rendering method putting something like
if (boolean)
{
game->_menus1 = menus1Free(game->_menus1);
game_>menus2 = menus2Init;
}
I tried this but it crashes too
here's My render method simplified
- Code:
void splashRender( void )
{
sio2->_SIO2resource = iggame->_splash->_SIO2resource;
if (iggame->_splash->libereSplash)
{
iggame->_splash = splashFree(iggame->_splash);
iggame->_menusPrinc = menusPrincInit();
sio2->_SIO2window->_SIO2windowrender = menusPrincRender;
}
sio2WindowEnter2D( sio2->_SIO2window, 0.0f, 100.0f );
{
sio2WindowEnterLandscape2D( sio2->_SIO2window );
{
{
//It crashes at this line after the free was called, but why it call it again after the free was called?? there's things that I don't undertand it seems..
sio2WidgetRender( iggame->_splash->_splashFond, sio2->_SIO2window, SIO2_TRANSFORM_MATRIX_BIND );
}
if (iggame->_splash->splash_time2 <= 0.0f)
{
iggame->_splash->libereSplash = 1;
}
sio2WidgetReset();
}
sio2WindowLeaveLandscape2D( sio2->_SIO2window );
}
sio2WindowLeave2D();
}
so as I say in the code.. it crashes at a line that I think it isn't suposed to be called..
Re: SIO2 Menus - Using Widgets
Ok.. I think i'm getting it.. I was freeing to soon, i moved my free method on the second render pass of the next menu, and it worked..
it's funny how 80% of the errors are just caused by the way you position your method calling..
it's funny how 80% of the errors are just caused by the way you position your method calling..
Page 2 of 2 • 1, 2
Similar topics
» about Menus, Buttons, Widgets...
» Menus again
» Budweiser, SIO2, & Beer Pong
» widgets taping
» SIO2 v1.3.6
» Menus again
» Budweiser, SIO2, & Beer Pong
» widgets taping
» SIO2 v1.3.6
Permissions in this forum:
You cannot reply to topics in this forum
|
|