|
@@ -15,6 +15,7 @@
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
*/
|
|
|
|
|
|
+#include <GL/gl.h>
|
|
|
#include <sstream>
|
|
|
#include <thread>
|
|
|
#include <fstream>
|
|
@@ -23,14 +24,15 @@
|
|
|
#include "IngameState.hpp"
|
|
|
#include "MenuState.hpp"
|
|
|
#include "Utility.hpp"
|
|
|
-#include <GL/gl.h>
|
|
|
|
|
|
Triangles::Triangles(int argc, char** argv):
|
|
|
_returnCode(0),
|
|
|
- _window("Triangles", sf::Vector2u(640u, 480u)),
|
|
|
_current(nullptr),
|
|
|
_initialState(State::Menu)
|
|
|
{
|
|
|
+ _variables.versionMajor = 0;
|
|
|
+ _variables.versionMinor = 0;
|
|
|
+ _variables.versionBuild = 8;
|
|
|
_variables.fullscreen = false;
|
|
|
_variables.borderless = false;
|
|
|
_variables.vsync = true;
|
|
@@ -42,14 +44,19 @@ Triangles::Triangles(int argc, char** argv):
|
|
|
_variables.assets = &_assets;
|
|
|
_variables.core = this;
|
|
|
_variables.foreground = nullptr;
|
|
|
+
|
|
|
/**
|
|
|
- * Shintel has bugs, so we detect if the graphics card is shintel iGPU.
|
|
|
+ * Shintel has bugs on windows, so we detect if the graphics card is shintel iGPU.
|
|
|
*/
|
|
|
if(glGetString(GL_VENDOR)[0] == (unsigned char)'I')
|
|
|
_variables.mustRecreate = true;
|
|
|
else
|
|
|
_variables.mustRecreate = false;
|
|
|
|
|
|
+ std::ostringstream oss;
|
|
|
+ oss << "Triangles v" << _variables.versionMajor << '.' << _variables.versionMinor << '.' << _variables.versionBuild;
|
|
|
+ _window.create(oss.str(), sf::Vector2u(640, 480));
|
|
|
+
|
|
|
passArguments(argc, argv);
|
|
|
|
|
|
if(_variables.running)
|
|
@@ -105,11 +112,7 @@ void Triangles::passArguments(int argc, char** argv)
|
|
|
{
|
|
|
std::string argvStr[argc];
|
|
|
for(int i = 0; i < argc; ++i)
|
|
|
- {
|
|
|
argvStr[i] = argv[i];
|
|
|
- if(argvStr[i].size() < 2)
|
|
|
- argvStr[i] = "--kaczka";
|
|
|
- }
|
|
|
searchArgument(argc, argvStr, "f", "fullscreen", [this]()
|
|
|
{
|
|
|
_variables.fullscreen = true;
|
|
@@ -130,6 +133,19 @@ void Triangles::passArguments(int argc, char** argv)
|
|
|
{
|
|
|
_initialState = State::Ingame;
|
|
|
});
|
|
|
+ searchArgument(argc, argvStr, "l", "loglevel", [this](std::string param)
|
|
|
+ {
|
|
|
+ if(param == "0")
|
|
|
+ Echo::setLogLevel(0);
|
|
|
+ else if(param == "2")
|
|
|
+ Echo::setLogLevel(2);
|
|
|
+ else if(param == "3")
|
|
|
+ Echo::setLogLevel(3);
|
|
|
+ else if(param == "4")
|
|
|
+ Echo::setLogLevel(4);
|
|
|
+ else
|
|
|
+ Echo::setLogLevel(1);
|
|
|
+ });
|
|
|
searchArgument(argc, argvStr, "sf", "skipfullscreen", [this]()
|
|
|
{
|
|
|
_initialState = State::Ingame;
|
|
@@ -276,8 +292,10 @@ void Triangles::load(int stateType)
|
|
|
|
|
|
_current->refresh();
|
|
|
|
|
|
- if(_variables.mustRecreate)
|
|
|
+ #ifndef __linux__
|
|
|
+ if(_variables.mustRecreate || stateType == State::Menu)
|
|
|
_window.recreate();
|
|
|
+ #endif
|
|
|
|
|
|
Echo::debug("Done.");
|
|
|
}
|
|
@@ -289,11 +307,11 @@ int Triangles::run()
|
|
|
|
|
|
if(_context.running)
|
|
|
{
|
|
|
- Echo::out(Echo::Empty, "Triangles version 0.0.6");
|
|
|
- Echo::out(Echo::Empty, "Copyright (C) 2016 POSITIVE MENTAL ATTITUDE");
|
|
|
- Echo::out(Echo::Empty, "This program comes with ABSOLUTELY NO WARRANTY;");
|
|
|
- Echo::out(Echo::Empty, "This is free software, and you are welcome to redistribute it");
|
|
|
- Echo::out(Echo::Empty, "under certain conditions; see LICENSE file");
|
|
|
+ Echo::out("Triangles version ", _variables.versionMajor, '.', _variables.versionMinor, '.', _variables.versionBuild);
|
|
|
+ Echo::out("Copyright (C) 2016 POSITIVE MENTAL ATTITUDE");
|
|
|
+ Echo::out("This program comes with ABSOLUTELY NO WARRANTY;");
|
|
|
+ Echo::out("This is free software, and you are welcome to redistribute it");
|
|
|
+ Echo::out("under certain conditions; see LICENSE file");
|
|
|
}
|
|
|
|
|
|
/**
|