aboutsummaryrefslogtreecommitdiff
path: root/src/client/main.cpp
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2018-03-09 23:55:49 -0500
committerAlexander Pickering <alexandermpickering@gmail.com>2018-03-09 23:55:49 -0500
commit2831e232b886c5e3b0791ea5192f9e5194e6abf3 (patch)
tree4fb9309d18f388673b7a21b8f0e927727006f585 /src/client/main.cpp
parent35b7c646fd7f80b64c1ef49b6d81f9df9bc1b940 (diff)
downloadbrokengine-2831e232b886c5e3b0791ea5192f9e5194e6abf3.tar.gz
brokengine-2831e232b886c5e3b0791ea5192f9e5194e6abf3.tar.bz2
brokengine-2831e232b886c5e3b0791ea5192f9e5194e6abf3.zip
Added IGUIImages
Added the ability to display itextures on the gui
Diffstat (limited to 'src/client/main.cpp')
-rw-r--r--src/client/main.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/client/main.cpp b/src/client/main.cpp
index 2d30c70..54aafc0 100644
--- a/src/client/main.cpp
+++ b/src/client/main.cpp
@@ -18,6 +18,7 @@ extern "C" {
#include "lua_api/load_game.hpp"
#include "lua_api/load_scene.hpp"
#include "lua_api/load_phys.hpp"
+#include "lua_api/load_video.hpp"
#include "callbackhandeler.hpp"
#include "../shared/lua_api/common.h"
@@ -37,13 +38,23 @@ using namespace std::chrono;
lua_State* L;
IrrlichtDevice* device;
-
+IVideoDriver* driver;
void loadIrrLibs(lua_State* L, IrrlichtDevice* device){
- printf("Loading guifuncs...\n");
+ printf("Loading guifuncs...");
load_guifuncs(L);
+ printf("[OK]\n");
+ printf("Loading gamefuncs...");
load_gamefuncs(L);
+ printf("[OK]\n");
+ printf("Loading scenefuncs...");
load_scenefuncs(L);
+ printf("[OK]\n");
+ printf("Loading physfuncs...");
load_physfuncs(L);
+ printf("[OK]\n");
+ printf("Loading videofuncs...");
+ load_videofuncs(L);
+ printf("[OK]\n");
}
void RemoveISceneNode(btRigidBody* rb){
@@ -70,6 +81,7 @@ void QuaternionToEuler(const btQuaternion &TQuat, btVector3 &TEuler) {
}
void UpdateElement(btRigidBody* TObject){
+
if(TObject->getUserPointer() != NULL){
//UpdateRender(*Iterator);
scene::ISceneNode *Node = static_cast<scene::ISceneNode *>((TObject)->getUserPointer());
@@ -83,6 +95,7 @@ void UpdateElement(btRigidBody* TObject){
QuaternionToEuler(TObject->getOrientation(), EulerRotation);
Node->setRotation(core::vector3df(EulerRotation[0], EulerRotation[1], EulerRotation[2]));
}
+
}
int main(int argc, char *argv[]){
@@ -117,20 +130,18 @@ int main(int argc, char *argv[]){
//Load some menu
loadMenu("Some menu",device);
- IVideoDriver* driver = device->getVideoDriver();
+ driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
- device->setWindowCaption(L"Bork[en]gine Client");
+ device->setWindowCaption(L"Brok[en]gine Client");
printf("Everything registered, about to start running device!\n");
//u32 TimeStamp = irrTimer->getTime(), DeltaTime = 0;
//high_resolution_clock::time_point t1 = high_resolution_clock::now();
while(device->run()){
- printf("Game loop:\n");
gameloop_net(L);
- printf("Update phys:\n");
gameloop_phys(UpdateElement);
if(device->isWindowActive()){
//high_resolution_clock::time_point now = high_resolution_clock::now();
@@ -138,35 +149,29 @@ int main(int argc, char *argv[]){
//double steps = delta.count() * 100;
//UpdatePhysics(steps,UpdateElement);
//t1 = now;
- printf("beginscene\n");
driver->beginScene(true, true, SColor(255,100,101,140));
- printf("scene drawAll\n");
smgr->drawAll();
- printf("gui drawAll\n");
guienv->drawAll();
- printf("scene end\n");
driver->endScene();
}else{
device->yield();
}
lua_getglobal(state,"GAME");//{}
lua_getfield(state,-1,"tick");//{},function_tick()
- printf("Tick\n");
if(!lua_isnil(state,-1)){
lua_call(state,0,0);
lua_pop(state,1);
}else{
lua_pop(state,2);
}
+ //lua_pop(state,2);
}
- printf("Closeing lua state...\n");
//lua_close(state);
//printf("clearing objects...\n");
//ClearObjects(World,Objects,RemoveISceneNode); //Clearing objects must be done after we droped the device.
phys_shutdown(RemoveISceneNode);
device->drop();
- printf("droped device\n");
return 0;
}