1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 15:02:34 +02:00

Re-implement -w and -h window size arguments

This commit is contained in:
Daniel Evans 2015-01-30 10:04:25 +00:00
parent 6cd36bda43
commit 854228e91b
3 changed files with 15 additions and 3 deletions

View File

@ -15,7 +15,7 @@
DebugDraw* debug;
RWGame::RWGame(const std::string& gamepath)
RWGame::RWGame(const std::string& gamepath, int argc, char* argv[])
: engine(nullptr), inFocus(true),
accum(0.f), timescale(1.f)
{
@ -25,6 +25,18 @@ RWGame::RWGame(const std::string& gamepath)
size_t w = GAME_WINDOW_WIDTH, h = GAME_WINDOW_HEIGHT;
for( int i = 1; i < argc; ++i )
{
if( strcasecmp( "-w", argv[i] ) == 0 && i+1 < argc )
{
w = std::atoi(argv[i+1]);
}
if( strcasecmp( "-h", argv[i] ) == 0 && i+1 < argc )
{
h = std::atoi(argv[i+1]);
}
}
sf::ContextSettings cs;
cs.depthBits = 32;
window.create(sf::VideoMode(w, h), "", sf::Style::Default, cs);

View File

@ -19,7 +19,7 @@ class RWGame
sf::Font font;
public:
RWGame(const std::string& gamepath);
RWGame(const std::string& gamepath, int argc, char* argv[]);
~RWGame();
int run();

View File

@ -12,7 +12,7 @@ std::string getGamePath()
int main(int argc, char *argv[])
{
RWGame game(getGamePath());
RWGame game( getGamePath(), argc, argv );
return game.run();
}