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:
parent
6cd36bda43
commit
854228e91b
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -12,7 +12,7 @@ std::string getGamePath()
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
RWGame game(getGamePath());
|
||||
RWGame game( getGamePath(), argc, argv );
|
||||
|
||||
return game.run();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user