weimingtom / angel-engine

Automatically exported from code.google.com/p/angel-engine
0 stars 0 forks source link

Window initilialization code should be separated from World init #68

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In the World class exists this piece of code :
//Reset values based on preferences
    antiAliasing = thePrefs.OverrideInt("WindowSettings", "antiAliasing", antiAliasing);
    fullScreen = thePrefs.OverrideInt("WindowSettings", "antiAliasing", fullScreen);
    resizable = thePrefs.OverrideInt("WindowSettings", "antiAliasing", resizable);
    windowHeight = thePrefs.OverrideInt("WindowSettings", "height", windowHeight);
    windowWidth = thePrefs.OverrideInt("WindowSettings", "width", windowWidth);
    windowName = thePrefs.OverrideString("WindowSettings", "name", windowName);

Obviously the Fullscreen and Resizable vars shouldn't be taking default data 
from the antialiasing var in the Lua. Just came across this when setting 
default vars in the LUA and AA was overriding my Fullscreen decision.

Original issue reported on code.google.com by chrisell...@gmail.com on 15 Jul 2012 at 8:39

GoogleCodeExporter commented 8 years ago
This is as designed, though you could argue that it's kind of an unfortunate 
design. The idea is that the preferences system needs to able to override 
things like resolution, but since the rest of Lua doesn't get initialized until 
later in the world init (after the window opens), it wouldn't get the data 
until too late. 

To resolve this properly would require a rearchitecting of the initialization 
function, which is not out of the question, but not something on the immediate 
horizon. 

Best quick fix for the time being would be to have the above code only get 
compiled in release mode? 

Original comment by lieseg...@gmail.com on 15 Jul 2012 at 8:46

GoogleCodeExporter commented 8 years ago
Oh, wait. I totally misread this. Yes, the variables there are misnamed. :-) 
Nevertheless, this bug stands as something to be addressed. :-D

Original comment by lieseg...@gmail.com on 15 Jul 2012 at 8:48

GoogleCodeExporter commented 8 years ago
Lol, was reading your response, thinking you got the wrong end of the stick :D

Yea My default.lua with this in

-- Any tables that you put in here will be loaded into Preferences

WindowSettings = {
    name = "Game Prototype",
    width = 1680,
    height = 1050,
    fullScreen = true,
    antiAliasing = true
}

Is and the AA overiding, I'm sure I could have explained it better heh.

Original comment by chrisell...@gmail.com on 15 Jul 2012 at 8:49

GoogleCodeExporter commented 8 years ago
Heh. Yeah, the required change is already pushed to the mainline repository. 
Good catch; thanks for reporting it. Leaving this open as a reminder that the 
current system is a little awkward and should be eventually rethought. 

Original comment by lieseg...@gmail.com on 15 Jul 2012 at 9:44

GoogleCodeExporter commented 8 years ago
Fixed/restructured in Angel4

Original comment by lieseg...@gmail.com on 7 Feb 2014 at 5:58