This site requires JavaScript, please enable it in your browser!
Greenfoot back
darkmist255
darkmist255 wrote ...

2011/11/17

Dynamic resolution; Re-calling the super() constructor

darkmist255 darkmist255

2011/11/17

#
Is it possible to use the "super" constructor more than one time per execution? It seems as though you can only use it at the very beginning of the execution. Anyway, that's my first thought on how to do the following. Is it possible to dynamically change the resolution of a game/program AFTER the program has started running?
bourne bourne

2011/11/17

#
You would have to create a new World for it to run through the constructor again where the super constructor is allowed to be called. However, I have no experience doing so. I do believe there was something in a recent update having multiple worlds so you should check into that. Under Greenfoot class I saw the method setWorld(World world)
darkmist255 darkmist255

2011/11/17

#
Hmm... I'll wait a few days and see if anyone has ever tried this and responds. If not, I'll just try some random thoughts out.
nccb nccb

2011/11/17

#
Bourne is right: the only way to change resolution is to use Greenfoot.setWorld to switch to a new world with a different size. The Greenfoot window will grow if needed to fit the new world, although it won't shrink again if the world gets smaller.
You need to login to post a reply.