diff --git a/Salmon Engine/Salmon Engine.vcxproj b/Salmon Engine/Salmon Engine.vcxproj index 5bea888..e36fb02 100644 --- a/Salmon Engine/Salmon Engine.vcxproj +++ b/Salmon Engine/Salmon Engine.vcxproj @@ -22,6 +22,7 @@ + @@ -71,6 +72,7 @@ + diff --git a/include/GUIManager/GUIManager.h b/include/GUIManager/GUIManager.h index 936191b..2ce4a3c 100644 --- a/include/GUIManager/GUIManager.h +++ b/include/GUIManager/GUIManager.h @@ -3,6 +3,7 @@ #include "include/Render/RenderMisc.h" #include "include/GUIManager/ButtonWidget.h" +#include "include/GUIManager/KeyboardWidget.h" #include "include/GUIManager/WidgetXmlParsers.h" #include "include/Utils/Utils.h" #include "include/ScriptManager/ScriptManager.h" @@ -142,6 +143,8 @@ public: boost::signal KeyPressedSignal; //boost::signal PostUpdateSignal; + TGUIManager(); + ~TGUIManager(); void AddWidget(std::shared_ptr widgetAncestor, const std::string& name, const std::string& groupName, int order = 0); diff --git a/include/Utils/Console/console.h b/include/Utils/Console/console.h index 1b2f08d..613031d 100644 --- a/include/Utils/Console/console.h +++ b/include/Utils/Console/console.h @@ -15,6 +15,9 @@ Use global variable Console like that: #ifdef TARGET_WIN32 #include #endif +#ifdef TARGET_LINUX +#include +#endif #ifdef TARGET_ANDROID #include #include @@ -88,6 +91,28 @@ public: #endif +#ifdef TARGET_LINUX + +class TFileConsole : public TSimpleConsole +{ +protected: + std::string filename; + std::ofstream f; +public: + TFileConsole(); + + TFileConsole(const std::string& Afilename); + + ~TFileConsole(); + + TFileConsole& operator<<(const std::string& s); + + void PrintImmediate(const std::string& s); +}; + +#endif + + #ifdef TARGET_ANDROID class TJavaConsole : public TSimpleConsole diff --git a/include/Utils/ErrorTypes/ErrorTypes.h b/include/Utils/ErrorTypes/ErrorTypes.h index fe898e0..93089f6 100644 --- a/include/Utils/ErrorTypes/ErrorTypes.h +++ b/include/Utils/ErrorTypes/ErrorTypes.h @@ -15,6 +15,10 @@ namespace SE extern TFileConsole* Console; #endif +#ifdef TARGET_LINUX +extern TFileConsole* Console; +#endif + #ifdef TARGET_ANDROID extern TJavaConsole* Console; #endif diff --git a/include/Utils/FileUtils/FileUtils.h b/include/Utils/FileUtils/FileUtils.h index 6b483da..2699654 100644 --- a/include/Utils/FileUtils/FileUtils.h +++ b/include/Utils/FileUtils/FileUtils.h @@ -158,6 +158,51 @@ boost::shared_array CreateMemFromFile(const std::string& fileName, car } #endif +#ifdef TARGET_LINUX + +template +boost::shared_array CreateMemFromFile(const std::string& fileName, cardinal& intCount) +{ + cardinal SIZEOF_TYPENAME = sizeof(TYPENAME); + + FILE * pFile; + + long fSize; + + size_t result; + + TYPENAME* fileData; + + + if (fopen(&pFile, fileName.c_str(), "rb" ) != 0) + { + throw ErrorToLog("File not loaded: " + fileName); + } + + // obtain file size: + fseek (pFile , 0 , SEEK_END); + fSize = ftell (pFile); + rewind (pFile); + + fileData = new TYPENAME [fSize % SIZEOF_TYPENAME == 0 ? fSize/SIZEOF_TYPENAME : fSize/SIZEOF_TYPENAME + 1]; + + result = fread (&fileData[0], 1, fSize, pFile); + + if (result != fSize) + { + throw ErrorToLog("File not loaded: " + fileName); + } + + // terminate + fclose (pFile); + + intCount = fSize; + + return boost::shared_array(fileData); + +} +#endif + #ifdef TARGET_ANDROID template diff --git a/src/GUIManager/GUIManager.cpp b/src/GUIManager/GUIManager.cpp index c9767e0..88919b3 100644 --- a/src/GUIManager/GUIManager.cpp +++ b/src/GUIManager/GUIManager.cpp @@ -9,6 +9,11 @@ const std::string CONST_CLICK_SIGNAL_NAME = "OnClick"; const std::string CONST_DRAG_SIGNAL_NAME = "OnDrag"; +TGUIManager::TGUIManager() +{ + +} + TGUIManager::~TGUIManager() { diff --git a/src/SalmonEngineInterface.cpp b/src/SalmonEngineInterface.cpp index 26e5fae..f57aa5c 100644 --- a/src/SalmonEngineInterface.cpp +++ b/src/SalmonEngineInterface.cpp @@ -17,7 +17,6 @@ TSalmonRenderer* Renderer; TIosConsole* Console; TSalmonRendererIos* Renderer; #endif - TResourceManager* ResourceManager; diff --git a/src/Utils/Console/Console.cpp b/src/Utils/Console/Console.cpp index 10f8afa..74337fb 100644 --- a/src/Utils/Console/Console.cpp +++ b/src/Utils/Console/Console.cpp @@ -140,6 +140,55 @@ void TFileConsole::PrintImmediate(const std::string& s) +#endif + + +#ifdef TARGET_LINUX + +TFileConsole::TFileConsole() + : filename("conlog.txt") + , f("conlog.txt") +{ +} + +TFileConsole::TFileConsole(const std::string& Afilename) + : filename(Afilename) + , f(Afilename) +{ +} + +TFileConsole::~TFileConsole() +{ + f.close(); +} + +TFileConsole& TFileConsole::operator<<(const std::string& s) +{ + boost::posix_time::ptime t = boost::posix_time::second_clock::local_time(); + + std::string string_with_time_mark; + + string_with_time_mark = to_simple_string(t)+": "+s; + + PrintImmediate(string_with_time_mark); + + History += string_with_time_mark+endl; + CutHistory(); + + return *this; +} + + +void TFileConsole::PrintImmediate(const std::string& s) +{ + + f<