Updated love.font, and added Glyph object in love.graphics.

This commit is contained in:
rude
2009-07-30 21:43:00 +02:00
parent 26625c46cb
commit 477d5a05b8
32 changed files with 862 additions and 248 deletions
+68 -20
View File
@@ -869,6 +869,14 @@
RelativePath="..\..\src\modules\graphics\opengl\GLee.h" RelativePath="..\..\src\modules\graphics\opengl\GLee.h"
> >
</File> </File>
<File
RelativePath="..\..\src\modules\graphics\opengl\Glyph.cpp"
>
</File>
<File
RelativePath="..\..\src\modules\graphics\opengl\Glyph.h"
>
</File>
<File <File
RelativePath="..\..\src\modules\graphics\opengl\Graphics.cpp" RelativePath="..\..\src\modules\graphics\opengl\Graphics.cpp"
> >
@@ -1021,6 +1029,14 @@
RelativePath="..\..\src\modules\graphics\opengl\wrap_Frame.h" RelativePath="..\..\src\modules\graphics\opengl\wrap_Frame.h"
> >
</File> </File>
<File
RelativePath="..\..\src\modules\graphics\opengl\wrap_Glyph.cpp"
>
</File>
<File
RelativePath="..\..\src\modules\graphics\opengl\wrap_Glyph.h"
>
</File>
<File <File
RelativePath="..\..\src\modules\graphics\opengl\wrap_Graphics.cpp" RelativePath="..\..\src\modules\graphics\opengl\wrap_Graphics.cpp"
> >
@@ -3140,22 +3156,6 @@
<Filter <Filter
Name="font" Name="font"
> >
<File
RelativePath="..\..\src\modules\font\Font.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\font\"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\modules\font\Font.h"
>
</File>
<File <File
RelativePath="..\..\src\modules\font\GlyphData.cpp" RelativePath="..\..\src\modules\font\GlyphData.cpp"
> >
@@ -3205,7 +3205,7 @@
> >
</File> </File>
<File <File
RelativePath="..\..\src\modules\font\wrap_Font.cpp" RelativePath="..\..\src\modules\font\wrap_GlyphData.cpp"
> >
<FileConfiguration <FileConfiguration
Name="Debug|Win32" Name="Debug|Win32"
@@ -3217,14 +3217,30 @@
</FileConfiguration> </FileConfiguration>
</File> </File>
<File <File
RelativePath="..\..\src\modules\font\wrap_Font.h" RelativePath="..\..\src\modules\font\wrap_GlyphData.h"
>
</File>
<File
RelativePath="..\..\src\modules\font\wrap_Rasterizer.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\font\"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\modules\font\wrap_Rasterizer.h"
> >
</File> </File>
<Filter <Filter
Name="freetype" Name="freetype"
> >
<File <File
RelativePath="..\..\src\modules\font\freetype\FreeTypeRasterizer.cpp" RelativePath="..\..\src\modules\font\freetype\Font.cpp"
> >
<FileConfiguration <FileConfiguration
Name="Debug|Win32" Name="Debug|Win32"
@@ -3236,7 +3252,39 @@
</FileConfiguration> </FileConfiguration>
</File> </File>
<File <File
RelativePath="..\..\src\modules\font\freetype\FreeTypeRasterizer.h" RelativePath="..\..\src\modules\font\freetype\Font.h"
>
</File>
<File
RelativePath="..\..\src\modules\font\freetype\TrueTypeRasterizer.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\font\freetype\"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\modules\font\freetype\TrueTypeRasterizer.h"
>
</File>
<File
RelativePath="..\..\src\modules\font\freetype\wrap_Font.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\font\freetype\"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\modules\font\freetype\wrap_Font.h"
> >
</File> </File>
</Filter> </Filter>
+10 -1
View File
@@ -36,10 +36,15 @@ namespace love
LOVE_FILESYSTEM_FILE_ID, LOVE_FILESYSTEM_FILE_ID,
LOVE_FILESYSTEM_FILE_DATA_ID, LOVE_FILESYSTEM_FILE_DATA_ID,
// Font
LOVE_FONT_GLYPH_DATA_ID,
LOVE_FONT_RASTERIZER_ID,
// Graphics // Graphics
LOVE_GRAPHICS_DRAWABLE_ID, LOVE_GRAPHICS_DRAWABLE_ID,
LOVE_GRAPHICS_IMAGE_ID, LOVE_GRAPHICS_IMAGE_ID,
LOVE_GRAPHICS_FRAME_ID, LOVE_GRAPHICS_FRAME_ID,
LOVE_GRAPHICS_GLYPH_ID,
LOVE_GRAPHICS_ANIMATION_ID, LOVE_GRAPHICS_ANIMATION_ID,
LOVE_GRAPHICS_COLOR_ID, LOVE_GRAPHICS_COLOR_ID,
LOVE_GRAPHICS_FONT_ID, LOVE_GRAPHICS_FONT_ID,
@@ -97,10 +102,14 @@ namespace love
const bits LOVE_FILESYSTEM_FILE_BITS = (bits(1) << LOVE_FILESYSTEM_FILE_ID) | LOVE_OBJECT_BITS; const bits LOVE_FILESYSTEM_FILE_BITS = (bits(1) << LOVE_FILESYSTEM_FILE_ID) | LOVE_OBJECT_BITS;
const bits LOVE_FILESYSTEM_FILE_DATA_BITS = (bits(1) << LOVE_FILESYSTEM_FILE_DATA_ID) | LOVE_DATA_BITS; const bits LOVE_FILESYSTEM_FILE_DATA_BITS = (bits(1) << LOVE_FILESYSTEM_FILE_DATA_ID) | LOVE_DATA_BITS;
const bits LOVE_FONT_GLYPH_DATA_BITS = (bits(1) << LOVE_FONT_GLYPH_DATA_ID) | LOVE_DATA_BITS;
const bits LOVE_FONT_RASTERIZER_BITS = (bits(1) << LOVE_FONT_RASTERIZER_ID) | LOVE_OBJECT_BITS;
// Graphics. // Graphics.
const bits LOVE_GRAPHICS_DRAWABLE_BITS = (bits(1) << LOVE_GRAPHICS_DRAWABLE_ID) | LOVE_OBJECT_BITS; const bits LOVE_GRAPHICS_DRAWABLE_BITS = (bits(1) << LOVE_GRAPHICS_DRAWABLE_ID) | LOVE_OBJECT_BITS;
const bits LOVE_GRAPHICS_IMAGE_BITS = (bits(1) << LOVE_GRAPHICS_IMAGE_ID) | LOVE_GRAPHICS_DRAWABLE_BITS; const bits LOVE_GRAPHICS_IMAGE_BITS = (bits(1) << LOVE_GRAPHICS_IMAGE_ID) | LOVE_GRAPHICS_DRAWABLE_BITS;
const bits LOVE_GRAPHICS_FRAME_BITS = (bits(1) << LOVE_GRAPHICS_FRAME_ID); const bits LOVE_GRAPHICS_FRAME_BITS = (bits(1) << LOVE_GRAPHICS_FRAME_ID) | LOVE_OBJECT_BITS;
const bits LOVE_GRAPHICS_GLYPH_BITS = (bits(1) << LOVE_GRAPHICS_GLYPH_ID) | LOVE_GRAPHICS_DRAWABLE_BITS;
const bits LOVE_GRAPHICS_ANIMATION_BITS = (bits(1) << LOVE_GRAPHICS_ANIMATION_ID) | LOVE_GRAPHICS_DRAWABLE_BITS; const bits LOVE_GRAPHICS_ANIMATION_BITS = (bits(1) << LOVE_GRAPHICS_ANIMATION_ID) | LOVE_GRAPHICS_DRAWABLE_BITS;
const bits LOVE_GRAPHICS_COLOR_BITS = (bits(1) << LOVE_GRAPHICS_COLOR_ID) | LOVE_OBJECT_BITS; const bits LOVE_GRAPHICS_COLOR_BITS = (bits(1) << LOVE_GRAPHICS_COLOR_ID) | LOVE_OBJECT_BITS;
const bits LOVE_GRAPHICS_FONT_BITS = (bits(1) << LOVE_GRAPHICS_FONT_ID) | LOVE_OBJECT_BITS; const bits LOVE_GRAPHICS_FONT_BITS = (bits(1) << LOVE_GRAPHICS_FONT_ID) | LOVE_OBJECT_BITS;
+4 -2
View File
@@ -42,6 +42,7 @@
#include <physics/box2d/wrap_Physics.h> #include <physics/box2d/wrap_Physics.h>
#include <sound/wrap_Sound.h> #include <sound/wrap_Sound.h>
#include <timer/sdl/wrap_Timer.h> #include <timer/sdl/wrap_Timer.h>
#include <font/freetype/wrap_Font.h>
// Libraries. // Libraries.
#include "libraries/luasocket/luasocket.h" #include "libraries/luasocket/luasocket.h"
@@ -85,6 +86,7 @@ DECLSPEC int luaopen_love(lua_State * L)
love::luax_preload(L, love::image::wrap_Image_open, "love.image"); love::luax_preload(L, love::image::wrap_Image_open, "love.image");
love::luax_preload(L, love::physics::box2d::wrap_Physics_open, "love.physics"); love::luax_preload(L, love::physics::box2d::wrap_Physics_open, "love.physics");
love::luax_preload(L, love::sound::wrap_Sound_open, "love.sound"); love::luax_preload(L, love::sound::wrap_Sound_open, "love.sound");
love::luax_preload(L, love::font::freetype::wrap_Font_open, "love.font");
love::luasocket::__open(L); love::luasocket::__open(L);
love::lanes::open(L); love::lanes::open(L);
@@ -132,8 +134,8 @@ int main(int argc, char ** argv)
// which gets everything started. // which gets everything started.
// TODO: This is obviously test code. // TODO: This is obviously test code.
luaL_dofile(L, "../../src/scripts/boot.lua"); //luaL_dofile(L, "../../src/scripts/boot.lua");
//# include "scripts/boot.lua.h" # include "scripts/boot.lua.h"
lua_close(L); lua_close(L);
+4 -3
View File
@@ -25,9 +25,10 @@ namespace love
namespace font namespace font
{ {
GlyphData::GlyphData(wchar_t glyph, unsigned char * glyphData, GlyphMetrics glyphMetrics, int glyphBPP) GlyphData::GlyphData(unsigned short glyph, GlyphMetrics glyphMetrics)
: glyph(glyph), data(glyphData), metrics(glyphMetrics), bpp(glyphBPP) : glyph(glyph), metrics(glyphMetrics)
{ {
data = new unsigned char[getWidth() * getHeight() * 2];
} }
GlyphData::~GlyphData() GlyphData::~GlyphData()
@@ -42,7 +43,7 @@ namespace font
int GlyphData::getSize() const int GlyphData::getSize() const
{ {
return getWidth() * getHeight() * bpp; return getWidth() * getHeight() * 2;
} }
int GlyphData::getHeight() const int GlyphData::getHeight() const
+2 -5
View File
@@ -47,7 +47,7 @@ namespace font
{ {
private: private:
// The glyph itself // The glyph itself
wchar_t glyph; unsigned short glyph;
// Glyph metrics // Glyph metrics
GlyphMetrics metrics; GlyphMetrics metrics;
@@ -55,11 +55,8 @@ namespace font
// Glyph texture data // Glyph texture data
unsigned char * data; unsigned char * data;
// Bits Per Pixel
int bpp;
public: public:
GlyphData(wchar_t glyph, unsigned char * glyphData, GlyphMetrics glyphMetrics, int glyphBPP); GlyphData(unsigned short glyph, GlyphMetrics glyphMetrics);
virtual ~GlyphData(); virtual ~GlyphData();
// Implements Data. // Implements Data.
+5 -5
View File
@@ -27,15 +27,15 @@ namespace love
{ {
namespace font namespace font
{ {
ImageRasterizer::ImageRasterizer(love::filesystem::File * file, wchar_t * glyphs) ImageRasterizer::ImageRasterizer(love::image::ImageData * data, unsigned short * glyphs)
: glyphs(glyphs) : imageData(imageData)
{ {
//imageData = new ImageData(file); imageData->retain();
} }
ImageRasterizer::~ImageRasterizer() ImageRasterizer::~ImageRasterizer()
{ {
delete imageData; imageData->release();
} }
int ImageRasterizer::getLineHeight() const int ImageRasterizer::getLineHeight() const
@@ -43,7 +43,7 @@ namespace font
return getHeight(); return getHeight();
} }
GlyphData * ImageRasterizer::getGlyphData(const wchar_t glyph) const GlyphData * ImageRasterizer::getGlyphData(unsigned short glyph) const
{ {
return 0; return 0;
} }
+2 -5
View File
@@ -39,16 +39,13 @@ namespace font
// The image data // The image data
love::image::ImageData * imageData; love::image::ImageData * imageData;
// Glyphs
wchar_t * glyphs;
public: public:
ImageRasterizer(love::filesystem::File * file, wchar_t * glyphs); ImageRasterizer(love::image::ImageData * imageData, unsigned short * glyphs);
virtual ~ImageRasterizer(); virtual ~ImageRasterizer();
// Implement FontData // Implement FontData
virtual int getLineHeight() const; virtual int getLineHeight() const;
virtual GlyphData * getGlyphData(const wchar_t glyph) const; virtual GlyphData * getGlyphData(unsigned short glyph) const;
}; // ImageRasterizer }; // ImageRasterizer
+4
View File
@@ -26,6 +26,10 @@ namespace love
namespace font namespace font
{ {
Rasterizer::~Rasterizer()
{
}
int Rasterizer::getHeight() const int Rasterizer::getHeight() const
{ {
return metrics.height; return metrics.height;
+5 -2
View File
@@ -49,6 +49,9 @@ namespace font
FontMetrics metrics; FontMetrics metrics;
public: public:
virtual ~Rasterizer();
/** /**
* Gets the max height of the glyphs. * Gets the max height of the glyphs.
**/ **/
@@ -78,10 +81,10 @@ namespace font
* Gets a specific glyph. * Gets a specific glyph.
* @param glyph The (UNICODE) glyph to get data for * @param glyph The (UNICODE) glyph to get data for
**/ **/
virtual GlyphData * getGlyphData(const wchar_t glyph) const = 0; virtual GlyphData * getGlyphData(unsigned short glyph) const = 0;
}; // FontData }; // Rasterizer
} // font } // font
} // love } // love
+65
View File
@@ -0,0 +1,65 @@
/**
* Copyright (c) 2006-2009 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#include "Font.h"
#include "TrueTypeRasterizer.h"
#include <font/ImageRasterizer.h>
namespace love
{
namespace font
{
namespace freetype
{
Font::Font()
{
if(FT_Init_FreeType(&library))
throw love::Exception("TrueTypeFont Loading error: FT_Init_FreeType failed\n");
}
Font::~Font()
{
FT_Done_FreeType(library);
}
Rasterizer * Font::newRasterizer(Data * data, int size)
{
return new TrueTypeRasterizer(library, data, size);
}
Rasterizer * Font::newRasterizer(love::image::ImageData * data, unsigned short * glyphs)
{
return new ImageRasterizer(data, glyphs);
}
GlyphData * Font::newGlyphData(Rasterizer * r, unsigned short glyph)
{
return r->getGlyphData(glyph);
}
const char * Font::getName() const
{
return "love.font.freetype";
}
} // freetype
} // font
} // love
+73
View File
@@ -0,0 +1,73 @@
/**
* Copyright (c) 2006-2009 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#ifndef LOVE_FONT_FREETYPE_FONT_H
#define LOVE_FONT_FREETYPE_FONT_H
// LOVE
#include <filesystem/File.h>
#include <font/Rasterizer.h>
#include <image/ImageData.h>
#include <common/Module.h>
// FreeType2
#include <ft2build.h>
#include <freetype/freetype.h>
#include <freetype/ftglyph.h>
#include <freetype/ftoutln.h>
#include <freetype/fttrigon.h>
namespace love
{
namespace font
{
namespace freetype
{
class Font : public Module
{
private:
// FreeType library
FT_Library library;
public:
Font();
/**
* Destructor.
**/
virtual ~Font();
Rasterizer * newRasterizer(Data * data, int size);
Rasterizer * newRasterizer(love::image::ImageData * data, unsigned short * glyphs);
GlyphData * newGlyphData(Rasterizer * r, unsigned short glyph);
// Implement Module
const char * getName() const;
}; // Font
} // freetype
} // font
} // love
#endif // LOVE_FONT_FREETYPE_FONT_H
@@ -19,7 +19,7 @@
**/ **/
// LOVE // LOVE
#include "FreeTypeRasterizer.h" #include "TrueTypeRasterizer.h"
#include <common/Exception.h> #include <common/Exception.h>
@@ -29,20 +29,12 @@ namespace font
{ {
namespace freetype namespace freetype
{ {
inline int next_p2(int num) struct la { unsigned char l,a; };
{
int powered = 2;
while(powered < num) powered <<= 1;
return powered;
}
FreeTypeRasterizer::FreeTypeRasterizer(love::filesystem::File * file, int size) TrueTypeRasterizer::TrueTypeRasterizer(FT_Library library, Data * data, int size)
: data(data)
{ {
// Initialize data->retain();
data = file->read();
if(FT_Init_FreeType(&library))
throw love::Exception("TrueTypeFont Loading error: FT_Init_FreeType failed\n");
if(FT_New_Memory_Face( library, if(FT_New_Memory_Face( library,
(const FT_Byte *)data->getData(), /* first byte in memory */ (const FT_Byte *)data->getData(), /* first byte in memory */
@@ -60,23 +52,20 @@ namespace freetype
metrics.height = face->height; metrics.height = face->height;
} }
FreeTypeRasterizer::~FreeTypeRasterizer() TrueTypeRasterizer::~TrueTypeRasterizer()
{ {
FT_Done_Face(face); FT_Done_Face(face);
FT_Done_FreeType(library);
data->release(); data->release();
} }
int FreeTypeRasterizer::getLineHeight() const int TrueTypeRasterizer::getLineHeight() const
{ {
return (int)(getHeight() * 1.25); return (int)(getHeight() * 1.25);
} }
GlyphData * FreeTypeRasterizer::getGlyphData(const wchar_t glyph) const GlyphData * TrueTypeRasterizer::getGlyphData(unsigned short glyph) const
{ {
unsigned char * textureData;
love::font::GlyphMetrics glyphMetrics; love::font::GlyphMetrics glyphMetrics;
int bpp = 2;
FT_Glyph ftglyph; FT_Glyph ftglyph;
// Initialize // Initialize
@@ -93,23 +82,25 @@ namespace freetype
// Get metrics // Get metrics
glyphMetrics.bearingX = face->glyph->metrics.horiBearingX; glyphMetrics.bearingX = face->glyph->metrics.horiBearingX;
glyphMetrics.bearingY = face->glyph->metrics.horiBearingY; glyphMetrics.bearingY = face->glyph->metrics.horiBearingY;
glyphMetrics.height = face->glyph->metrics.height; glyphMetrics.height = bitmap.rows;
glyphMetrics.width = face->glyph->metrics.width; glyphMetrics.width = bitmap.width;
glyphMetrics.advance = face->glyph->advance.x >> 6; glyphMetrics.advance = face->glyph->advance.x >> 6;
// Get texture GlyphData * glyphData = new GlyphData(glyph, glyphMetrics);
int w = next_p2(bitmap.width);
int h = next_p2(bitmap.rows);
textureData = new unsigned char[bpp * w * h];
for(int j = 0; j < h; j++) for(int i = 0; i < w; i++)
{ {
textureData[bpp * (i + j * w)] = 255; int size = bitmap.rows*bitmap.width;
textureData[bpp * (i + j * w) + 1] = (i >= bitmap.width || j >= bitmap.rows) ? 0 : bitmap.buffer[i + bitmap.width * j]; unsigned char * dst = (unsigned char *)glyphData->getData();
// Note that bitmap.buffer contains only luminocity. We copy that single value to
// our luminocity-alpha format.
for(int i = 0; i<size; i++)
{
dst[2*i] = dst[2*i+1] = bitmap.buffer[i];
}
} }
// Return data // Return data
GlyphData * glyphData = new GlyphData(glyph, textureData, glyphMetrics, bpp);
return glyphData; return glyphData;
} }
@@ -18,14 +18,14 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
**/ **/
#ifndef LOVE_FONT_FREE_TYPE_RASTERIZER_H #ifndef LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H
#define LOVE_FONT_FREE_TYPE_RASTERIZER_H #define LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H
// LOVE // LOVE
#include <filesystem/File.h> #include <filesystem/File.h>
#include <font/Rasterizer.h> #include <font/Rasterizer.h>
// FreeType2 // TrueType2
#include <ft2build.h> #include <ft2build.h>
#include <freetype/freetype.h> #include <freetype/freetype.h>
#include <freetype/ftglyph.h> #include <freetype/ftglyph.h>
@@ -41,26 +41,24 @@ namespace freetype
/** /**
* Holds data for a font object. * Holds data for a font object.
**/ **/
class FreeTypeRasterizer : public Rasterizer class TrueTypeRasterizer : public Rasterizer
{ {
private: private:
// FreeType library
FT_Library library;
// FreeType face
// TrueType face
FT_Face face; FT_Face face;
// File data // File data
Data * data; Data * data;
public: public:
FreeTypeRasterizer(love::filesystem::File * file, int size); TrueTypeRasterizer(FT_Library library, Data * data, int size);
virtual ~FreeTypeRasterizer(); virtual ~TrueTypeRasterizer();
// Implement FontData // Implement Rasterizer
virtual int getLineHeight() const; virtual int getLineHeight() const;
virtual GlyphData * getGlyphData(const wchar_t glyph) const; virtual GlyphData * getGlyphData(unsigned short glyph) const;
}; // FreetypeRasterizer }; // FreetypeRasterizer
@@ -68,4 +66,4 @@ namespace freetype
} // font } // font
} // love } // love
#endif // LOVE_FONT_FREE_TYPE_RASTERIZER_H #endif // LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H
@@ -20,27 +20,49 @@
#include "wrap_Font.h" #include "wrap_Font.h"
#include <font/wrap_GlyphData.h>
#include <font/wrap_Rasterizer.h>
#include "TrueTypeRasterizer.h"
namespace love namespace love
{ {
namespace font namespace font
{
namespace freetype
{ {
static Font * instance = 0; static Font * instance = 0;
int _wrap_test(lua_State * L) int _wrap_newRasterizer(lua_State * L)
{ {
lua_pushinteger(L, 696); Data * d = luax_checkdata(L, 1);
int size = luaL_checkint(L, 2);
Rasterizer * t = instance->newRasterizer(d, size);
luax_newtype(L, "Rasterizer", LOVE_FONT_RASTERIZER_BITS, t);
return 1;
}
int _wrap_newGlyphData(lua_State * L)
{
Rasterizer * r = luax_checkrasterizer(L, 1);
unsigned short g = (unsigned short)luaL_checkint(L, 2);
GlyphData * t = instance->newGlyphData(r, g);
luax_newtype(L, "GlyphData", LOVE_FONT_GLYPH_DATA_BITS, t);
return 1; return 1;
} }
// List of functions to wrap. // List of functions to wrap.
static const luaL_Reg wrap_Font_functions[] = { static const luaL_Reg wrap_Font_functions[] = {
{ "test", _wrap_test }, { "newRasterizer", _wrap_newRasterizer },
{ "newGlyphData", _wrap_newGlyphData },
{ 0, 0 } { 0, 0 }
}; };
static const lua_CFunction wrap_Font_types[] = { static const lua_CFunction wrap_Font_types[] = {
_wrap_test, wrap_GlyphData_open,
wrap_Rasterizer_open,
0 0
}; };
@@ -63,5 +85,6 @@ namespace font
return luax_register_module(L, wrap_Font_functions, wrap_Font_types, "font"); return luax_register_module(L, wrap_Font_functions, wrap_Font_types, "font");
} }
} // freetype
} // sound } // sound
} // love } // love
@@ -18,8 +18,8 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
**/ **/
#ifndef LOVE_FONT_WRAP_FONT_H #ifndef LOVE_FONT_FREETYPE_WRAP_FONT_H
#define LOVE_FONT_WRAP_FONT_H #define LOVE_FONT_FREETYPE_WRAP_FONT_H
// LOVE // LOVE
#include "Font.h" #include "Font.h"
@@ -29,10 +29,14 @@ namespace love
{ {
namespace font namespace font
{ {
int _wrap_test(lua_State * L); namespace freetype
{
int _wrap_newRasterizer(lua_State * L);
int _wrap_newGlyphData(lua_State * L);
int wrap_Font_open(lua_State * L); int wrap_Font_open(lua_State * L);
} // freetype
} // font } // font
} // love } // love
#endif // LOVE_SOUND_WRAP_FONT_H #endif // LOVE_FONT_FREETYPE_WRAP_FONT_H
+48
View File
@@ -0,0 +1,48 @@
/**
* Copyright (c) 2006-2009 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#include "wrap_GlyphData.h"
namespace love
{
namespace font
{
GlyphData * luax_checkglyphdata(lua_State * L, int idx)
{
return luax_checktype<GlyphData>(L, idx, "GlyphData", LOVE_FONT_GLYPH_DATA_BITS);
}
static const luaL_Reg wrap_GlyphData_functions[] = {
// Data
{ "getPointer", _wrap_Data_getPointer },
{ "getSize", _wrap_Data_getSize },
{ 0, 0 }
};
int wrap_GlyphData_open(lua_State * L)
{
luax_register_type(L, "GlyphData", wrap_GlyphData_functions);
return 0;
}
} // sound
} // love
@@ -18,38 +18,23 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
**/ **/
#ifndef LOVE_FONT_FONT_H #ifndef LOVE_FONT_WRAP_GLYPH_DATA_H
#define LOVE_FONT_FONT_H #define LOVE_FONT_WRAP_GLYPH_DATA_H
// LOVE // LOVE
#include <common/Module.h> #include <common/runtime.h>
#include <filesystem/File.h> #include <common/wrap_Data.h>
#include "Rasterizer.h"
#include "GlyphData.h"
namespace love namespace love
{ {
namespace font namespace font
{ {
GlyphData * luax_checkglyphdata(lua_State * L, int idx);
/** int wrap_GlyphData_open(lua_State * L);
* The Font module is responsible for decoding font data. It is
* not responsible for drawing it.
**/
class Font : public Module
{
public:
/**
* Destructor.
**/
virtual ~Font();
// Implement Module
const char * getName() const;
}; // Font
} // font } // font
} // love } // love
#endif // LOVE_FONT_FONT_H #endif // LOVE_FONT_WRAP_GLYPH_DATA_H
+50
View File
@@ -0,0 +1,50 @@
/**
* Copyright (c) 2006-2009 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#include "wrap_Rasterizer.h"
#include <common/wrap_Data.h>
namespace love
{
namespace font
{
Rasterizer * luax_checkrasterizer(lua_State * L, int idx)
{
return luax_checktype<Rasterizer>(L, idx, "Rasterizer", LOVE_FONT_RASTERIZER_BITS);
}
static const luaL_Reg wrap_Rasterizer_functions[] = {
// Data
{ "getPointer", _wrap_Data_getPointer },
{ "getSize", _wrap_Data_getSize },
{ 0, 0 }
};
int wrap_Rasterizer_open(lua_State * L)
{
luax_register_type(L, "Rasterizer", wrap_Rasterizer_functions);
return 0;
}
} // font
} // love
@@ -18,21 +18,21 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
**/ **/
#include "Font.h" #ifndef LOVE_FONT_WRAP_RASTERIZER_H
#define LOVE_FONT_WRAP_RASTERIZER_H
// LOVE
#include <common/runtime.h>
#include "Rasterizer.h"
namespace love namespace love
{ {
namespace font namespace font
{ {
Rasterizer * luax_checkrasterizer(lua_State * L, int idx);
Font::~Font() int wrap_Rasterizer_open(lua_State * L);
{
}
const char * Font::getName() const
{
return "love.font";
}
} // font } // font
} // love } // love
#endif // LOVE_FONT_WRAP_RASTERIZER_H
+129
View File
@@ -0,0 +1,129 @@
/**
* Copyright (c) 2006-2009 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#include "Glyph.h"
// STD
#include <cstring> // For memcpy
namespace love
{
namespace graphics
{
namespace opengl
{
Glyph::Glyph(love::font::GlyphData * data)
: data(data), texture(0), width((float)data->getWidth()), height((float)data->getHeight())
{
data->retain();
memset(vertices, 255, sizeof(vertex)*4);
vertices[0].x = 0; vertices[0].y = 0;
vertices[1].x = 0; vertices[1].y = height;
vertices[2].x = width; vertices[2].y = height;
vertices[3].x = width; vertices[3].y = 0;
vertices[0].s = 0; vertices[0].t = 0;
vertices[1].s = 0; vertices[1].t = 1;
vertices[2].s = 1; vertices[2].t = 1;
vertices[3].s = 1; vertices[3].t = 0;
}
Glyph::~Glyph()
{
if(data != 0)
data->release();
unload();
}
void Glyph::draw(float x, float y, float angle, float sx, float sy, float ox, float oy) const
{
static Matrix t;
t.setTransformation(x, y, angle, sx, sy, ox, oy);
if(texture != 0)
glBindTexture(GL_TEXTURE_2D,texture);
glPushMatrix();
glMultMatrixf((const GLfloat*)t.getElements());
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glVertexPointer(2, GL_FLOAT, sizeof(vertex), (GLvoid*)&vertices[0].x);
glTexCoordPointer(2, GL_FLOAT, sizeof(vertex), (GLvoid*)&vertices[0].s);
glDrawArrays(GL_QUADS, 0, 4);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glPopMatrix();
}
bool Glyph::load()
{
return loadVolatile();
}
void Glyph::unload()
{
unloadVolatile();
}
bool Glyph::loadVolatile()
{
glGenTextures(1,&texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D,
0,
GL_RGBA,
(GLsizei)width,
(GLsizei)height,
0,
GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE,
data->getData());
return true;
}
void Glyph::unloadVolatile()
{
// Delete the hardware texture.
if(texture != 0)
{
glDeleteTextures(1, (GLuint*)&texture);
texture = 0;
}
}
} // opengl
} // graphics
} // love
+75
View File
@@ -0,0 +1,75 @@
/**
* Copyright (c) 2006-2009 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#ifndef LOVE_GRAPHICS_OPENGL_GLYPH_H
#define LOVE_GRAPHICS_OPENGL_GLYPH_H
// LOVE
#include <common/config.h>
#include <common/math.h>
#include <common/Matrix.h>
#include <font/GlyphData.h>
#include <graphics/Drawable.h>
// OpenGL
#include "GLee.h"
#include <SDL/SDL_opengl.h>
namespace love
{
namespace graphics
{
namespace opengl
{
class Glyph : public Drawable
{
private:
love::font::GlyphData * data;
float width, height;
GLuint texture;
vertex vertices[4];
public:
Glyph(love::font::GlyphData * data);
virtual ~Glyph();
bool load();
void unload();
// Implements Volatile.
bool loadVolatile();
void unloadVolatile();
void draw(float x, float y, float angle, float sx, float sy, float ox, float oy) const;
}; // Glyph
} // opengl
} // graphics
} // love
#endif // LOVE_GRAPHICS_OPENGL_GLYPH_H
@@ -0,0 +1,47 @@
/**
* Copyright (c) 2006-2009 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
// LOVE
#include "wrap_Glyph.h"
namespace love
{
namespace graphics
{
namespace opengl
{
Glyph * luax_checkglyph(lua_State * L, int idx)
{
return luax_checktype<Glyph>(L, idx, "Glyph", LOVE_GRAPHICS_GLYPH_BITS);
}
static const luaL_Reg wrap_Glyph_functions[] = {
{ 0, 0 }
};
int wrap_Glyph_open(lua_State * L)
{
luax_register_type(L, "Glyph", wrap_Glyph_functions);
return 0;
}
} // opengl
} // graphics
} // love
+41
View File
@@ -0,0 +1,41 @@
/**
* Copyright (c) 2006-2009 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#ifndef LOVE_GRAPHICS_OPENGL_WRAP_GLYPH_H
#define LOVE_GRAPHICS_OPENGL_WRAP_GLYPH_H
// LOVE
#include <common/runtime.h>
#include "Glyph.h"
namespace love
{
namespace graphics
{
namespace opengl
{
Glyph * luax_checkglyph(lua_State * L, int idx);
int wrap_Glyph_open(lua_State * L);
} // opengl
} // graphics
} // love
#endif // LOVE_GRAPHICS_OPENGL_WRAP_GLYPH_H
+22 -2
View File
@@ -20,6 +20,8 @@
#include "wrap_Graphics.h" #include "wrap_Graphics.h"
#include <font/wrap_GlyphData.h>
namespace love namespace love
{ {
namespace graphics namespace graphics
@@ -154,6 +156,21 @@ namespace opengl
return 1; return 1;
} }
int _wrap_newGlyph(lua_State * L)
{
love::font::GlyphData * data = love::font::luax_checkglyphdata(L, 1);
// Create the image.
Glyph * t = new Glyph(data);
t->load();
// Push the type.
luax_newtype(L, "Glyph", LOVE_GRAPHICS_GLYPH_BITS, (void*)t);
return 1;
}
int _wrap_newFrame(lua_State * L) int _wrap_newFrame(lua_State * L)
{ {
int x = luaL_checkint(L, 1); int x = luaL_checkint(L, 1);
@@ -699,6 +716,7 @@ namespace opengl
{ "present", _wrap_present }, { "present", _wrap_present },
{ "newImage", _wrap_newImage }, { "newImage", _wrap_newImage },
{ "newGlyph", _wrap_newGlyph },
{ "newFrame", _wrap_newFrame }, { "newFrame", _wrap_newFrame },
{ "newFont", _wrap_newFont }, { "newFont", _wrap_newFont },
{ "newImageFont", _wrap_newImageFont }, { "newImageFont", _wrap_newImageFont },
@@ -764,6 +782,7 @@ namespace opengl
{ "pop", _wrap_pop }, { "pop", _wrap_pop },
{ "rotate", _wrap_rotate }, { "rotate", _wrap_rotate },
{ "scale", _wrap_scale }, { "scale", _wrap_scale },
{ "translate", _wrap_translate }, { "translate", _wrap_translate },
{ 0, 0 } { 0, 0 }
@@ -773,6 +792,7 @@ namespace opengl
const lua_CFunction wrap_Graphics_types[] = { const lua_CFunction wrap_Graphics_types[] = {
wrap_Font_open, wrap_Font_open,
wrap_Image_open, wrap_Image_open,
wrap_Glyph_open,
wrap_Frame_open, wrap_Frame_open,
wrap_SpriteBatch_open, wrap_SpriteBatch_open,
0 0
@@ -795,8 +815,8 @@ namespace opengl
luax_register_gc(L, "love.graphics", instance); luax_register_gc(L, "love.graphics", instance);
luax_register_module(L, wrap_Graphics_functions, wrap_Graphics_types, "graphics"); luax_register_module(L, wrap_Graphics_functions, wrap_Graphics_types, "graphics");
//# include <scripts/graphics.lua.h> # include <scripts/graphics.lua.h>
luaL_dofile(L, "../../src/scripts/graphics.lua"); //luaL_dofile(L, "../../src/scripts/graphics.lua");
return 0; return 0;
} }
@@ -24,6 +24,7 @@
// LOVE // LOVE
#include "wrap_Font.h" #include "wrap_Font.h"
#include "wrap_Image.h" #include "wrap_Image.h"
#include "wrap_Glyph.h"
#include "wrap_Frame.h" #include "wrap_Frame.h"
#include "wrap_SpriteBatch.h" #include "wrap_SpriteBatch.h"
#include "Graphics.h" #include "Graphics.h"
@@ -48,6 +49,7 @@ namespace opengl
int _wrap_setScissor(lua_State * L); int _wrap_setScissor(lua_State * L);
int _wrap_getScissor(lua_State * L); int _wrap_getScissor(lua_State * L);
int _wrap_newImage(lua_State * L); int _wrap_newImage(lua_State * L);
int _wrap_newGlyph(lua_State * L);
int _wrap_newFrame(lua_State * L); int _wrap_newFrame(lua_State * L);
int _wrap_newFont(lua_State * L); int _wrap_newFont(lua_State * L);
int _wrap_newImageFont(lua_State * L); int _wrap_newImageFont(lua_State * L);
+1
View File
@@ -24,6 +24,7 @@
// LOVE // LOVE
#include <common/Module.h> #include <common/Module.h>
#include <filesystem/File.h> #include <filesystem/File.h>
#include <font/GlyphData.h>
#include "ImageData.h" #include "ImageData.h"
namespace love namespace love
+2
View File
@@ -20,6 +20,8 @@
#include "Image.h" #include "Image.h"
#include "ImageData.h"
// DevIL // DevIL
#include <IL/il.h> #include <IL/il.h>
-1
View File
@@ -23,7 +23,6 @@
// LOVE // LOVE
#include <image/Image.h> #include <image/Image.h>
#include "ImageData.h"
namespace love namespace love
{ {
+1 -1
View File
@@ -79,7 +79,7 @@ namespace devil
// Bind the image. // Bind the image.
ilBindImage(image); ilBindImage(image);
ilTexImage(width, height, 0, bpp, IL_RGBA, IL_UNSIGNED_BYTE, 0); ilTexImage(width, height, 1, bpp, IL_RGBA, IL_UNSIGNED_BYTE, 0);
} }
ImageData::~ImageData() ImageData::~ImageData()
+1
View File
@@ -135,6 +135,7 @@ function love.init()
physics = true, physics = true,
sound = true, sound = true,
native = true, native = true,
font = true,
}, },
} }
+90 -89
View File
@@ -151,104 +151,105 @@ static const unsigned char B1[]={
44, 13, 10, 9, 9, 9,112,104,121,115,105, 99,115, 32, 61, 32,116,114,117,101, 44, 13, 10, 9, 9, 9,112,104,121,115,105, 99,115, 32, 61, 32,116,114,117,101,
44, 13, 10, 9, 9, 9,115,111,117,110,100, 32, 61, 32,116,114,117,101, 44, 13, 44, 13, 10, 9, 9, 9,115,111,117,110,100, 32, 61, 32,116,114,117,101, 44, 13,
10, 9, 9, 9,110, 97,116,105,118,101, 32, 61, 32,116,114,117,101, 44, 13, 10, 10, 9, 9, 9,110, 97,116,105,118,101, 32, 61, 32,116,114,117,101, 44, 13, 10,
9, 9,125, 44, 13, 10, 9,125, 13, 10, 13, 10, 9, 45, 45, 32, 73,102, 32, 99, 9, 9, 9,102,111,110,116, 32, 61, 32,116,114,117,101, 44, 13, 10, 9, 9,125,
111,110,102,105,103, 32,102,105,108,101, 32,101,120,105,115,116,115, 44, 32,108, 44, 13, 10, 9,125, 13, 10, 13, 10, 9, 45, 45, 32, 73,102, 32, 99,111,110,102,
111, 97,100, 32,105,116, 32, 97,110,100, 32, 97,108,108,111,119, 32,105,116, 32, 105,103, 32,102,105,108,101, 32,101,120,105,115,116,115, 44, 32,108,111, 97,100,
116,111, 32,117,112,100, 97,116,101, 32, 99,111,110,102,105,103, 32,116, 97, 98, 32,105,116, 32, 97,110,100, 32, 97,108,108,111,119, 32,105,116, 32,116,111, 32,
108,101, 46, 13, 10, 9,105,102, 32,108,111,118,101, 46,102,105,108,101,115,121, 117,112,100, 97,116,101, 32, 99,111,110,102,105,103, 32,116, 97, 98,108,101, 46,
115,116,101,109, 46,101,120,105,115,116,115, 40, 34, 99,111,110,102, 46,108,117, 13, 10, 9,105,102, 32,108,111,118,101, 46,102,105,108,101,115,121,115,116,101,
97, 34, 41, 32,116,104,101,110, 13, 10, 9, 9,114,101,113,117,105,114,101, 40, 109, 46,101,120,105,115,116,115, 40, 34, 99,111,110,102, 46,108,117, 97, 34, 41,
34, 99,111,110,102, 46,108,117, 97, 34, 41, 13, 10, 9, 9,108,111,118,101, 46, 32,116,104,101,110, 13, 10, 9, 9,114,101,113,117,105,114,101, 40, 34, 99,111,
99,111,110,102, 40, 99, 41, 13, 10, 9,101,110,100, 13, 10, 9, 13, 10, 9, 45, 110,102, 46,108,117, 97, 34, 41, 13, 10, 9, 9,108,111,118,101, 46, 99,111,110,
45, 32, 71,101,116,115, 32,100,101,115,105,114,101,100, 32,109,111,100,117,108, 102, 40, 99, 41, 13, 10, 9,101,110,100, 13, 10, 9, 13, 10, 9, 45, 45, 32, 71,
101,115, 46, 13, 10, 9,102,111,114, 32,107, 44,118, 32,105,110, 32,112, 97,105, 101,116,115, 32,100,101,115,105,114,101,100, 32,109,111,100,117,108,101,115, 46,
114,115, 40, 99, 46,109,111,100,117,108,101,115, 41, 32,100,111, 13, 10, 9, 9, 13, 10, 9,102,111,114, 32,107, 44,118, 32,105,110, 32,112, 97,105,114,115, 40,
105,102, 32,118, 32,116,104,101,110, 13, 10, 9, 9, 9,114,101,113,117,105,114, 99, 46,109,111,100,117,108,101,115, 41, 32,100,111, 13, 10, 9, 9,105,102, 32,
101, 40, 34,108,111,118,101, 46, 34, 32, 46, 46, 32,107, 41, 13, 10, 9, 9,101, 118, 32,116,104,101,110, 13, 10, 9, 9, 9,114,101,113,117,105,114,101, 40, 34,
110,100, 13, 10, 9,101,110,100, 13, 10, 9, 13, 10, 9, 13, 10, 9, 45, 45, 32, 108,111,118,101, 46, 34, 32, 46, 46, 32,107, 41, 13, 10, 9, 9,101,110,100, 13,
83,101,116,117,112, 32,115, 99,114,101,101,110, 32,104,101,114,101, 46, 13, 10, 10, 9,101,110,100, 13, 10, 9, 13, 10, 9, 13, 10, 9, 45, 45, 32, 83,101,116,
9,105,102, 32, 99, 46,115, 99,114,101,101,110, 32, 97,110,100, 32, 99, 46,109, 117,112, 32,115, 99,114,101,101,110, 32,104,101,114,101, 46, 13, 10, 9,105,102,
111,100,117,108,101,115, 46,103,114, 97,112,104,105, 99,115, 32,116,104,101,110, 32, 99, 46,115, 99,114,101,101,110, 32, 97,110,100, 32, 99, 46,109,111,100,117,
32, 13, 10, 9, 9,105,102, 32,108,111,118,101, 46,103,114, 97,112,104,105, 99, 108,101,115, 46,103,114, 97,112,104,105, 99,115, 32,116,104,101,110, 32, 13, 10,
115, 46, 99,104,101, 99,107, 77,111,100,101, 40, 99, 46,115, 99,114,101,101,110, 9, 9,105,102, 32,108,111,118,101, 46,103,114, 97,112,104,105, 99,115, 46, 99,
46,119,105,100,116,104, 44, 32, 99, 46,115, 99,114,101,101,110, 46,104,101,105, 104,101, 99,107, 77,111,100,101, 40, 99, 46,115, 99,114,101,101,110, 46,119,105,
103,104,116, 44, 32, 99, 46,115, 99,114,101,101,110, 46,102,117,108,108,115, 99, 100,116,104, 44, 32, 99, 46,115, 99,114,101,101,110, 46,104,101,105,103,104,116,
114,101,101,110, 41, 32,116,104,101,110, 13, 10, 9, 9, 9,108,111,118,101, 46, 44, 32, 99, 46,115, 99,114,101,101,110, 46,102,117,108,108,115, 99,114,101,101,
103,114, 97,112,104,105, 99,115, 46,115,101,116, 77,111,100,101, 40, 99, 46,115, 110, 41, 32,116,104,101,110, 13, 10, 9, 9, 9,108,111,118,101, 46,103,114, 97,
99,114,101,101,110, 46,119,105,100,116,104, 44, 32, 99, 46,115, 99,114,101,101, 112,104,105, 99,115, 46,115,101,116, 77,111,100,101, 40, 99, 46,115, 99,114,101,
110, 46,104,101,105,103,104,116, 44, 32, 99, 46,115, 99,114,101,101,110, 46,102, 101,110, 46,119,105,100,116,104, 44, 32, 99, 46,115, 99,114,101,101,110, 46,104,
117,108,108,115, 99,114,101,101,110, 44, 32, 99, 46,115, 99,114,101,101,110, 46, 101,105,103,104,116, 44, 32, 99, 46,115, 99,114,101,101,110, 46,102,117,108,108,
118,115,121,110, 99, 44, 32, 99, 46,115, 99,114,101,101,110, 46,102,115, 97, 97, 115, 99,114,101,101,110, 44, 32, 99, 46,115, 99,114,101,101,110, 46,118,115,121,
41, 13, 10, 9, 9,101,110,100, 13, 10, 9, 9,108,111,118,101, 46,103,114, 97, 110, 99, 44, 32, 99, 46,115, 99,114,101,101,110, 46,102,115, 97, 97, 41, 13, 10,
112,104,105, 99,115, 46,115,101,116, 67, 97,112,116,105,111,110, 40, 99, 46,116, 9, 9,101,110,100, 13, 10, 9, 9,108,111,118,101, 46,103,114, 97,112,104,105,
105,116,108,101, 41, 13, 10, 9,101,110,100, 13, 10, 9, 13, 10, 9,105,102, 32, 99,115, 46,115,101,116, 67, 97,112,116,105,111,110, 40, 99, 46,116,105,116,108,
108,111,118,101, 46,102,105,108,101,115,121,115,116,101,109, 46,101,120,105,115, 101, 41, 13, 10, 9,101,110,100, 13, 10, 9, 13, 10, 9,105,102, 32,108,111,118,
116,115, 40, 34,109, 97,105,110, 46,108,117, 97, 34, 41, 32,116,104,101,110, 32, 101, 46,102,105,108,101,115,121,115,116,101,109, 46,101,120,105,115,116,115, 40,
114,101,113,117,105,114,101, 40, 34,109, 97,105,110, 46,108,117, 97, 34, 41, 32, 34,109, 97,105,110, 46,108,117, 97, 34, 41, 32,116,104,101,110, 32,114,101,113,
101,110,100, 13, 10, 9, 13, 10,101,110,100, 13, 10, 13, 10,102,117,110, 99,116, 117,105,114,101, 40, 34,109, 97,105,110, 46,108,117, 97, 34, 41, 32,101,110,100,
105,111,110, 32,108,111,118,101, 46,114,117,110, 40, 41, 13, 10, 13, 10, 9,105, 13, 10, 9, 13, 10,101,110,100, 13, 10, 13, 10,102,117,110, 99,116,105,111,110,
102, 32,108,111,118,101, 46,108,111, 97,100, 32,116,104,101,110, 32,108,111,118, 32,108,111,118,101, 46,114,117,110, 40, 41, 13, 10, 13, 10, 9,105,102, 32,108,
101, 46,108,111, 97,100, 40, 41, 32,101,110,100, 13, 10, 13, 10, 9, 45, 45, 32, 111,118,101, 46,108,111, 97,100, 32,116,104,101,110, 32,108,111,118,101, 46,108,
77, 97,105,110, 32,108,111,111,112, 32,116,105,109,101, 46, 13, 10, 9,119,104, 111, 97,100, 40, 41, 32,101,110,100, 13, 10, 13, 10, 9, 45, 45, 32, 77, 97,105,
105,108,101, 32,116,114,117,101, 32,100,111, 13, 10, 9, 9,108,111,118,101, 46, 110, 32,108,111,111,112, 32,116,105,109,101, 46, 13, 10, 9,119,104,105,108,101,
116,105,109,101,114, 46,115,116,101,112, 40, 41, 13, 10, 9, 9,105,102, 32,108, 32,116,114,117,101, 32,100,111, 13, 10, 9, 9,108,111,118,101, 46,116,105,109,
111,118,101, 46,117,112,100, 97,116,101, 32,116,104,101,110, 32,108,111,118,101, 101,114, 46,115,116,101,112, 40, 41, 13, 10, 9, 9,105,102, 32,108,111,118,101,
46,117,112,100, 97,116,101, 40,108,111,118,101, 46,116,105,109,101,114, 46,103, 46,117,112,100, 97,116,101, 32,116,104,101,110, 32,108,111,118,101, 46,117,112,
101,116, 68,101,108,116, 97, 40, 41, 41, 32,101,110,100, 13, 10, 9, 9,108,111, 100, 97,116,101, 40,108,111,118,101, 46,116,105,109,101,114, 46,103,101,116, 68,
118,101, 46,103,114, 97,112,104,105, 99,115, 46, 99,108,101, 97,114, 40, 41, 13, 101,108,116, 97, 40, 41, 41, 32,101,110,100, 13, 10, 9, 9,108,111,118,101, 46,
10, 9, 9,105,102, 32,108,111,118,101, 46,100,114, 97,119, 32,116,104,101,110, 103,114, 97,112,104,105, 99,115, 46, 99,108,101, 97,114, 40, 41, 13, 10, 9, 9,
32,108,111,118,101, 46,100,114, 97,119, 40, 41, 32,101,110,100, 13, 10, 13, 10, 105,102, 32,108,111,118,101, 46,100,114, 97,119, 32,116,104,101,110, 32,108,111,
9, 9, 45, 45, 32, 80,114,111, 99,101,115,115, 32,101,118,101,110,116,115, 46, 118,101, 46,100,114, 97,119, 40, 41, 32,101,110,100, 13, 10, 13, 10, 9, 9, 45,
13, 10, 9, 9,102,111,114, 32,101, 44, 97, 44, 98, 44, 99, 32,105,110, 32,108, 45, 32, 80,114,111, 99,101,115,115, 32,101,118,101,110,116,115, 46, 13, 10, 9,
111,118,101, 46,101,118,101,110,116, 46,112,111,108,108, 40, 41, 32,100,111, 13, 9,102,111,114, 32,101, 44, 97, 44, 98, 44, 99, 32,105,110, 32,108,111,118,101,
10, 9, 9, 9,105,102, 32,101, 32, 61, 61, 32,108,111,118,101, 46,101,118,101, 46,101,118,101,110,116, 46,112,111,108,108, 40, 41, 32,100,111, 13, 10, 9, 9,
110,116, 95,113,117,105,116, 32,116,104,101,110, 32,114,101,116,117,114,110, 32, 9,105,102, 32,101, 32, 61, 61, 32,108,111,118,101, 46,101,118,101,110,116, 95,
101,110,100, 13, 10, 9, 9, 9,108,111,118,101, 46,104, 97,110,100,108,101,114, 113,117,105,116, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,101,110,100,
115, 91,101, 93, 40, 97, 44, 98, 44, 99, 41, 13, 10, 9, 9,101,110,100, 13, 10, 13, 10, 9, 9, 9,108,111,118,101, 46,104, 97,110,100,108,101,114,115, 91,101,
13, 10, 9, 9, 45, 45,108,111,118,101, 46,116,105,109,101,114, 46,115,108,101, 93, 40, 97, 44, 98, 44, 99, 41, 13, 10, 9, 9,101,110,100, 13, 10, 13, 10, 9,
101,112, 40, 49, 48, 41, 13, 10, 9, 9,108,111,118,101, 46,103,114, 97,112,104, 9, 45, 45,108,111,118,101, 46,116,105,109,101,114, 46,115,108,101,101,112, 40,
105, 99,115, 46,112,114,101,115,101,110,116, 40, 41, 13, 10, 13, 10, 9,101,110, 49, 48, 41, 13, 10, 9, 9,108,111,118,101, 46,103,114, 97,112,104,105, 99,115,
100, 13, 10, 13, 10,101,110,100, 13, 10, 13, 10, 45, 45, 45, 45, 45, 45, 45, 45, 46,112,114,101,115,101,110,116, 40, 41, 13, 10, 13, 10, 9,101,110,100, 13, 10,
13, 10,101,110,100, 13, 10, 13, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 13, 10, 45, 45, 32, 68,101,102, 97, 45, 45, 45, 45, 45, 45, 45, 45, 13, 10, 45, 45, 32, 68,101,102, 97,117,108,116,
117,108,116, 32,115, 99,114,101,101,110, 46, 13, 10, 45, 45, 45, 45, 45, 45, 45, 32,115, 99,114,101,101,110, 46, 13, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 13, 10, 13, 10,102,117,110, 99, 45, 45, 45, 45, 45, 45, 45, 45, 45, 13, 10, 13, 10,102,117,110, 99,116,105,111,
116,105,111,110, 32,108,111,118,101, 46,100,101,102, 97,117,108,116,115, 99,114, 110, 32,108,111,118,101, 46,100,101,102, 97,117,108,116,115, 99,114,101,101,110,
101,101,110, 40, 41, 13, 10, 13, 10, 9, 45, 45, 32, 77, 97,105,110, 32,108,111, 40, 41, 13, 10, 13, 10, 9, 45, 45, 32, 77, 97,105,110, 32,108,111,111,112, 32,
111,112, 32,103,111,101,115, 32,104,101,114,101, 46, 13, 10, 13, 10,101,110,100, 103,111,101,115, 32,104,101,114,101, 46, 13, 10, 13, 10,101,110,100, 13, 10, 13,
13, 10, 13, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 13, 10, 45, 45, 32, 69,114,114,111,114, 32,115, 99,114,101,101,110,
46, 13, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 13, 10, 13, 10,102,117,110, 99,116,105,111,110, 32,108,111,118,101, 46,
101,114,114,111,114,115, 99,114,101,101,110, 40, 41, 13, 10, 9, 13, 10, 9, 45,
45, 32, 77, 97,105,110, 32,108,111,111,112, 32,103,111,101,115, 32,104,101,114,
101, 46, 13, 10, 13, 10,101,110,100, 13, 10, 13, 10, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 13, 10, 45, 45, 32, 84,104,101,
32,114,111,111,116, 32,111,102, 32, 97,108,108, 32, 99, 97,108,108,115, 46, 13,
10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
13, 10, 13, 10,102,117,110, 99,116,105,111,110, 32,101,114,114,111,114, 95,112, 13, 10, 45, 45, 32, 69,114,114,111,114, 32,115, 99,114,101,101,110, 46, 13, 10,
114,105,110,116,101,114, 40,109,115,103, 41, 13, 10, 9,112,114,105,110,116, 40, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
34, 98,111,111,116, 34, 44, 32,109,115,103, 44, 32,100,101, 98,117,103, 46,116, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
114, 97, 99,101, 98, 97, 99,107, 40, 41, 41, 13, 10,101,110,100, 13, 10, 13, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 13,
10, 13, 10,102,117,110, 99,116,105,111,110, 32,108,111,118,101, 46,101,114,114,
111,114,115, 99,114,101,101,110, 40, 41, 13, 10, 9, 13, 10, 9, 45, 45, 32, 77,
97,105,110, 32,108,111,111,112, 32,103,111,101,115, 32,104,101,114,101, 46, 13,
10, 13, 10,101,110,100, 13, 10, 13, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 13, 10, 45, 45, 32, 84,104,101, 32,114,111,
111,116, 32,111,102, 32, 97,108,108, 32, 99, 97,108,108,115, 46, 13, 10, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 13, 10, 13,
10,102,117,110, 99,116,105,111,110, 32,101,114,114,111,114, 95,112,114,105,110,
116,101,114, 40,109,115,103, 41, 13, 10, 9,112,114,105,110,116, 40, 34, 98,111,
111,116, 34, 44, 32,109,115,103, 44, 32,100,101, 98,117,103, 46,116,114, 97, 99,
101, 98, 97, 99,107, 40, 41, 41, 13, 10,101,110,100, 13, 10, 13, 10,114,101,115,
117,108,116, 32, 61, 32,120,112, 99, 97,108,108, 40,108,111,118,101, 46, 98,111,
111,116, 44, 32,101,114,114,111,114, 95,112,114,105,110,116,101,114, 41, 13, 10,
114,101,115,117,108,116, 32, 61, 32,120,112, 99, 97,108,108, 40,108,111,118,101, 114,101,115,117,108,116, 32, 61, 32,120,112, 99, 97,108,108, 40,108,111,118,101,
46, 98,111,111,116, 44, 32,101,114,114,111,114, 95,112,114,105,110,116,101,114, 46,105,110,105,116, 44, 32,101,114,114,111,114, 95,112,114,105,110,116,101,114,
41, 13, 10,114,101,115,117,108,116, 32, 61, 32,120,112, 99, 97,108,108, 40,108, 41, 13, 10,114,101,115,117,108,116, 32, 61, 32,120,112, 99, 97,108,108, 40,108,
111,118,101, 46,105,110,105,116, 44, 32,101,114,114,111,114, 95,112,114,105,110, 111,118,101, 46,114,117,110, 44, 32,101,114,114,111,114, 95,112,114,105,110,116,
116,101,114, 41, 13, 10,114,101,115,117,108,116, 32, 61, 32,120,112, 99, 97,108, 101,114, 41, 13, 10, 13, 10,112,114,105,110,116, 40, 34, 68,111,110,101, 46, 34,
108, 40,108,111,118,101, 46,114,117,110, 44, 32,101,114,114,111,114, 95,112,114, 41,
105,110,116,101,114, 41, 13, 10, 13, 10,112,114,105,110,116, 40, 34, 68,111,110,
101, 46, 34, 41,
}; };
if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"boot.lua")==0) lua_call(L, 0, 0); if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"boot.lua")==0) lua_call(L, 0, 0);
+1 -3
View File
@@ -70,9 +70,7 @@ static const unsigned char B1[]={
46,112,114,105,110,116,102, 49, 40, 46, 46, 46, 41, 13, 10, 9,108,111,118,101, 46,112,114,105,110,116,102, 49, 40, 46, 46, 46, 41, 13, 10, 9,108,111,118,101,
46,103,114, 97,112,104,105, 99,115, 46,112,114,105,110,116,102, 32, 61, 32,108, 46,103,114, 97,112,104,105, 99,115, 46,112,114,105,110,116,102, 32, 61, 32,108,
111,118,101, 46,103,114, 97,112,104,105, 99,115, 46,112,114,105,110,116,102, 49, 111,118,101, 46,103,114, 97,112,104,105, 99,115, 46,112,114,105,110,116,102, 49,
13, 10,101,110,100, 13, 10, 13, 10,102,117,110, 99,116,105,111,110, 32,108,111, 13, 10,101,110,100, 13, 10, 13, 10,
118,101, 46,103,114, 97,112,104,105, 99,115, 46,102,105,115,116, 40,100, 41, 13,
10, 9,112,114,105,110,116, 40,100, 41, 13, 10,101,110,100,
}; };
if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"graphics.lua")==0) lua_call(L, 0, 0); if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"graphics.lua")==0) lua_call(L, 0, 0);