remove Runtime c++ class

This commit is contained in:
Josh Holtrop 2014-07-18 20:28:40 -04:00
parent 447e4279e7
commit 2f2cec509e
4 changed files with 8 additions and 70 deletions

View File

@ -1,5 +1,4 @@
#include "FontManager.h"
#include "Runtime.h"
#include <iostream>
namespace jes
@ -26,6 +25,9 @@ namespace jes
FontRef FontManager::load_font(const char * fname, size_t size)
{
/* TODO */
return NULL;
#if 0
PathRef font_path = Runtime::locate(Runtime::FONT, fname);
if (font_path == NULL)
return NULL;
@ -35,5 +37,6 @@ namespace jes
return NULL;
return font;
#endif
}
}

View File

@ -1,7 +1,6 @@
#include "GUI.h"
#include "gl3w.h"
#include <iostream>
#include "Runtime.h"
#define WIDTH 500
#define HEIGHT 500
@ -80,7 +79,11 @@ namespace jes
for (int j = 0; j < 2; j++)
{
/* TODO */
shader_paths[j] = NULL;
#if 0
shader_paths[j] = Runtime::locate(Runtime::SHADER, shader_sources[i][j]);
#endif
if (shader_paths[j] == NULL)
{
std::cerr << "Could not find shader source " << shader_sources[i][j] << std::endl;

View File

@ -1,46 +0,0 @@
#include "Runtime.h"
namespace jes
{
static const char * const runtime_directories[Runtime::COUNT] = {
"fonts",
"shaders",
};
PathRef Runtime::locate(int type, const std::string & name)
{
PathRef path = Core::instance.get_bin_path()->dirname()->dirname()->join("runtime")->join(runtime_directories[type]);
PathRef rv = NULL;
switch (type)
{
case Runtime::SHADER:
rv = path->join(name);
break;
case Runtime::FONT:
{
static const char * extensions[] = {
"ttf",
};
std::vector<std::string> dirents = path->dir_entries();
for (auto de : dirents)
{
PathRef test_path = path->join(de)->join(name);
if (test_path->exists())
return test_path;
for (auto ext : extensions)
{
test_path = test_path->ext(ext);
if (test_path->exists())
return test_path;
}
}
}
break;
}
if ((rv != NULL) && (rv->exists()))
return rv;
return NULL;
}
}

View File

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