move code into a module structure

This commit is contained in:
Hartmut Seichter 2018-04-01 15:45:12 +02:00
parent 6461a56e17
commit 32aac45162
10 changed files with 64 additions and 30 deletions

View file

@ -0,0 +1,51 @@
#ifndef PW_SCRIPT_HPP
#define PW_SCRIPT_HPP
#include <lua.hpp>
#include <memory>
#include <pw/core/scripting.hpp>
namespace pw {
class script;
class main_loop {
script &_s;
bool _stop = false;
main_loop(script& s);
};
class script {
protected:
scripting::state _lua;
public:
script();
~script();
bool update();
bool load(const std::string &s);
int run(const std::string& s);
void load(sol::table &ns);
friend class main_loop;
};
}
#endif

View file

@ -0,0 +1,13 @@
#ifndef PW_SCRIPTING_HPP
#define PW_SCRIPTING_HPP
#include "sol.hpp"
namespace pw {
// include external namespace of sol
namespace scripting = sol;
}
#endif

View file

@ -27,7 +27,6 @@ public:
window(); window();
~window(); ~window();
bool update(); bool update();
void set_title(const char* t); void set_title(const char* t);

View file

@ -1,29 +0,0 @@
#ifndef PW_SCRIPT_HPP
#define PW_SCRIPT_HPP
#include <lua.hpp>
#include <memory>
#include <sol.hpp>
namespace pw {
class script {
sol::state _lua;
public:
script();
~script();
bool update();
void run(const char* s);
};
}
#endif