* made better base for different scenes (startup, loading, world,...)
* first time to display something on GUI. * corrected (again) major typo, thx bLuma! * added some sample data to display. * moved log.cpp/h to shared. * cant update vc80 files right now, sorry.
This commit is contained in:
parent
b7a4ae92c5
commit
87f708a0fd
BIN
bin/data/misc/burninglogo.png
Normal file
BIN
bin/data/misc/burninglogo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
BIN
bin/data/misc/directxlogo.png
Normal file
BIN
bin/data/misc/directxlogo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.7 KiB |
BIN
bin/data/misc/irrlichtlogo.png
Normal file
BIN
bin/data/misc/irrlichtlogo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
bin/data/misc/opengllogo.png
Normal file
BIN
bin/data/misc/opengllogo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@ -89,7 +89,7 @@ void DefScriptPackage::_InitFunctions(void)
|
|||||||
AddFunc("shdn",&DefScriptPackage::func_shdn);
|
AddFunc("shdn",&DefScriptPackage::func_shdn);
|
||||||
AddFunc("loaddef",&DefScriptPackage::func_loaddef);
|
AddFunc("loaddef",&DefScriptPackage::func_loaddef);
|
||||||
AddFunc("reloaddef",&DefScriptPackage::func_reloaddef);
|
AddFunc("reloaddef",&DefScriptPackage::func_reloaddef);
|
||||||
AddFunc("reloaddef",&DefScriptPackage::func_unloaddef);
|
AddFunc("unloaddef",&DefScriptPackage::func_unloaddef);
|
||||||
AddFunc("setscriptpermission",&DefScriptPackage::func_setscriptpermission);
|
AddFunc("setscriptpermission",&DefScriptPackage::func_setscriptpermission);
|
||||||
AddFunc("toint",&DefScriptPackage::func_toint);
|
AddFunc("toint",&DefScriptPackage::func_toint);
|
||||||
AddFunc("add",&DefScriptPackage::func_add);
|
AddFunc("add",&DefScriptPackage::func_add);
|
||||||
|
|||||||
@ -3,25 +3,9 @@
|
|||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
#include "DrawObject.h"
|
#include "DrawObject.h"
|
||||||
#include "PseuWoW.h"
|
#include "PseuWoW.h"
|
||||||
|
#include "Scene.h"
|
||||||
#include "PseuGUI.h"
|
#include "PseuGUI.h"
|
||||||
|
|
||||||
using namespace irr;
|
|
||||||
using namespace core;
|
|
||||||
using namespace scene;
|
|
||||||
using namespace video;
|
|
||||||
using namespace io;
|
|
||||||
using namespace gui;
|
|
||||||
|
|
||||||
enum DriverIDs
|
|
||||||
{
|
|
||||||
NULLDEVICE = 0,
|
|
||||||
SOFTWARE = 1,
|
|
||||||
BURNINGSVIDEO = 2,
|
|
||||||
OPENGL = 3,
|
|
||||||
DIRECTX8 = 4,
|
|
||||||
DIRECTX9 = 5,
|
|
||||||
};
|
|
||||||
|
|
||||||
PseuGUIRunnable::PseuGUIRunnable()
|
PseuGUIRunnable::PseuGUIRunnable()
|
||||||
{
|
{
|
||||||
_gui = new PseuGUI();
|
_gui = new PseuGUI();
|
||||||
@ -53,6 +37,11 @@ PseuGUI::PseuGUI()
|
|||||||
_initialized = false;
|
_initialized = false;
|
||||||
_mustdie = false;
|
_mustdie = false;
|
||||||
_driverType = video::EDT_BURNINGSVIDEO; // nulldevice makes not really a sense to display stuff
|
_driverType = video::EDT_BURNINGSVIDEO; // nulldevice makes not really a sense to display stuff
|
||||||
|
_scenestate = SCENESTATE_NULL;
|
||||||
|
_smgr = NULL;
|
||||||
|
_device = NULL;
|
||||||
|
_guienv = NULL;
|
||||||
|
_scene = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
PseuGUI::~PseuGUI()
|
PseuGUI::~PseuGUI()
|
||||||
@ -108,6 +97,7 @@ void PseuGUI::_Init(void)
|
|||||||
_device->setWindowCaption(L"PseuWoW - Initializing");
|
_device->setWindowCaption(L"PseuWoW - Initializing");
|
||||||
_driver = _device->getVideoDriver();
|
_driver = _device->getVideoDriver();
|
||||||
_smgr = _device->getSceneManager();
|
_smgr = _device->getSceneManager();
|
||||||
|
_guienv = _device->getGUIEnvironment();
|
||||||
//...
|
//...
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
}
|
}
|
||||||
@ -115,12 +105,19 @@ void PseuGUI::_Init(void)
|
|||||||
void PseuGUI::Cancel(void)
|
void PseuGUI::Cancel(void)
|
||||||
{
|
{
|
||||||
DEBUG(logdebug("PseuGUI::Cancel()"));
|
DEBUG(logdebug("PseuGUI::Cancel()"));
|
||||||
_mustdie = true;
|
|
||||||
|
if(_scene)
|
||||||
|
{
|
||||||
|
delete _scene;
|
||||||
|
_scene = NULL;
|
||||||
|
}
|
||||||
if(_device)
|
if(_device)
|
||||||
{
|
{
|
||||||
_device->drop();
|
_device->drop();
|
||||||
_device = NULL;
|
_device = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
_mustdie = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PseuGUI::Shutdown(void)
|
void PseuGUI::Shutdown(void)
|
||||||
@ -149,9 +146,11 @@ void PseuGUI::Run(void)
|
|||||||
{
|
{
|
||||||
_driver->beginScene(true, true, 0);
|
_driver->beginScene(true, true, 0);
|
||||||
|
|
||||||
domgr.Update(); // iterate over DrawObjects, draw them and clean up
|
_UpdateSceneState();
|
||||||
|
DrawCurrentScene();
|
||||||
|
|
||||||
_smgr->drawAll();
|
_smgr->drawAll();
|
||||||
|
_guienv->drawAll();
|
||||||
|
|
||||||
_driver->endScene();
|
_driver->endScene();
|
||||||
}
|
}
|
||||||
@ -198,4 +197,39 @@ void PseuGUI::SetInstance(PseuInstance* in)
|
|||||||
_instance = in;
|
_instance = in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PseuGUI::SetSceneState(SceneState state)
|
||||||
|
{
|
||||||
|
_scenestate_new = state; // will be applied at next cycle
|
||||||
|
}
|
||||||
|
|
||||||
|
void PseuGUI::_UpdateSceneState(void)
|
||||||
|
{
|
||||||
|
if(_scenestate != _scenestate_new && _smgr)
|
||||||
|
{
|
||||||
|
_smgr->clear();
|
||||||
|
if(_scene)
|
||||||
|
delete _scene;
|
||||||
|
|
||||||
|
_scenestate = _scenestate_new;
|
||||||
|
|
||||||
|
logdebug("PseuGUI: switched to SceneState %u", _scenestate);
|
||||||
|
|
||||||
|
switch (_scenestate)
|
||||||
|
{
|
||||||
|
case SCENESTATE_GUISTART: _scene = new SceneGuiStart(this); break;
|
||||||
|
case SCENESTATE_WORLD: _scene = new SceneWorld(this); break;
|
||||||
|
default: _scene = new Scene(this); // will draw nothing, just yield the gui
|
||||||
|
}
|
||||||
|
|
||||||
|
logdebug("PseuGUI: scene created.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PseuGUI::DrawCurrentScene()
|
||||||
|
{
|
||||||
|
if(!_initialized)
|
||||||
|
return;
|
||||||
|
if(_scene)
|
||||||
|
_scene->Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,27 @@
|
|||||||
class PseuGUI;
|
class PseuGUI;
|
||||||
class Object;
|
class Object;
|
||||||
class PseuInstance;
|
class PseuInstance;
|
||||||
|
class Scene;
|
||||||
|
|
||||||
|
enum SceneState
|
||||||
|
{
|
||||||
|
SCENESTATE_NULL,
|
||||||
|
SCENESTATE_GUISTART,
|
||||||
|
SCENESTATE_LOGINSCREEN,
|
||||||
|
SCENESTATE_CHARACTERSELECTION,
|
||||||
|
SCENESTATE_LOADING,
|
||||||
|
SCENESTATE_WORLD
|
||||||
|
};
|
||||||
|
|
||||||
|
enum DriverIDs
|
||||||
|
{
|
||||||
|
NULLDEVICE = 0,
|
||||||
|
SOFTWARE = 1,
|
||||||
|
BURNINGSVIDEO = 2,
|
||||||
|
OPENGL = 3,
|
||||||
|
DIRECTX8 = 4,
|
||||||
|
DIRECTX9 = 5,
|
||||||
|
};
|
||||||
|
|
||||||
class PseuGUIRunnable : public ZThread::Runnable
|
class PseuGUIRunnable : public ZThread::Runnable
|
||||||
{
|
{
|
||||||
@ -22,6 +43,12 @@ private:
|
|||||||
|
|
||||||
class PseuGUI
|
class PseuGUI
|
||||||
{
|
{
|
||||||
|
// too bad friends are not inherited...
|
||||||
|
friend class Scene;
|
||||||
|
friend class SceneWorld;
|
||||||
|
friend class SceneGuiStart;
|
||||||
|
// ...
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PseuGUI();
|
PseuGUI();
|
||||||
~PseuGUI();
|
~PseuGUI();
|
||||||
@ -35,14 +62,21 @@ public:
|
|||||||
void UseShadows(bool);
|
void UseShadows(bool);
|
||||||
void Cancel(void);
|
void Cancel(void);
|
||||||
void Shutdown(void);
|
void Shutdown(void);
|
||||||
|
inline bool IsInitialized(void) { return _initialized; }
|
||||||
|
|
||||||
inline bool MustDie(void) { return _mustdie; }
|
inline bool MustDie(void) { return _mustdie; }
|
||||||
|
|
||||||
// interfaces to tell the gui what to draw
|
// interfaces to tell the gui what to draw
|
||||||
void NotifyObjectDeletion(uint64 guid);
|
void NotifyObjectDeletion(uint64 guid);
|
||||||
void NotifyObjectCreation(Object *o);
|
void NotifyObjectCreation(Object *o);
|
||||||
|
|
||||||
|
// scenes
|
||||||
|
void DrawCurrentScene(void);
|
||||||
|
void SetSceneState(SceneState);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _Init(void);
|
void _Init(void);
|
||||||
|
void _UpdateSceneState(void);
|
||||||
uint16 _xres,_yres,_colordepth;
|
uint16 _xres,_yres,_colordepth;
|
||||||
bool _windowed,_vsync,_shadows;
|
bool _windowed,_vsync,_shadows;
|
||||||
bool _initialized,_mustdie;
|
bool _initialized,_mustdie;
|
||||||
@ -53,6 +87,8 @@ private:
|
|||||||
irr::video::E_DRIVER_TYPE _driverType;
|
irr::video::E_DRIVER_TYPE _driverType;
|
||||||
DrawObjMgr domgr;
|
DrawObjMgr domgr;
|
||||||
PseuInstance *_instance;
|
PseuInstance *_instance;
|
||||||
|
SceneState _scenestate, _scenestate_new;
|
||||||
|
Scene *_scene;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -94,7 +94,8 @@ PseuInstance::~PseuInstance()
|
|||||||
|
|
||||||
bool PseuInstance::Init(void)
|
bool PseuInstance::Init(void)
|
||||||
{
|
{
|
||||||
log_prepare("logfile.txt",this);
|
log_prepare("logfile.txt","a");
|
||||||
|
log_setloglevel(0);
|
||||||
log("");
|
log("");
|
||||||
log("--- Initializing Instance ---");
|
log("--- Initializing Instance ---");
|
||||||
|
|
||||||
@ -185,10 +186,20 @@ bool PseuInstance::Init(void)
|
|||||||
|
|
||||||
void PseuInstance::Run(void)
|
void PseuInstance::Run(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!_initialized)
|
if(!_initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
logdetail("PseuInstance: Initialized and running!");
|
||||||
|
|
||||||
|
if(GetGUI())
|
||||||
|
{
|
||||||
|
while(!GetGUI()->IsInitialized())
|
||||||
|
Sleep(1); // wait until the gui is ready. it will crash otherwise
|
||||||
|
logdebug("GUI: switching to startup display...");
|
||||||
|
GetGUI()->SetSceneState(SCENESTATE_GUISTART);
|
||||||
|
}
|
||||||
|
// TODO: as soon as username ans password can be inputted into the gui, wait until it was set by user.
|
||||||
|
|
||||||
if(GetConf()->realmlist.empty() || GetConf()->realmport==0)
|
if(GetConf()->realmlist.empty() || GetConf()->realmport==0)
|
||||||
{
|
{
|
||||||
logcritical("Realmlist address not set, can't connect.");
|
logcritical("Realmlist address not set, can't connect.");
|
||||||
@ -404,6 +415,8 @@ void PseuInstanceConf::ApplyFromVarSet(VarSet &v)
|
|||||||
num+=opt.at(i);
|
num+=opt.at(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_setloglevel(debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -177,12 +177,6 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\Client\HelperDefs.h">
|
RelativePath=".\Client\HelperDefs.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\Client\log.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\Client\log.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Client\main.cpp">
|
RelativePath=".\Client\main.cpp">
|
||||||
</File>
|
</File>
|
||||||
@ -426,6 +420,18 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\Client\Gui\PseuGUI.h">
|
RelativePath=".\Client\Gui\PseuGUI.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\Gui\Scene.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\Gui\Scene.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\Gui\SceneGuiStart.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\Gui\SceneWorld.cpp">
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
|
|||||||
@ -138,6 +138,12 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\shared\DebugStuff.h">
|
RelativePath=".\shared\DebugStuff.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\shared\log.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\shared\log.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\shared\SysDefs.h">
|
RelativePath=".\shared\SysDefs.h">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
#include "SysDefs.h"
|
#include "SysDefs.h"
|
||||||
#include "DebugStuff.h"
|
#include "DebugStuff.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
#include "ByteBuffer.h"
|
#include "ByteBuffer.h"
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,25 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "PseuWoW.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
PseuInstance *instance=NULL;
|
#if PLATFORM == PLATFORM_WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
FILE *logfile=NULL;
|
FILE *logfile=NULL;
|
||||||
|
uint8 loglevel=0;
|
||||||
|
|
||||||
|
|
||||||
void log_prepare(char *fn, PseuInstance* p)
|
void log_prepare(char *fn, char *mode = NULL)
|
||||||
{
|
{
|
||||||
logfile = fopen(fn,"a");
|
if(!mode)
|
||||||
instance = p;
|
mode = "a";
|
||||||
|
logfile = fopen(fn,mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void log_setloglevel(uint8 lvl)
|
||||||
|
{
|
||||||
|
loglevel = lvl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void log(const char *str, ...)
|
void log(const char *str, ...)
|
||||||
@ -40,7 +49,7 @@ void log(const char *str, ...)
|
|||||||
|
|
||||||
void logdetail(const char *str, ...)
|
void logdetail(const char *str, ...)
|
||||||
{
|
{
|
||||||
if(!str || instance->GetConf()->debug < 1)
|
if(!str || loglevel < 1)
|
||||||
return;
|
return;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
_log_setcolor(true,LCYAN);
|
_log_setcolor(true,LCYAN);
|
||||||
@ -65,7 +74,7 @@ void logdetail(const char *str, ...)
|
|||||||
|
|
||||||
void logdebug(const char *str, ...)
|
void logdebug(const char *str, ...)
|
||||||
{
|
{
|
||||||
if(!str || instance->GetConf()->debug < 2)
|
if(!str || loglevel < 2)
|
||||||
return;
|
return;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
_log_setcolor(true,LBLUE);
|
_log_setcolor(true,LBLUE);
|
||||||
@ -91,7 +100,7 @@ void logdebug(const char *str, ...)
|
|||||||
|
|
||||||
void logdev(const char *str, ...)
|
void logdev(const char *str, ...)
|
||||||
{
|
{
|
||||||
if(!str || instance->GetConf()->debug < 3)
|
if(!str || loglevel < 3)
|
||||||
return;
|
return;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
_log_setcolor(true,LMAGENTA);
|
_log_setcolor(true,LMAGENTA);
|
||||||
@ -161,9 +170,9 @@ void logcritical(const char *str, ...)
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void logcustom(uint8 loglevel, Color color, const char *str, ...)
|
void logcustom(uint8 lvl, Color color, const char *str, ...)
|
||||||
{
|
{
|
||||||
if(!str || instance->GetConf()->debug < loglevel)
|
if(!str || loglevel < lvl)
|
||||||
return;
|
return;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
_log_setcolor(true,color);
|
_log_setcolor(true,color);
|
||||||
@ -1,8 +1,6 @@
|
|||||||
#ifndef _LOG_H
|
#ifndef _LOG_H
|
||||||
#define _LOG_H
|
#define _LOG_H
|
||||||
|
|
||||||
class PseuInstance;
|
|
||||||
|
|
||||||
enum Color
|
enum Color
|
||||||
{
|
{
|
||||||
BLACK,
|
BLACK,
|
||||||
@ -22,7 +20,8 @@ enum Color
|
|||||||
WHITE
|
WHITE
|
||||||
};
|
};
|
||||||
|
|
||||||
void log_prepare(char *fn, PseuInstance* p); // instance reference needed for log level determination
|
void log_prepare(char *fn, char *mode);
|
||||||
|
void log_setloglevel(uint8 lvl);
|
||||||
void log(const char *str, ...);
|
void log(const char *str, ...);
|
||||||
void logdetail(const char *str, ...);
|
void logdetail(const char *str, ...);
|
||||||
void logdebug(const char *str, ...);
|
void logdebug(const char *str, ...);
|
||||||
Loading…
x
Reference in New Issue
Block a user