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.

SIO2 Menus - Using Widgets

+2
oioioi
Jawdy
6 posters

Page 2 of 2 Previous  1, 2

Go down

SIO2 Menus - Using Widgets - Page 2 Empty help

Post  bboyandru Wed Sep 02, 2009 9:14 am

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.

bboyandru

Posts : 11
Join date : 2009-09-02

Back to top Go down

SIO2 Menus - Using Widgets - Page 2 Empty Re: SIO2 Menus - Using Widgets

Post  Jawdy Wed Sep 02, 2009 9:18 am

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.
Jawdy
Jawdy

Posts : 65
Join date : 2009-03-17
Location : UK

http://www.gaslightgames.co.uk

Back to top Go down

SIO2 Menus - Using Widgets - Page 2 Empty Re: SIO2 Menus - Using Widgets

Post  sio2interactive Wed Sep 02, 2009 3:38 pm

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.
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

SIO2 Menus - Using Widgets - Page 2 Empty Re: SIO2 Menus - Using Widgets

Post  bboyandru Thu Sep 03, 2009 12:49 am

Thank you for the replies, but I need some examples, if you can help me...

bboyandru

Posts : 11
Join date : 2009-09-02

Back to top Go down

SIO2 Menus - Using Widgets - Page 2 Empty Re: SIO2 Menus - Using Widgets

Post  IanLinart Thu Sep 03, 2009 7:30 am

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)
IanLinart
IanLinart

Posts : 26
Join date : 2009-08-12
Age : 35
Location : Montréal

http://iapps.linart.qc.ca

Back to top Go down

SIO2 Menus - Using Widgets - Page 2 Empty Re: SIO2 Menus - Using Widgets

Post  Francescu Thu Sep 03, 2009 11:08 am

bboyandru wrote:Thank you for the replies, but I need some examples, if you can help me...
https://sio2interactive.forumotion.net/sio2-engine-f3/animating-and-parenting-an-sio2widget-t457.htm#4842

Francescu

Posts : 136
Join date : 2009-03-18

Back to top Go down

SIO2 Menus - Using Widgets - Page 2 Empty Re: SIO2 Menus - Using Widgets

Post  IanLinart Wed Sep 16, 2009 1:57 pm

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..
IanLinart
IanLinart

Posts : 26
Join date : 2009-08-12
Age : 35
Location : Montréal

http://iapps.linart.qc.ca

Back to top Go down

SIO2 Menus - Using Widgets - Page 2 Empty Re: SIO2 Menus - Using Widgets

Post  sio2interactive Wed Sep 16, 2009 5:07 pm

You are freeing the menu while the event dispatcher is looping... Simply tag the menu destruction then execute it in the next rendering pass.
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

SIO2 Menus - Using Widgets - Page 2 Empty Re: SIO2 Menus - Using Widgets

Post  IanLinart Thu Sep 17, 2009 6:09 am

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


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..
IanLinart
IanLinart

Posts : 26
Join date : 2009-08-12
Age : 35
Location : Montréal

http://iapps.linart.qc.ca

Back to top Go down

SIO2 Menus - Using Widgets - Page 2 Empty Re: SIO2 Menus - Using Widgets

Post  IanLinart Thu Sep 17, 2009 9:30 am

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..
IanLinart
IanLinart

Posts : 26
Join date : 2009-08-12
Age : 35
Location : Montréal

http://iapps.linart.qc.ca

Back to top Go down

SIO2 Menus - Using Widgets - Page 2 Empty Re: SIO2 Menus - Using Widgets

Post  Sponsored content


Sponsored content


Back to top Go down

Page 2 of 2 Previous  1, 2

Back to top

- Similar topics

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