aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/callbackhandeler.cpp8
-rw-r--r--src/client/initdevice.cpp4
-rw-r--r--src/client/lua_api/gui/iguielement.cpp6
-rw-r--r--src/client/lua_api/gui/iguiimage.cpp12
-rw-r--r--src/client/lua_api/load_gui.cpp4
-rw-r--r--src/client/lua_api/load_phys.cpp11
-rw-r--r--src/client/lua_api/load_scene.cpp8
-rw-r--r--src/client/lua_api/load_video.cpp12
-rw-r--r--src/client/lua_api/phys/bphysbuffer.cpp2
-rw-r--r--src/client/lua_api/phys/bphysmodel.cpp2
-rw-r--r--src/client/lua_api/phys/cbphysbox.cpp4
-rw-r--r--src/client/lua_api/scene/icamera.cpp1
-rw-r--r--src/client/lua_api/scene/icube.cpp2
-rw-r--r--src/client/lua_api/video/iimage.cpp10
-rw-r--r--src/client/lua_api/video/itexture.cpp4
-rw-r--r--src/client/main.cpp8
16 files changed, 50 insertions, 48 deletions
diff --git a/src/client/callbackhandeler.cpp b/src/client/callbackhandeler.cpp
index fc44cbc..76fe693 100644
--- a/src/client/callbackhandeler.cpp
+++ b/src/client/callbackhandeler.cpp
@@ -36,11 +36,11 @@ bool GlobalEventReceiver::OnEvent(const SEvent& e){
case EET_GUI_EVENT:{
IGUIElement* caller = e.GUIEvent.Caller;
EGUI_EVENT_TYPE get = e.GUIEvent.EventType;
- printf("detected gui event: %d\n",get);
+ //printf("detected gui event: %d\n",get);
bool callerregistered = guifuncs.find(caller) != guifuncs.end();
bool callerhasfunc = guifuncs[caller].find(get) != guifuncs[caller].end();
if (callerregistered && callerhasfunc){
- printf("Found a callback for this event\n");
+ //printf("Found a callback for this event\n");
return guifuncs[caller][get](e);
}
return false;
@@ -114,7 +114,7 @@ bool GlobalEventReceiver::OnEvent(const SEvent& e){
break;
}
case EET_KEY_INPUT_EVENT:{
- printf("Got input event\n");
+ //printf("Got input event\n");
SEvent::SKeyInput se = e.KeyInput;
lua_getglobal(L,"GAME");//{}
lua_getfield(L,-1,"onKeyDown");//{},()|nil
@@ -131,7 +131,7 @@ bool GlobalEventReceiver::OnEvent(const SEvent& e){
break;
}
default:
- printf("Called an unknown event\n");
+ //printf("Called an unknown event\n");
return false;
}
}
diff --git a/src/client/initdevice.cpp b/src/client/initdevice.cpp
index e3af44c..79b6706 100644
--- a/src/client/initdevice.cpp
+++ b/src/client/initdevice.cpp
@@ -148,7 +148,7 @@ void parseSetting(const char* settingname, lua_State* L, settings* set){
void settingsFromTable(lua_State *L, SIrrlichtCreationParameters* p){
lua_pushnil(L);
settings* set = (settings*)malloc(sizeof(settings));
- printf("Loading settings:");
+ printf("Loading settings...");
while(lua_next(L,-2) != 0){
if(lua_isstring(L,-2)){
const char* setstr = lua_tostring(L,-2);
@@ -174,7 +174,7 @@ void settingsFromTable(lua_State *L, SIrrlichtCreationParameters* p){
}
IrrlichtDevice* spawnIrrDevice(lua_State* L){
- printf("Attempting to load settings...\n");
+ //printf("Attempting to load settings...\n");
int iErr = luaL_dofile(L,"../data/deviceinit.lua");
SIrrlichtCreationParameters p = SIrrlichtCreationParameters();
settingsFromTable(L,&p);
diff --git a/src/client/lua_api/gui/iguielement.cpp b/src/client/lua_api/gui/iguielement.cpp
index b62efef..436bf93 100644
--- a/src/client/lua_api/gui/iguielement.cpp
+++ b/src/client/lua_api/gui/iguielement.cpp
@@ -27,13 +27,13 @@ static LIGUIElement* toiguielement(lua_State* L){
//move({element},{x,y}) -> nil
int moveiguielement(lua_State* L){
- printf("Got call to move element\n");
+ //printf("Got call to move element\n");
long x,y;
popvector2i(L,&x,&y); //{element}
- printf("I want to move to %d %d\n",x,y);
+ //printf("I want to move to %d %d\n",x,y);
lua_getfield(L,-1,"guielement");//{element},*element
IGUIElement *el = (IGUIElement*)lua_touserdata(L,-1);
- printf("Found element to move: %p\n",el);
+ //printf("Found element to move: %p\n",el);
lua_pop(L,2);//
el->move(position2d<s32>(x,y));
diff --git a/src/client/lua_api/gui/iguiimage.cpp b/src/client/lua_api/gui/iguiimage.cpp
index af1e133..370da68 100644
--- a/src/client/lua_api/gui/iguiimage.cpp
+++ b/src/client/lua_api/gui/iguiimage.cpp
@@ -54,7 +54,7 @@ extern IGUIEnvironment* env;
//new({startx,starty},alpha,{itexture}) -> {guielement}
static int newiguiimage(lua_State* L){
- printf("Creating iguiimage\n");
+ //printf("Creating iguiimage\n");
lua_getfield(L,-1,"texture");//{startx,starty},alpha,{itexture},*itexture
video::ITexture* tex = (video::ITexture*)lua_touserdata(L,-1);
@@ -100,18 +100,18 @@ static const luaL_reg iguiimage_m[] = {
};
void iguiimage_register(lua_State* L){
- printf("Loading iguiimage\n");
+ //printf("Loading iguiimage\n");
luaL_newmetatable(L,"iguiimage");//{m_iguiimg}
- printf("made meta table\n");
+ //printf("made meta table\n");
lua_newtable(L);//{m_iguiimg},{}
luaL_register(L,NULL,iguiimage_m);//{m_iguiimg},{iguiimg_m}
- printf("About to set field\n");
+ //printf("About to set field\n");
lua_setfield(L,-2,"__index");//{m_iguiimg}
lua_pop(L,1);//
- printf("Got half way\n");
+ //printf("Got half way\n");
lua_getglobal(L,"gui");//{gui}
lua_pushcfunction(L,newiguiimage);//{gui},newimg()
lua_setfield(L,-2,"newiguiimage");//{gui}
lua_pop(L,1);//
- printf("Finished loading iguiimage\n");
+ //printf("Finished loading iguiimage\n");
}
diff --git a/src/client/lua_api/load_gui.cpp b/src/client/lua_api/load_gui.cpp
index eb611ef..c90c8f5 100644
--- a/src/client/lua_api/load_gui.cpp
+++ b/src/client/lua_api/load_gui.cpp
@@ -65,13 +65,13 @@ void load_guifuncs(lua_State* L){
int screenheight(lua_State* L){
core::rect<s32> dim = guidevice->getGUIEnvironment()->getRootGUIElement()->getAbsoluteClippingRect();
lua_pushnumber(L,dim.getHeight());
- printf("Got screen height:%d\n",dim.getWidth());
+ //printf("Got screen height:%d\n",dim.getWidth());
return 1;
}
int screenwidth(lua_State* L){
core::rect<s32> dim = guidevice->getGUIEnvironment()->getRootGUIElement()->getAbsoluteClippingRect();
lua_pushnumber(L,dim.getWidth());
- printf("Got screen width:%d\n",dim.getWidth());
+ //printf("Got screen width:%d\n",dim.getWidth());
return 1;
}
diff --git a/src/client/lua_api/load_phys.cpp b/src/client/lua_api/load_phys.cpp
index 846d34c..23bb22a 100644
--- a/src/client/lua_api/load_phys.cpp
+++ b/src/client/lua_api/load_phys.cpp
@@ -10,13 +10,20 @@ extern "C" {
#include <irrlicht.h>
#include "../callbackhandeler.hpp"
+#include "phys/cbphysbox.hpp"
+#include "phys/bphysmodel.hpp"
using namespace irr;
using namespace gui;
using namespace core;
-extern IrrlichtDevice* d;
+extern IrrlichtDevice* device;
void load_physfuncs(lua_State* L){
- printf("Called load physfuncs...");
+ lua_newtable(L);//{}
+ lua_setglobal(L,"phys");//
+ //phys things
+ cbphysbox_register(L);
+
+ bphysmodel_register(L,device);
}
diff --git a/src/client/lua_api/load_scene.cpp b/src/client/lua_api/load_scene.cpp
index 342bc9a..c605581 100644
--- a/src/client/lua_api/load_scene.cpp
+++ b/src/client/lua_api/load_scene.cpp
@@ -11,8 +11,6 @@ extern "C" {
#include "scene/icamera.hpp"
#include "scene/imesh.hpp"
#include "scene/ilight.hpp"
-#include "phys/cbphysbox.hpp"
-#include "phys/bphysmodel.hpp"
using namespace irr;
@@ -27,12 +25,6 @@ void load_scenefuncs(lua_State* L){
imesh_register(L);
ilight_register(L);
- lua_newtable(L);//{}
- lua_setglobal(L,"phys");//
- //phys things
- cbphysbox_register(L);
-
- bphysmodel_register(L,device);
//lua_pop(L, 1);
}
diff --git a/src/client/lua_api/load_video.cpp b/src/client/lua_api/load_video.cpp
index 746489a..df3a9aa 100644
--- a/src/client/lua_api/load_video.cpp
+++ b/src/client/lua_api/load_video.cpp
@@ -22,9 +22,9 @@ extern IVideoDriver* driver;
//{texture},{x,y},{sourcerect},,{color},use_alpha
int draw2dimage(lua_State* L){
int nargs = lua_gettop(L);
- printf("Drawing a 2d image\n");
+ //printf("Drawing a 2d image\n");
if(nargs == 2){
- printf("2-argument version\n");
+ //printf("2-argument version\n");
long x,y;
popvector2i(L,&x,&y);
lua_getfield(L,-1,"texture");
@@ -32,10 +32,10 @@ int draw2dimage(lua_State* L){
lua_pop(L,2);
driver->draw2DImage(tex,position2d<s32>(x,y));
}else if(nargs == 5){
- printf("5-argument version\n");
+ //printf("5-argument version\n");
int usealpha = lua_toboolean(L,-1);
lua_pop(L,1);
- printf("Got usealpha: %d\n",usealpha);
+ //printf("Got usealpha: %d\n",usealpha);
long r,g,b,a;
popvector4i(L,&r,&g,&b,&a);
long ssx,ssy,sex,sey;
@@ -54,7 +54,7 @@ int draw2dimage(lua_State* L){
tex,
position2d<s32>(x,y),
rect<s32>(ssx,ssy,sex,sey),
- &clipedto,
+ NULL,
SColor(a,r,g,b),
usealpha == 1
);
@@ -66,7 +66,7 @@ int draw2dimage(lua_State* L){
}
void load_videofuncs(lua_State* L){
- printf("Loading video libraries...\n");
+ //printf("Loading video libraries...\n");
lua_newtable(L);//{}
lua_setglobal(L,"video");//
diff --git a/src/client/lua_api/phys/bphysbuffer.cpp b/src/client/lua_api/phys/bphysbuffer.cpp
index 367aa37..aa2833a 100644
--- a/src/client/lua_api/phys/bphysbuffer.cpp
+++ b/src/client/lua_api/phys/bphysbuffer.cpp
@@ -280,7 +280,7 @@ int bphysmodel_register(lua_State* L, IrrlichtDevice* d){
device = d;
- printf("bphysmodel registered\n");
+ //printf("bphysmodel registered\n");
luaL_newmetatable(L, "phys.physmodel");
diff --git a/src/client/lua_api/phys/bphysmodel.cpp b/src/client/lua_api/phys/bphysmodel.cpp
index 424fdf8..95458b1 100644
--- a/src/client/lua_api/phys/bphysmodel.cpp
+++ b/src/client/lua_api/phys/bphysmodel.cpp
@@ -294,7 +294,7 @@ int bphysmodel_register(lua_State* L, IrrlichtDevice* d){
device = d;
- printf("bphysmodel registered\n");
+ //printf("bphysmodel registered\n");
luaL_newmetatable(L, "phys.physmodel");
diff --git a/src/client/lua_api/phys/cbphysbox.cpp b/src/client/lua_api/phys/cbphysbox.cpp
index 3e72672..6a3d64e 100644
--- a/src/client/lua_api/phys/cbphysbox.cpp
+++ b/src/client/lua_api/phys/cbphysbox.cpp
@@ -180,8 +180,8 @@ void cbphysbox_register(lua_State* L){
lua_pop(L,1);
- printf("When registering physbox, new() is %p\n",newcbphysbox);
- printf("setpos is %p\n",cbphyssetpos);
+ //printf("When registering physbox, new() is %p\n",newcbphysbox);
+ //printf("setpos is %p\n",cbphyssetpos);
lua_pop(L,1);
diff --git a/src/client/lua_api/scene/icamera.cpp b/src/client/lua_api/scene/icamera.cpp
index ec9469d..dcdec2d 100644
--- a/src/client/lua_api/scene/icamera.cpp
+++ b/src/client/lua_api/scene/icamera.cpp
@@ -174,6 +174,5 @@ void icamera_register(lua_State* L){
lua_setfield(L,-2,"newfpscamera");//{}
lua_pushcfunction(L,newiscenemayacamera);//{},newiscenemayacamera()
lua_setfield(L,-2,"newmayacamera");//{}
- printf("\"scene\" was set!\n");
lua_pop(L,1);//
}
diff --git a/src/client/lua_api/scene/icube.cpp b/src/client/lua_api/scene/icube.cpp
index d18db2a..8f4c9d8 100644
--- a/src/client/lua_api/scene/icube.cpp
+++ b/src/client/lua_api/scene/icube.cpp
@@ -63,6 +63,6 @@ void icube_register(lua_State* L){
lua_setfield(L,-2,"newfpscamera");//{}
lua_pushcfunction(L,newiscenemayacamera);//{},newiscenemayacamera()
lua_setfield(L,-2,"newmayacamera");//{}
- printf("\"scene\" was set!\n");
+ //printf("\"scene\" was set!\n");
//lua_pop(L,1);
}
diff --git a/src/client/lua_api/video/iimage.cpp b/src/client/lua_api/video/iimage.cpp
index 586085e..3090057 100644
--- a/src/client/lua_api/video/iimage.cpp
+++ b/src/client/lua_api/video/iimage.cpp
@@ -12,25 +12,25 @@ extern IVideoDriver* driver;
//newiimage(ECOLOR_FORMAT,{width,height}) -> {image}
int newiimage(lua_State* L){
- printf("Attempting to create new iimage\n");
+ //printf("Attempting to create new iimage\n");
long w,h;
popvector2i(L,&w,&h);
int format = lua_tonumber(L,-1);
lua_pop(L,1);
- printf("All data collected, creating...\n");
+ //printf("All data collected, creating...\n");
IImage* img = driver->createImage((irr::video::ECOLOR_FORMAT)format,irr::core::dimension2d<u32>(w,h));
lua_newtable(L);
lua_pushlightuserdata(L,img);
lua_setfield(L,-2,"image");
luaL_getmetatable(L,"iimage");
lua_setmetatable(L,-2);
- printf("Everything sets up, returning\n");
+ //printf("Everything sets up, returning\n");
return 1;
}
//newiimagefromfile("/path/to/file") -> {image}
int newiimagefromfile(lua_State* L){
- printf("Creating new iimage from file");
+ //printf("Creating new iimage from file");
const char* strpath = lua_tostring(L,-1);
lua_pop(L,1);
int numloaders = driver->getImageLoaderCount();
@@ -59,7 +59,7 @@ int newiimagefromfile(lua_State* L){
lua_setfield(L,-2,"image");
luaL_getmetatable(L,"iimage");
lua_setmetatable(L,-2);
- printf("IImage made, returning!");
+ //printf("IImage made, returning!");
return 1;
}
diff --git a/src/client/lua_api/video/itexture.cpp b/src/client/lua_api/video/itexture.cpp
index 599a448..42de1bd 100644
--- a/src/client/lua_api/video/itexture.cpp
+++ b/src/client/lua_api/video/itexture.cpp
@@ -16,14 +16,14 @@ extern IrrlichtDevice* device;
extern IVideoDriver* driver;
//newtexture(string name,{image}) -> {texture}
int newitexture(lua_State* L){
- printf("About to create new texture\n");
+ //printf("About to create new texture\n");
lua_getfield(L,-1,"image");//"name",{image},image*
IImage* im = (IImage*) lua_touserdata(L,-1);
lua_pop(L,2);//"name"
const char* name = lua_tostring(L,-1);
lua_pop(L,1);//
- printf("About to create texture\n");
+ //printf("About to create texture\n");
ITexture* tex = driver->addTexture(name,im);
if(!tex){
lua_pushstring(L,"Failed to create texture!");
diff --git a/src/client/main.cpp b/src/client/main.cpp
index 949cd6b..9c22567 100644
--- a/src/client/main.cpp
+++ b/src/client/main.cpp
@@ -5,6 +5,7 @@ extern "C" {
#include <lauxlib.h>
#include <lualib.h>
}
+#define _IRR_STATIC_LIB_
#include <irrlicht.h>
#include <chrono>
@@ -109,7 +110,7 @@ int setbackgroundcolor(lua_State* L){
}
int main(int argc, char *argv[]){
- printf("Brok[en]gine Client");
+ printf("Brok[en]gine Client\n");
// Initialize bullet
phys_genesis();
@@ -120,11 +121,14 @@ int main(int argc, char *argv[]){
loadLLibs(state);
//Defined in initdevice.cpp, creates the irrlicht device
device = spawnIrrDevice(state);
+ ILogger* log = device->getLogger();
+ log->setLogLevel(ELL_NONE);
if (!device)
return 1;
//Loads libraries for interfaceing with irrlicht
loadIrrLibs(state,device);
loadNetLibs(state);
+ luaL_openlibs(state);
printf("Loadded irr libs...\n");
//Sets the global event handeler
GlobalEventReceiver ger = GlobalEventReceiver(device);
@@ -144,7 +148,7 @@ int main(int argc, char *argv[]){
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
- device->setWindowCaption(L"Brok[en]gine Client");
+ device->setWindowCaption(L"Brok[en]gine Client v0.1\n");
printf("Everything registered, about to start running device!\n");