diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2018-06-22 12:38:38 -0600 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2018-06-22 12:38:38 -0600 |
| commit | 9fa5dcc9310a8c6ff8c77a47a86303f7b950dcf3 (patch) | |
| tree | d7956fc8aabef903f354578d69d4d7fdf64ec928 /src | |
| parent | 06d3e8182d018ca613f177f6ff7a3bbb6494cc79 (diff) | |
| download | brokengine-9fa5dcc9310a8c6ff8c77a47a86303f7b950dcf3.tar.gz brokengine-9fa5dcc9310a8c6ff8c77a47a86303f7b950dcf3.tar.bz2 brokengine-9fa5dcc9310a8c6ff8c77a47a86303f7b950dcf3.zip | |
Updated core
Updated all core files to prepare for tech demo
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/callbackhandeler.cpp | 8 | ||||
| -rw-r--r-- | src/client/initdevice.cpp | 4 | ||||
| -rw-r--r-- | src/client/lua_api/gui/iguielement.cpp | 6 | ||||
| -rw-r--r-- | src/client/lua_api/gui/iguiimage.cpp | 12 | ||||
| -rw-r--r-- | src/client/lua_api/load_gui.cpp | 4 | ||||
| -rw-r--r-- | src/client/lua_api/load_phys.cpp | 11 | ||||
| -rw-r--r-- | src/client/lua_api/load_scene.cpp | 8 | ||||
| -rw-r--r-- | src/client/lua_api/load_video.cpp | 12 | ||||
| -rw-r--r-- | src/client/lua_api/phys/bphysbuffer.cpp | 2 | ||||
| -rw-r--r-- | src/client/lua_api/phys/bphysmodel.cpp | 2 | ||||
| -rw-r--r-- | src/client/lua_api/phys/cbphysbox.cpp | 4 | ||||
| -rw-r--r-- | src/client/lua_api/scene/icamera.cpp | 1 | ||||
| -rw-r--r-- | src/client/lua_api/scene/icube.cpp | 2 | ||||
| -rw-r--r-- | src/client/lua_api/video/iimage.cpp | 10 | ||||
| -rw-r--r-- | src/client/lua_api/video/itexture.cpp | 4 | ||||
| -rw-r--r-- | src/client/main.cpp | 8 | ||||
| -rw-r--r-- | src/shared/lua_api/phys/bphysbox.cpp | 22 | ||||
| -rw-r--r-- | src/shared/phys/physcommon.cpp | 12 |
18 files changed, 67 insertions, 65 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"); diff --git a/src/shared/lua_api/phys/bphysbox.cpp b/src/shared/lua_api/phys/bphysbox.cpp index 78f1c45..0fe9f72 100644 --- a/src/shared/lua_api/phys/bphysbox.cpp +++ b/src/shared/lua_api/phys/bphysbox.cpp @@ -34,14 +34,14 @@ void makenewbphysbox(lua_State* L){ mass = lua_tonumber(L,-1);//{v3_size},{v3_origin},mass lua_pop(L,1);//{v3_size},{v3_origin} - printf("Got mass: %f\n",mass); + //printf("Got mass: %f\n",mass); popvector3d(L,&px,&py,&pz);//{v3_size} - printf("Got position: (%f,%f,%f)\n",px,py,pz); + //printf("Got position: (%f,%f,%f)\n",px,py,pz); popvector3d(L,&sx,&sy,&sz);// btVector3 vshape = btVector3(sx * 0.5f, sy * 0.5f, sz * 0.5f); - printf("Got size: (%f,%f,%f)\n",sx,sy,sz); + //printf("Got size: (%f,%f,%f)\n",sx,sy,sz); btVector3 pos = btVector3(px,py,pz); // Set the initial position of the object @@ -52,12 +52,12 @@ void makenewbphysbox(lua_State* L){ // Give it a default MotionState btDefaultMotionState* motionstate = new btDefaultMotionState(transform); if(!motionstate){ - printf("No motionstate\n"); + //printf("No motionstate\n"); } // Create the shape btCollisionShape* shape = new btBoxShape(vshape); if(!shape){ - printf("no shape\n"); + //printf("no shape\n"); } // Add mass @@ -67,12 +67,12 @@ void makenewbphysbox(lua_State* L){ // Create the rigid body object btRigidBody* rigidbody = new btRigidBody(mass, motionstate, shape, localinertia); if(!rigidbody){ - printf("No rigidbody\n"); + //printf("No rigidbody\n"); } // Add it to the world World->addRigidBody(rigidbody); - printf("Added rigid body to world: %p\n",World); + //printf("Added rigid body to world: %p\n",World); Objects.push_back(rigidbody); lua_pushlightuserdata(L,rigidbody);//ud_rigidbody @@ -80,7 +80,7 @@ void makenewbphysbox(lua_State* L){ // phys.newphysbox(vector3 size, vector3 origin, double mass) int newbphysbox(lua_State* L){ - printf("Createing bphysbox!\n"); + //printf("Createing bphysbox!\n"); //Create it's lua representation makenewbphysbox(L);//ud_btRigidBody btRigidBody* r = (btRigidBody*)lua_touserdata(L,-1); @@ -98,7 +98,7 @@ int newbphysbox(lua_State* L){ //{phys.physbox}:delete() static int delbphysbox(lua_State* L){//self - printf("Attempting to delete physbox\n"); + //printf("Attempting to delete physbox\n"); lua_getfield(L,-1,"rigidbody");//self,ud_rigidbody btRigidBody* r = (btRigidBody*)lua_touserdata(L,-1);//self,ud_rigidbody delete r->getCollisionShape(); @@ -130,7 +130,7 @@ static int bphyssetpos(lua_State *L){//self,{v3 pos} // {v3 pos} :: physbox:getpos() static int bphysgetpos(lua_State *L){//self - printf("Physics box set pos called\n"); + //printf("Physics box set pos called\n"); lua_getfield(L,-1,"rigidbody");//self,ud_rigidbody btRigidBody* i = (btRigidBody*)lua_touserdata(L,-1);//self,ud_rigidbody btTransform bt = i->getWorldTransform(); @@ -149,7 +149,7 @@ static const luaL_reg bphysbox_m[] = { }; void bphysbox_register(lua_State* L){// - printf("Registered bphysbox\n"); + //printf("Registered bphysbox\n"); luaL_newmetatable(L, "phys.physbox");//{phys.physbox} lua_newtable(L);//{phys.physbox},{} diff --git a/src/shared/phys/physcommon.cpp b/src/shared/phys/physcommon.cpp index 4f506bb..b1c4c67 100644 --- a/src/shared/phys/physcommon.cpp +++ b/src/shared/phys/physcommon.cpp @@ -33,17 +33,17 @@ btSequentialImpulseConstraintSolver* Solver; void phys_genesis(){ BroadPhase = new btAxisSweep3(btVector3(-1000,-1000,-1000),btVector3(1000,1000,1000)); - printf("Broadphase\n"); + //printf("Broadphase\n"); CollisionConfiguration = new btDefaultCollisionConfiguration(); - printf("Collision config\n"); + //printf("Collision config\n"); Dispatcher = new btCollisionDispatcher(CollisionConfiguration); - printf("Dispatcher\n"); + //printf("Dispatcher\n"); Solver = new btSequentialImpulseConstraintSolver(); - printf("Solver\n"); + //printf("Solver\n"); World = new btDiscreteDynamicsWorld(Dispatcher, BroadPhase, Solver, CollisionConfiguration); - printf("Physics world init ok.\n"); + //printf("Physics world init ok.\n"); World->setGravity(btVector3(0,-10,0)); - printf("Created physics world: %p\n",World); + //printf("Created physics world: %p\n",World); } void phys_shutdown(void(*f)(btRigidBody*)){ |
