add jes.h, Core, and Runtime

This commit is contained in:
Josh Holtrop 2014-06-18 19:53:23 -04:00
parent c19ea4e1b0
commit 83553e78f1
7 changed files with 88 additions and 1 deletions

View File

@ -25,7 +25,8 @@ task :gui => :library do
base_env.clone(clone: :all) do |env|
env.parse_flags!("!sdl2-config --cflags --libs")
env.parse_flags!("!freetype-config --cflags --libs")
env["LIBS"] += ["dl"]
env["LIBPATH"] += ["lib"]
env["LIBS"] += ["dl", "jes"]
if RUBY_PLATFORM =~ /mingw/
env["LIBS"] += ["opengl32"]
else

View File

@ -1,6 +1,8 @@
#include <iostream>
#include "GUI.h"
#include "jes.h"
using namespace std;
int main(int argc, char *argv[])

15
src/lib/include/jes.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef JES_H
#define JES_H
#include "jes/Core.h"
#include "jes/Ref.h"
namespace jes
{
void JES_Init(const std::string & bin_path)
{
Core::instance.init(bin_path);
}
}
#endif

View File

@ -0,0 +1,23 @@
#ifndef JES_CORE_H
#define JES_CORE_H
#include "jes/Ref.h"
#include <string>
namespace jes
{
typedef Ref<std::string> StringRef;
class Core
{
public:
static Core instance;
void init(const std::string & bin_path);
protected:
std::string m_bin_path;
};
}
#endif

View File

@ -0,0 +1,21 @@
#ifndef JES_RUNTIME_H
#define JES_RUNTIME_H
#include "jes/Core.h"
namespace jes
{
class Runtime
{
public:
enum
{
FONT,
SHADER,
COUNT,
};
static StringRef locate(int type, const std::string & name);
};
}
#endif

11
src/lib/src/Core.cc Normal file
View File

@ -0,0 +1,11 @@
#include "jes/Core.h"
namespace jes
{
Core Core::instance;
void Core::init(const std::string & bin_path)
{
m_bin_path = bin_path;
}
}

14
src/lib/src/Runtime.cc Normal file
View File

@ -0,0 +1,14 @@
#include "jes/Runtime.h"
namespace jes
{
static const char * const runtime_directories[Runtime::COUNT] = {
"fonts",
"shaders",
};
StringRef Runtime::locate(int type, const std::string & name)
{
return NULL;
}
}