keyboard + linux stuff
This commit is contained in:
1 parent
a89cfc0371
commit
490cdad867
9 files changed
+136
-1
No files matched your search
@@ -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<void(int)> KeyPressedSignal;
|
||||
//boost::signal<void()> PostUpdateSignal;
|
||||
|
||||
TGUIManager();
|
||||
|
||||
~TGUIManager();
|
||||
|
||||
void AddWidget(std::shared_ptr<TInstancingWidgetAncestor> widgetAncestor, const std::string& name, const std::string& groupName, int order = 0);
|
||||
|
||||
@@ -15,6 +15,9 @@ Use global variable Console like that:
|
||||
#ifdef TARGET_WIN32
|
||||
#include <fstream>
|
||||
#endif
|
||||
#ifdef TARGET_LINUX
|
||||
#include <fstream>
|
||||
#endif
|
||||
#ifdef TARGET_ANDROID
|
||||
#include <asm/page.h>
|
||||
#include <limits.h>
|
||||
@@ -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
|
||||
|
||||
@@ -15,6 +15,10 @@ namespace SE
|
||||
extern TFileConsole* Console;
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_LINUX
|
||||
extern TFileConsole* Console;
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_ANDROID
|
||||
extern TJavaConsole* Console;
|
||||
#endif
|
||||
|
||||
@@ -158,6 +158,51 @@ boost::shared_array<TYPENAME> CreateMemFromFile(const std::string& fileName, car
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_LINUX
|
||||
|
||||
template<typename TYPENAME>
|
||||
boost::shared_array<TYPENAME> 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<TYPENAME>(fileData);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_ANDROID
|
||||
|
||||
template<typename TYPENAME>
|
||||
|
||||
Reference in new issue
Block a user