Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

27. May 2012, 01:03:14 am
Xith3D CommunityGeneral CategoryNews (Moderators: Marvin Fröhlich, 'n ddrylliog)New StopOperation feature in RenderLoop
Pages: [1]
Print
Author Topic: New StopOperation feature in RenderLoop  (Read 2071 times)
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« on: 01. January 2007, 04:13:58 pm »

If you exited your game by calling System.exit( 0 ), please don't do this anymore. It doesn't clear the screen and doesn't destroy the Display context correctly. Do it like this:

Code:
public class MyGame extends RenderLoop
{
    public void onKeyReleased(int key)
    {
        switch (key)
        {
            case KeyCode.VK_ESCAPE:
                this.end();
                break;
        }
    }
   
    public MyGame()
    {
        super( 128L );
       
        ...
       
        this.setStopOperation( StopOperation.DESTROY_AND_EXIT );
       
        this.begin();
    }
}

You may override the exit() and/or destroyAndExit() method(s) of the RenderLoop class to change/extend the exit behavior.

Marvin
Logged
hawkwind
Getting respectable
***
Offline Offline

Posts: 363



View Profile Email
« Reply #1 on: 01. January 2007, 05:47:32 pm »

Nice...on the subject of clear screens.  Is there any way to wipe the initial window prior to the display of it.  I find in my game the last rendered view is displayed the next time the game starts.  Or will the above handle this??
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #2 on: 01. January 2007, 05:57:02 pm »

Nice...on the subject of clear screens.  Is there any way to wipe the initial window prior to the display of it.  I find in my game the last rendered view is displayed the next time the game starts.  Or will the above handle this??

Exactly. The above should do the trick Smiley.

Marvin
Logged
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #3 on: 01. January 2007, 06:02:34 pm »

Shouldn't it be the default ?
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #4 on: 01. January 2007, 06:11:08 pm »

Shouldn't it be the default ?

Would be cool. But it would change the behaviour on existing games. So, no Cry
Logged
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #5 on: 01. January 2007, 07:30:20 pm »

Shouldn't it be the default ?

Would be cool. But it would change the behaviour on existing games. So, no Cry
Come on, it doesn't change lots of things ? But I guess you're right. So no.
Logged
starscream
Enjoying the stay
*
Offline Offline

Posts: 25


View Profile
« Reply #6 on: 02. January 2007, 09:28:11 pm »

i can not agree:
you do not have reached the 1.0-status - so you do not have a stable api!
change what ever you want and do it to have a clean, simple and stable one!
also the deprecated methods should be removed!
as long as it you document the changes their sould not be any problems that could not be solved.

if you ever release the 1.0 you can not change the api, but for now: use the force, luke Wink
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #7 on: 02. January 2007, 09:38:08 pm »

i can not agree:
you do not have reached the 1.0-status - so you do not have a stable api!
change what ever you want and do it to have a clean, simple and stable one!
also the deprecated methods should be removed!
as long as it you document the changes their sould not be any problems that could not be solved.

I agree partly. I will change the default of this thing. But we will remove the deprecated methods immediately prior to 1.0 release. No it is much easier for the users to see, that there's something deprecated and can start porting their code when they are ready for it. But I guess it is annoying, if one has to port each day.

And we can still change the API after 1.0 release. But then it has to be done in a higher minor version 1.(x+1).y

if you ever release the 1.0 you can not change the api, but for now: use the force, luke Wink

Ah, a brother Grin. But I prefer the dark side Wink.

Marvin
« Last Edit: 02. January 2007, 09:40:23 pm by Marvin Fröhlich » Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #8 on: 03. January 2007, 07:05:17 am »

Now the default StopOperation is DESTROY_AND_EXIT. Please be aware of it.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic