Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <string.h>
- #include <stdarg.h>
- #include <typeinfo>
- #include <dirent.h>
- #include <sstream>
- #ifdef VISUAL_STUDIO_BUILD
- #include <direct.h>
- #include "io.h"
- #else
- #include <unistd.h>
- #endif
- #ifdef SFML_SYSTEM_WINDOWS
- #include <windows.h>
- #include "zip.h"
- #include "unzip.h"
- #endif
- #ifdef SFML_SYSTEM_MACOS
- #include <ApplicationServices/ApplicationServices.h>
- #include "ZIPHandler.h"
- #endif
- #ifdef SFML_SYSTEM_LINUX
- #include <X11/Xlib.h>
- #include <unistd.h>
- #include <pwd.h>
- #include <iostream>
- #include <stdlib.h>
- #endif
- #ifdef DEBUG
- #define DEBUG_LOG
- #endif
- using namespace game;
- Game::~Game()
- {
- clear();
- }
- #ifdef DEBUG
- std::ofstream out("out.txt");
- #endif // DEBUG
- #ifdef SFML_SYSTEM_LINUX
- XInitThreads();
- #endif
- void Game::init()
- {
- /*Overworld * testObject = new Overworld(0);
- void * testObjectVoidPtr = new Game();
- printf("typeid: %s\n", typeid(testObject).name());
- printf("typeid: %s\n", typeid(testObjectVoidPtr).name());
- if (dynamic_cast<GameState *>(testObject)) {
- printf("Is game state ... \n");
- }
- else {
- printf("Is not game state ... \n");
- }
- return;*/
- #ifdef DEBUG
- // std::streambuf *coutbuf = std::cout.rdbuf();
- //std::cout.rdbuf(out.rdbuf());
- sf::err().rdbuf(out.rdbuf());
- #endif // DEBUG
- STRING configFilePath = Utils::getPlatformSpecificResourcePath() + "data/conf.dat";
- configurationStorage = new Configuration();
- configurationStorage->readConfigFile(configFilePath.c_str());
- #ifdef SFML_SYSTEM_MACOS
- CreateApplicationSupportFolder();
- #endif
- nativeScreenSize.x = sf::VideoMode::getDesktopMode().width;
- nativeScreenSize.y = sf::VideoMode::getDesktopMode().height;
- unsigned int WndFlags = sf::Style::Close;
- #ifdef DEBUG_LOG
- sf::err() << "Native screen size: " << nativeScreenSize.x << "x" << nativeScreenSize.y << std::endl;
- #endif
- if (strcmp(configurationStorage->getParameter("fullscreen"), "yes") == 0) {
- WndFlags |= sf::Style::Fullscreen;
- }
- srand((unsigned)time(0));
- unsigned int screenWidth = atoi(configurationStorage->getParameter("width"));
- unsigned int screenHeight = atoi(configurationStorage->getParameter("height"));
- #ifdef DEBUG_LOG
- sf::err() << "Requesting screen size: " << screenWidth << "x" << screenHeight << std::endl;
- sf::err() << "Requesting fullscreen: " << (strcmp(configurationStorage->getParameter("fullscreen"), "yes") == 0) << std::endl;
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement