From 2058d60354e62f84ef915c7409bba445ad934dba Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Wed, 13 Jan 2016 08:30:23 -0500 Subject: settings xml'd --- main.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index dba3605..06df250 100644 --- a/main.cpp +++ b/main.cpp @@ -11,6 +11,9 @@ #include #include #include +#include + +using namespace tinyxml2; /* * TICKS_PER_SEC & MSEC_PER_TICK @@ -196,12 +199,21 @@ extern bool fadeWhite; extern bool fadeFast; extern int fadeIntensity; +unsigned int SCREEN_WIDTH; +unsigned int SCREEN_HEIGHT; + /******************************************************************************* * MAIN ************************************************************************ *******************************************************************************/ int main(/*int argc, char *argv[]*/){ //*argv = (char *)argc; + gameRunning=false; + + XMLDocument xml; + xml.LoadFile("config/settings.xml"); + SCREEN_WIDTH = xml.FirstChildElement("screen")->UnsignedAttribute("width"); + SCREEN_HEIGHT = xml.FirstChildElement("screen")->UnsignedAttribute("height"); /*! * (Attempt to) Initialize SDL libraries so that we can use SDL facilities and eventually @@ -529,7 +541,7 @@ void render(){ * see past the world render */ - if(currentWorld->getTheWidth() < SCREEN_WIDTH){ + if(currentWorld->getTheWidth() < (int)SCREEN_WIDTH){ offset.x = 0; }else if(!worldInside){ if(player->loc.x - SCREEN_WIDTH/2 < currentWorld->getTheWidth() * -0.5f) -- cgit v1.2.3