Skip to content

Instantly share code, notes, and snippets.

View Twinklebear's full-sized avatar

Will Usher Twinklebear

View GitHub Profile
#include <thread>
#include <mutex>
#include <condition_variable>
#include "SDL.h"
#include "window.h"
SDL_Texture *img = nullptr;
int x = 0, y = 0;
int xVel = 0, yVel = 0;
#include "SDL.h"
#include "window.h"
SDL_Texture *img = nullptr;
int x = 0, y = 0;
int xVel = 0, yVel = 0;
bool quit = false;
//For syncing the FPS delay across threads
SDL_cond *condVar;
#include <iostream>
#include <luabind/luabind.hpp>
void greet(){
std::cout << "Hello luabind" << std::endl;
}
extern "C" int init(lua_State* L){
using namespace luabind;
open(L);
@Twinklebear
Twinklebear / gist:3267240
Created August 5, 2012 21:43
linker erros
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void * __cdecl boost::python::objects::find_static_type(void *,struct boost::python::type_info,struct boost::python::type_info)" (__imp_?find_static_type@objects@python@boost@@YAPAXPAXUtype_info@23@1@Z) referenced in function "private: virtual void * __thiscall boost::python::objects::value_holder<class Test>::holds(struct boost::python::type_info,bool)" (?holds@?$value_holder@VTest@@@objects@python@boost@@EAEPAXUtype_info@34@_N@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall boost::python::converter::shared_ptr_deleter::shared_ptr_deleter(struct boost::python::converter::shared_ptr_deleter const &)" (__imp_??0shared_ptr_deleter@converter@python@boost@@QAE@ABU0123@@Z) referenced in function "public: __thiscall boost::shared_ptr<void>::shared_ptr<void><void,struct boost::python::converter::shared_ptr_deleter>(void *,struct boost::python::converter::shared_ptr_deleter)" (??$?0XUshar
//This causes a crash
//static function
Window::Texture* LoadTexture(std::string file){
//loads a Texture and returns the class
//Texture is a class that is also usable by lua
}
//Module:
class_<Window>("Window")
.scope[
def("LoadTexture", &Window::Texture)
Json::Value Map::Save(){
Json::Value map;
//Save the map width and height
map["mBox"]["w"] = mBox.w;
map["mBox"]["h"] = mBox.h;
map["image"] = mImage.Save();
//Save the tiles
for (int i = 0; i < mTiles.size(); ++i){
map["tiles"][i] = mTiles.at(i).Save();
}
/*
* Save the box's properties to a Json::Value and return it
* @return Json::Value containing the box's properties
*/
Json::Value Save(){
Json::Value val;
val["x"] = pos.x;
val["y"] = pos.y;
val["w"] = w;
val["h"] = h;
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
#include <stdexcept>
#include <string>
#include <iostream>
void Object::RegisterLua(lua_State *l){
using namespace luabind;
module(l, "Game")[
class_<Object>("Object")
.def("Show", (void(Object::*)(int))&Object::Show)
.def("Show", (void(Object::*)(std::string))&Object::Show)
];
}
1>c:\users\will\documents\programs\lpcgame\src\input.cpp(286): error C2440: 'type cast' : cannot convert from 'overloaded-function' to 'bool (__thiscall Input::* )(std::string)'
1> None of the functions with this name in scope match the target type
1>c:\users\will\documents\programs\lpcgame\src\input.cpp(286): error C2780: 'luabind::scope luabind::def(const char *,F,const Policies &)' : expects 3 arguments - 2 provided
1> c:\luabind\luabind\function.hpp(47) : see declaration of 'luabind::def'
1>c:\users\will\documents\programs\lpcgame\src\input.cpp(287): error C2440: 'type cast' : cannot convert from 'overloaded-function' to 'bool (__thiscall Input::* )(int)'
1> None of the functions with this name in scope match the target type
1>c:\users\will\documents\programs\lpcgame\src\input.cpp(287): error C2780: 'luabind::scope luabind::def(const char *,F,const Policies &)' : expects 3 arguments - 2 provided
1> c:\luabind\luabind\function.hpp(47) : see declaration of 'luabind::def'