Added some resources.
@@ -0,0 +1 @@
|
||||
res/belt_tooth.png res/belt_track.png res/bubble.png res/bush01.png res/bush02.png res/knoll01.png res/knoll02.png res/knoll03.png res/knoll04.png res/love.png res/star.png res/tree01.png res/turret_body.png res/turret_cannon.png res/Vera.ttf res/wheel_major.png res/wheel_minor.png res/wheel_revision.png
|
||||
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 322 B |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
@@ -1,9 +1,12 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <sys/stat.h>
|
||||
|
||||
std::ofstream resources_cpp, resources_h;
|
||||
std::stringstream resources_array;
|
||||
|
||||
void load(std::string file);
|
||||
void write(std::string file, int size, char *data);
|
||||
@@ -44,19 +47,34 @@ int main(int argc, char *argv[])
|
||||
<< "#ifndef LOVE_RESOURCES_H\n"
|
||||
<< "#define LOVE_RESOURCES_H\n\n"
|
||||
<< "namespace love\n"
|
||||
<< "{\n";
|
||||
<< "{\n"
|
||||
<< "\tstruct Resource\n"
|
||||
<< "\t{\n"
|
||||
<< "\t\tconst char * name;\n"
|
||||
<< "\t\tvoid * data;\n"
|
||||
<< "\t\tunsigned int size;\n"
|
||||
<< "\t};\n"
|
||||
<< "\n"
|
||||
<< "\textern const Resource resources[];\n"
|
||||
<< "\n";
|
||||
resources_cpp.open("resources.cpp");
|
||||
resources_cpp
|
||||
<< love_header
|
||||
<< "#include \"resources.h\"\n\n"
|
||||
<< "namespace love\n"
|
||||
<< "{\n";
|
||||
|
||||
resources_array << "\n\tconst Resource resources[] = {\n";
|
||||
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
// use boost::filesystem to list all the files (in v2 maybe)
|
||||
load(argv[i]);
|
||||
}
|
||||
resources_cpp << "};\n";
|
||||
|
||||
resources_array << "\t\t{0,0,0}\n\t};\n\n";
|
||||
|
||||
resources_cpp << resources_array.str();
|
||||
resources_cpp << "} // love\n";
|
||||
resources_cpp.close();
|
||||
resources_h
|
||||
@@ -119,6 +137,11 @@ void write(string file, int size, char *data)
|
||||
}
|
||||
//#endif
|
||||
|
||||
// Lowercase plz.
|
||||
for (unsigned int i=0;i<strlen(var.c_str());i++)
|
||||
if (var[i] >= 0x41 && var[i] <= 0x5A)
|
||||
var[i] = var[i] + 0x20;
|
||||
|
||||
resources_cpp << "\tconst char " << var << "_data[] = {";
|
||||
for (int i = 0; i < size - 1; i++)
|
||||
{
|
||||
@@ -127,10 +150,8 @@ void write(string file, int size, char *data)
|
||||
if (i != 0 && i % 30 == 0)
|
||||
resources_cpp << "\n\t";
|
||||
}
|
||||
sprintf(buffer, "%d};\n", data[size]);
|
||||
|
||||
resources_h << "\t// " << var << "\n";
|
||||
resources_h << "\tconst int " << var << "_size = " << size << ";\n";
|
||||
resources_h << "\textern const char " << var << "_data[];\n\n";
|
||||
sprintf(buffer, "%d};\n\n", data[size]);
|
||||
resources_cpp << buffer;
|
||||
resources_array << "\t\t{\"_" << var << "\", (void*)" << var << "_data, " << size << "},\n";
|
||||
printf(" is haxed\n");
|
||||
}
|
||||
|
||||
@@ -71,8 +71,11 @@ DECLSPEC int luaopen_love(lua_State * L)
|
||||
love::luax_insistglobal(L, "love");
|
||||
|
||||
// Resources.
|
||||
love::luax_newtype(L, "Data", love::DATA_T, new love::MemoryData((void*)love::Vera_ttf_data, love::Vera_ttf_size));
|
||||
lua_setfield(L, -2, "_vera");
|
||||
for(const love::Resource * r = love::resources; r->name != 0; r++)
|
||||
{
|
||||
love::luax_newtype(L, "Data", love::DATA_T, new love::MemoryData((void*)r->data, r->size));
|
||||
lua_setfield(L, -2, r->name);
|
||||
}
|
||||
|
||||
lua_pop(L, 1); // love
|
||||
|
||||
|
||||
@@ -183,6 +183,7 @@ namespace physfs
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
const char * Filesystem::getSaveDirectory()
|
||||
{
|
||||
return save_path_full.c_str();
|
||||
|
||||
@@ -23,9 +23,14 @@
|
||||
|
||||
namespace love
|
||||
{
|
||||
// Vera_ttf
|
||||
const int Vera_ttf_size = 65932;
|
||||
extern const char Vera_ttf_data[];
|
||||
struct Resource
|
||||
{
|
||||
const char * name;
|
||||
void * data;
|
||||
unsigned int size;
|
||||
};
|
||||
|
||||
extern const Resource resources[];
|
||||
|
||||
}
|
||||
|
||||
|
||||