Browse Source

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

rude 16 years ago
parent
commit
477d5a05b8

+ 60 - 12
platform/msvc2008/love.vcproj

@@ -869,6 +869,14 @@
 						RelativePath="..\..\src\modules\graphics\opengl\GLee.h"
 						>
 					</File>
+					<File
+						RelativePath="..\..\src\modules\graphics\opengl\Glyph.cpp"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\modules\graphics\opengl\Glyph.h"
+						>
+					</File>
 					<File
 						RelativePath="..\..\src\modules\graphics\opengl\Graphics.cpp"
 						>
@@ -1021,6 +1029,14 @@
 						RelativePath="..\..\src\modules\graphics\opengl\wrap_Frame.h"
 						>
 					</File>
+					<File
+						RelativePath="..\..\src\modules\graphics\opengl\wrap_Glyph.cpp"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\modules\graphics\opengl\wrap_Glyph.h"
+						>
+					</File>
 					<File
 						RelativePath="..\..\src\modules\graphics\opengl\wrap_Graphics.cpp"
 						>
@@ -3141,7 +3157,7 @@
 				Name="font"
 				>
 				<File
-					RelativePath="..\..\src\modules\font\Font.cpp"
+					RelativePath="..\..\src\modules\font\GlyphData.cpp"
 					>
 					<FileConfiguration
 						Name="Debug|Win32"
@@ -3153,11 +3169,11 @@
 					</FileConfiguration>
 				</File>
 				<File
-					RelativePath="..\..\src\modules\font\Font.h"
+					RelativePath="..\..\src\modules\font\GlyphData.h"
 					>
 				</File>
 				<File
-					RelativePath="..\..\src\modules\font\GlyphData.cpp"
+					RelativePath="..\..\src\modules\font\ImageRasterizer.cpp"
 					>
 					<FileConfiguration
 						Name="Debug|Win32"
@@ -3169,11 +3185,11 @@
 					</FileConfiguration>
 				</File>
 				<File
-					RelativePath="..\..\src\modules\font\GlyphData.h"
+					RelativePath="..\..\src\modules\font\ImageRasterizer.h"
 					>
 				</File>
 				<File
-					RelativePath="..\..\src\modules\font\ImageRasterizer.cpp"
+					RelativePath="..\..\src\modules\font\Rasterizer.cpp"
 					>
 					<FileConfiguration
 						Name="Debug|Win32"
@@ -3185,11 +3201,11 @@
 					</FileConfiguration>
 				</File>
 				<File
-					RelativePath="..\..\src\modules\font\ImageRasterizer.h"
+					RelativePath="..\..\src\modules\font\Rasterizer.h"
 					>
 				</File>
 				<File
-					RelativePath="..\..\src\modules\font\Rasterizer.cpp"
+					RelativePath="..\..\src\modules\font\wrap_GlyphData.cpp"
 					>
 					<FileConfiguration
 						Name="Debug|Win32"
@@ -3201,11 +3217,11 @@
 					</FileConfiguration>
 				</File>
 				<File
-					RelativePath="..\..\src\modules\font\Rasterizer.h"
+					RelativePath="..\..\src\modules\font\wrap_GlyphData.h"
 					>
 				</File>
 				<File
-					RelativePath="..\..\src\modules\font\wrap_Font.cpp"
+					RelativePath="..\..\src\modules\font\wrap_Rasterizer.cpp"
 					>
 					<FileConfiguration
 						Name="Debug|Win32"
@@ -3217,14 +3233,46 @@
 					</FileConfiguration>
 				</File>
 				<File
-					RelativePath="..\..\src\modules\font\wrap_Font.h"
+					RelativePath="..\..\src\modules\font\wrap_Rasterizer.h"
 					>
 				</File>
 				<Filter
 					Name="freetype"
 					>
 					<File
-						RelativePath="..\..\src\modules\font\freetype\FreeTypeRasterizer.cpp"
+						RelativePath="..\..\src\modules\font\freetype\Font.cpp"
+						>
+						<FileConfiguration
+							Name="Debug|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								ObjectFile="$(IntDir)\font\freetype\"
+							/>
+						</FileConfiguration>
+					</File>
+					<File
+						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"
@@ -3236,7 +3284,7 @@
 						</FileConfiguration>
 					</File>
 					<File
-						RelativePath="..\..\src\modules\font\freetype\FreeTypeRasterizer.h"
+						RelativePath="..\..\src\modules\font\freetype\wrap_Font.h"
 						>
 					</File>
 				</Filter>

+ 10 - 1
src/common/types.h

@@ -36,10 +36,15 @@ namespace love
 		LOVE_FILESYSTEM_FILE_ID,
 		LOVE_FILESYSTEM_FILE_DATA_ID,
 
+		// Font
+		LOVE_FONT_GLYPH_DATA_ID,
+		LOVE_FONT_RASTERIZER_ID,
+
 		// Graphics
 		LOVE_GRAPHICS_DRAWABLE_ID,
 		LOVE_GRAPHICS_IMAGE_ID,
 		LOVE_GRAPHICS_FRAME_ID,
+		LOVE_GRAPHICS_GLYPH_ID,
 		LOVE_GRAPHICS_ANIMATION_ID,
 		LOVE_GRAPHICS_COLOR_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_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.
 	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_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_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;

+ 4 - 2
src/love.cpp

@@ -42,6 +42,7 @@
 #include <physics/box2d/wrap_Physics.h>
 #include <sound/wrap_Sound.h>
 #include <timer/sdl/wrap_Timer.h>
+#include <font/freetype/wrap_Font.h>
 
 // Libraries.
 #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::physics::box2d::wrap_Physics_open, "love.physics");
 	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::lanes::open(L);
@@ -132,8 +134,8 @@ int main(int argc, char ** argv)
 	// which gets everything started.
 
 	// TODO: This is obviously test code.
-	luaL_dofile(L, "../../src/scripts/boot.lua");
-//#	include "scripts/boot.lua.h"
+	//luaL_dofile(L, "../../src/scripts/boot.lua");
+#	include "scripts/boot.lua.h"
 
 	lua_close(L);
 

+ 4 - 3
src/modules/font/GlyphData.cpp

@@ -25,9 +25,10 @@ namespace love
 namespace font
 {
 
-	GlyphData::GlyphData(wchar_t glyph, unsigned char * glyphData, GlyphMetrics glyphMetrics, int glyphBPP)
-		: glyph(glyph), data(glyphData), metrics(glyphMetrics), bpp(glyphBPP)
+	GlyphData::GlyphData(unsigned short glyph, GlyphMetrics glyphMetrics)
+		: glyph(glyph), metrics(glyphMetrics)
 	{
+		data = new unsigned char[getWidth() * getHeight() * 2];
 	}
 
 	GlyphData::~GlyphData()
@@ -42,7 +43,7 @@ namespace font
 
 	int GlyphData::getSize() const
 	{
-		return getWidth() * getHeight() * bpp;
+		return getWidth() * getHeight() * 2;
 	}
 
 	int GlyphData::getHeight() const

+ 2 - 5
src/modules/font/GlyphData.h

@@ -47,19 +47,16 @@ namespace font
 	{
 	private:
 		// The glyph itself
-		wchar_t glyph;
+		unsigned short glyph;
 
 		// Glyph metrics
 		GlyphMetrics metrics;
 
 		// Glyph texture data
 		unsigned char * data;
-
-		// Bits Per Pixel
-		int bpp;
 		
 	public:
-		GlyphData(wchar_t glyph, unsigned char * glyphData, GlyphMetrics glyphMetrics, int glyphBPP);
+		GlyphData(unsigned short glyph, GlyphMetrics glyphMetrics);
 		virtual ~GlyphData();
 
 		// Implements Data.

+ 5 - 5
src/modules/font/ImageRasterizer.cpp

@@ -27,15 +27,15 @@ namespace love
 {
 namespace font
 {
-	ImageRasterizer::ImageRasterizer(love::filesystem::File * file, wchar_t * glyphs)
-		: glyphs(glyphs)
+	ImageRasterizer::ImageRasterizer(love::image::ImageData * data, unsigned short * glyphs)
+		: imageData(imageData)
 	{
-		//imageData = new ImageData(file);
+		imageData->retain();
 	}
 
 	ImageRasterizer::~ImageRasterizer()
 	{
-		delete imageData;
+		imageData->release();
 	}
 
 	int ImageRasterizer::getLineHeight() const
@@ -43,7 +43,7 @@ namespace font
 		return getHeight();
 	}
 
-	GlyphData * ImageRasterizer::getGlyphData(const wchar_t glyph) const
+	GlyphData * ImageRasterizer::getGlyphData(unsigned short glyph) const
 	{
 		return 0;
 	}

+ 3 - 6
src/modules/font/ImageRasterizer.h

@@ -38,17 +38,14 @@ namespace font
 	private:
 		// The image data
 		love::image::ImageData * imageData;
-
-		// Glyphs
-		wchar_t * glyphs;
-		
+	
 	public:
-		ImageRasterizer(love::filesystem::File * file, wchar_t * glyphs);
+		ImageRasterizer(love::image::ImageData * imageData, unsigned short * glyphs);
 		virtual ~ImageRasterizer();
 
 		// Implement FontData
 		virtual int getLineHeight() const;
-		virtual GlyphData * getGlyphData(const wchar_t glyph) const;
+		virtual GlyphData * getGlyphData(unsigned short glyph) const;
 
 	}; // ImageRasterizer
 

+ 4 - 0
src/modules/font/Rasterizer.cpp

@@ -26,6 +26,10 @@ namespace love
 namespace font
 {
 
+	Rasterizer::~Rasterizer()
+	{
+	}
+
 	int Rasterizer::getHeight() const
 	{
 		return metrics.height;

+ 5 - 2
src/modules/font/Rasterizer.h

@@ -49,6 +49,9 @@ namespace font
 		FontMetrics metrics;
 		
 	public:
+
+		virtual ~Rasterizer();
+
 		/**
 		* Gets the max height of the glyphs.
 		**/
@@ -78,10 +81,10 @@ namespace font
 		* Gets a specific glyph.
 		* @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
 } // love

+ 65 - 0
src/modules/font/freetype/Font.cpp

@@ -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 - 0
src/modules/font/freetype/Font.h

@@ -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

+ 21 - 30
src/modules/font/freetype/FreeTypeRasterizer.cpp → src/modules/font/freetype/TrueTypeRasterizer.cpp

@@ -19,7 +19,7 @@
 **/
 
 // LOVE
-#include "FreeTypeRasterizer.h"
+#include "TrueTypeRasterizer.h"
 
 #include <common/Exception.h>
 
@@ -29,20 +29,12 @@ namespace font
 {
 namespace freetype
 {
-	inline int next_p2(int num)
-	{
-		int powered = 2;
-		while(powered < num) powered <<= 1;
-		return powered;
-	}
+	struct la { unsigned char l,a; };
 
-	FreeTypeRasterizer::FreeTypeRasterizer(love::filesystem::File * file, int size)
+	TrueTypeRasterizer::TrueTypeRasterizer(FT_Library library, Data * data, int size)
+		: data(data)
 	{
-		// Initialize
-		data = file->read();
-
-		if(FT_Init_FreeType(&library))
-			throw love::Exception("TrueTypeFont Loading error: FT_Init_FreeType failed\n");
+		data->retain();
 
 		if(FT_New_Memory_Face(	library,
 								(const FT_Byte *)data->getData(),	/* first byte in memory */
@@ -60,23 +52,20 @@ namespace freetype
 		metrics.height = face->height;
 	}
 
-	FreeTypeRasterizer::~FreeTypeRasterizer()
+	TrueTypeRasterizer::~TrueTypeRasterizer()
 	{
 		FT_Done_Face(face);
-		FT_Done_FreeType(library);
 		data->release();
 	}
 
-	int FreeTypeRasterizer::getLineHeight() const
+	int TrueTypeRasterizer::getLineHeight() const
 	{
 		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;
-		int bpp = 2;
 		FT_Glyph ftglyph;
 
 		// Initialize
@@ -85,7 +74,7 @@ namespace freetype
 		
 		if( FT_Get_Glyph(face->glyph, &ftglyph) )
 			throw love::Exception("TrueTypeFont Loading vm->error: FT_Get_Glyph failed\n");
-
+			
 		FT_Glyph_To_Bitmap(&ftglyph, FT_RENDER_MODE_NORMAL, 0, 1);
 		FT_BitmapGlyph bitmap_glyph = (FT_BitmapGlyph)ftglyph;
 		FT_Bitmap& bitmap = bitmap_glyph->bitmap; //just to make things easier
@@ -93,23 +82,25 @@ namespace freetype
 		// Get metrics
 		glyphMetrics.bearingX = face->glyph->metrics.horiBearingX;
 		glyphMetrics.bearingY = face->glyph->metrics.horiBearingY;
-		glyphMetrics.height = face->glyph->metrics.height;
-		glyphMetrics.width = face->glyph->metrics.width;
+		glyphMetrics.height = bitmap.rows;
+		glyphMetrics.width = bitmap.width;
 		glyphMetrics.advance = face->glyph->advance.x >> 6;
 
-		// Get texture
-		int w = next_p2(bitmap.width);
-		int h = next_p2(bitmap.rows);
-		textureData = new unsigned char[bpp * w * h];
+		GlyphData * glyphData = new GlyphData(glyph, glyphMetrics);
 
-		for(int j = 0; j < h; j++) for(int i = 0; i < w; i++)
 		{
-			textureData[bpp * (i + j * w)] = 255;
-			textureData[bpp * (i + j * w) + 1] = (i >= bitmap.width || j >= bitmap.rows) ? 0 : bitmap.buffer[i + bitmap.width * j];
+			int size = bitmap.rows*bitmap.width;
+			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
-		GlyphData * glyphData = new GlyphData(glyph, textureData, glyphMetrics, bpp);
 		return glyphData;
 	}
 

+ 11 - 13
src/modules/font/freetype/FreeTypeRasterizer.h → src/modules/font/freetype/TrueTypeRasterizer.h

@@ -18,14 +18,14 @@
 * 3. This notice may not be removed or altered from any source distribution.
 **/
 
-#ifndef LOVE_FONT_FREE_TYPE_RASTERIZER_H
-#define LOVE_FONT_FREE_TYPE_RASTERIZER_H
+#ifndef LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H
+#define LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H
 
 // LOVE
 #include <filesystem/File.h>
 #include <font/Rasterizer.h>
 
-// FreeType2
+// TrueType2
 #include <ft2build.h>
 #include <freetype/freetype.h>
 #include <freetype/ftglyph.h>
@@ -41,26 +41,24 @@ namespace freetype
 	/**
 	* Holds data for a font object.
 	**/
-	class FreeTypeRasterizer : public Rasterizer
+	class TrueTypeRasterizer : public Rasterizer
 	{
 	private:
-		// FreeType library
-		FT_Library library;
 
-		// FreeType face
+
+		// TrueType face
 		FT_Face face;
 
 		// File data
 		Data * data;
 		
-		
 	public:
-		FreeTypeRasterizer(love::filesystem::File * file, int size);
-		virtual ~FreeTypeRasterizer();
+		TrueTypeRasterizer(FT_Library library, Data * data, int size);
+		virtual ~TrueTypeRasterizer();
 
-		// Implement FontData
+		// Implement Rasterizer
 		virtual int getLineHeight() const;
-		virtual GlyphData * getGlyphData(const wchar_t glyph) const;
+		virtual GlyphData * getGlyphData(unsigned short glyph) const;
 
 	}; // FreetypeRasterizer
 
@@ -68,4 +66,4 @@ namespace freetype
 } // font
 } // love
 
-#endif // LOVE_FONT_FREE_TYPE_RASTERIZER_H
+#endif // LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H

+ 27 - 4
src/modules/font/wrap_Font.cpp → src/modules/font/freetype/wrap_Font.cpp

@@ -20,27 +20,49 @@
 
 #include "wrap_Font.h"
 
+#include <font/wrap_GlyphData.h>
+#include <font/wrap_Rasterizer.h>
+
+#include "TrueTypeRasterizer.h"
+
 namespace love
 {
 namespace font
+{
+namespace freetype
 {
 	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;
 	}
 
 	// List of functions to wrap.
 	static const luaL_Reg wrap_Font_functions[] = {
-		{ "test",  _wrap_test },
+		{ "newRasterizer",  _wrap_newRasterizer },
+		{ "newGlyphData",  _wrap_newGlyphData },
 		{ 0, 0 }
 	};
 
 	static const lua_CFunction wrap_Font_types[] = {
-		_wrap_test,
+		wrap_GlyphData_open,
+		wrap_Rasterizer_open,
 		0
 	};
 
@@ -63,5 +85,6 @@ namespace font
 		return luax_register_module(L, wrap_Font_functions, wrap_Font_types, "font");
 	}
 
+} // freetype
 } // sound
 } // love

+ 8 - 4
src/modules/font/wrap_Font.h → src/modules/font/freetype/wrap_Font.h

@@ -18,8 +18,8 @@
 * 3. This notice may not be removed or altered from any source distribution.
 **/
 
-#ifndef LOVE_FONT_WRAP_FONT_H
-#define LOVE_FONT_WRAP_FONT_H
+#ifndef LOVE_FONT_FREETYPE_WRAP_FONT_H
+#define LOVE_FONT_FREETYPE_WRAP_FONT_H
 
 // LOVE
 #include "Font.h"
@@ -29,10 +29,14 @@ namespace love
 {
 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);
 
+} // freetype
 } // font
 } // love
 
-#endif // LOVE_SOUND_WRAP_FONT_H
+#endif // LOVE_FONT_FREETYPE_WRAP_FONT_H

+ 48 - 0
src/modules/font/wrap_GlyphData.cpp

@@ -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

+ 22 - 37
src/modules/font/Font.h → src/modules/font/wrap_GlyphData.h

@@ -16,40 +16,25 @@
 * 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_FONT_H
-#define LOVE_FONT_FONT_H
-
-// LOVE
-#include <common/Module.h>
-#include <filesystem/File.h>
-#include "Rasterizer.h"
-
-namespace love
-{
-namespace font
-{
-
-	/**
-	* 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
-} // love
-
-#endif // LOVE_FONT_FONT_H
+**/
+
+#ifndef LOVE_FONT_WRAP_GLYPH_DATA_H
+#define LOVE_FONT_WRAP_GLYPH_DATA_H
+
+// LOVE
+#include <common/runtime.h>
+#include <common/wrap_Data.h>
+
+#include "GlyphData.h"
+
+namespace love
+{
+namespace font
+{
+	GlyphData * luax_checkglyphdata(lua_State * L, int idx);
+	int wrap_GlyphData_open(lua_State * L);
+
+} // font
+} // love
+
+#endif // LOVE_FONT_WRAP_GLYPH_DATA_H

+ 50 - 0
src/modules/font/wrap_Rasterizer.cpp

@@ -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

+ 20 - 20
src/modules/font/Font.cpp → src/modules/font/wrap_Rasterizer.h

@@ -16,23 +16,23 @@
 * 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"
-
-namespace love
-{
-namespace font
-{
-
-	Font::~Font()
-	{
-	}
-
-	const char * Font::getName() const
-	{
-		return "love.font";
-	}
-
-} // font
-} // love
+**/
+
+#ifndef LOVE_FONT_WRAP_RASTERIZER_H
+#define LOVE_FONT_WRAP_RASTERIZER_H
+
+// LOVE
+#include <common/runtime.h>
+#include "Rasterizer.h"
+
+namespace love
+{
+namespace font
+{
+	Rasterizer * luax_checkrasterizer(lua_State * L, int idx);
+	int wrap_Rasterizer_open(lua_State * L);
+
+} // font
+} // love
+
+#endif // LOVE_FONT_WRAP_RASTERIZER_H

+ 129 - 0
src/modules/graphics/opengl/Glyph.cpp

@@ -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 - 0
src/modules/graphics/opengl/Glyph.h

@@ -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

+ 47 - 0
src/modules/graphics/opengl/wrap_Glyph.cpp

@@ -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 - 0
src/modules/graphics/opengl/wrap_Glyph.h

@@ -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
src/modules/graphics/opengl/wrap_Graphics.cpp

@@ -20,6 +20,8 @@
 
 #include "wrap_Graphics.h"
 
+#include <font/wrap_GlyphData.h>
+
 namespace love
 {
 namespace graphics
@@ -153,6 +155,21 @@ namespace opengl
 
 		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)
 	{
@@ -699,6 +716,7 @@ namespace opengl
 		{ "present", _wrap_present },
 
 		{ "newImage", _wrap_newImage },
+		{ "newGlyph", _wrap_newGlyph },
 		{ "newFrame", _wrap_newFrame },
 		{ "newFont", _wrap_newFont },
 		{ "newImageFont", _wrap_newImageFont },
@@ -764,6 +782,7 @@ namespace opengl
 		{ "pop", _wrap_pop },
 		{ "rotate", _wrap_rotate },
 		{ "scale", _wrap_scale },
+
 		{ "translate", _wrap_translate },
 
 		{ 0, 0 }
@@ -773,6 +792,7 @@ namespace opengl
 	const lua_CFunction wrap_Graphics_types[] = {
 		wrap_Font_open, 
 		wrap_Image_open, 
+		wrap_Glyph_open,
 		wrap_Frame_open, 
 		wrap_SpriteBatch_open, 
 		0		
@@ -795,8 +815,8 @@ namespace opengl
 		luax_register_gc(L, "love.graphics", instance);
 		luax_register_module(L, wrap_Graphics_functions, wrap_Graphics_types, "graphics");		
 
-//#		include <scripts/graphics.lua.h>
-		luaL_dofile(L, "../../src/scripts/graphics.lua");
+#		include <scripts/graphics.lua.h>
+		//luaL_dofile(L, "../../src/scripts/graphics.lua");
 
 		return 0;
 	}

+ 2 - 0
src/modules/graphics/opengl/wrap_Graphics.h

@@ -24,6 +24,7 @@
 // LOVE
 #include "wrap_Font.h"
 #include "wrap_Image.h"
+#include "wrap_Glyph.h"
 #include "wrap_Frame.h"
 #include "wrap_SpriteBatch.h"
 #include "Graphics.h"
@@ -48,6 +49,7 @@ namespace opengl
 	int _wrap_setScissor(lua_State * L);
 	int _wrap_getScissor(lua_State * L);
 	int _wrap_newImage(lua_State * L);
+	int _wrap_newGlyph(lua_State * L);
 	int _wrap_newFrame(lua_State * L);
 	int _wrap_newFont(lua_State * L);
 	int _wrap_newImageFont(lua_State * L);

+ 1 - 0
src/modules/image/Image.h

@@ -24,6 +24,7 @@
 // LOVE
 #include <common/Module.h>
 #include <filesystem/File.h>
+#include <font/GlyphData.h>
 #include "ImageData.h"
 
 namespace love

+ 2 - 0
src/modules/image/devil/Image.cpp

@@ -20,6 +20,8 @@
 
 #include "Image.h"
 
+#include "ImageData.h"
+
 // DevIL
 #include <IL/il.h>
 

+ 0 - 1
src/modules/image/devil/Image.h

@@ -23,7 +23,6 @@
 
 // LOVE
 #include <image/Image.h>
-#include "ImageData.h"
 
 namespace love
 {

+ 1 - 1
src/modules/image/devil/ImageData.cpp

@@ -79,7 +79,7 @@ namespace devil
 		// Bind the 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()

+ 1 - 0
src/scripts/boot.lua

@@ -135,6 +135,7 @@ function love.init()
 			physics = true,
 			sound = true,
 			native = true,
+			font = true,
 		},
 	}
 

+ 85 - 84
src/scripts/boot.lua.h

@@ -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,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,
-  9,  9,125, 44, 13, 10,  9,125, 13, 10, 13, 10,  9, 45, 45, 32, 73,102, 32, 99,
-111,110,102,105,103, 32,102,105,108,101, 32,101,120,105,115,116,115, 44, 32,108,
-111, 97,100, 32,105,116, 32, 97,110,100, 32, 97,108,108,111,119, 32,105,116, 32,
-116,111, 32,117,112,100, 97,116,101, 32, 99,111,110,102,105,103, 32,116, 97, 98,
-108,101, 46, 13, 10,  9,105,102, 32,108,111,118,101, 46,102,105,108,101,115,121,
-115,116,101,109, 46,101,120,105,115,116,115, 40, 34, 99,111,110,102, 46,108,117,
- 97, 34, 41, 32,116,104,101,110, 13, 10,  9,  9,114,101,113,117,105,114,101, 40,
- 34, 99,111,110,102, 46,108,117, 97, 34, 41, 13, 10,  9,  9,108,111,118,101, 46,
- 99,111,110,102, 40, 99, 41, 13, 10,  9,101,110,100, 13, 10,  9, 13, 10,  9, 45,
- 45, 32, 71,101,116,115, 32,100,101,115,105,114,101,100, 32,109,111,100,117,108,
-101,115, 46, 13, 10,  9,102,111,114, 32,107, 44,118, 32,105,110, 32,112, 97,105,
-114,115, 40, 99, 46,109,111,100,117,108,101,115, 41, 32,100,111, 13, 10,  9,  9,
-105,102, 32,118, 32,116,104,101,110, 13, 10,  9,  9,  9,114,101,113,117,105,114,
-101, 40, 34,108,111,118,101, 46, 34, 32, 46, 46, 32,107, 41, 13, 10,  9,  9,101,
-110,100, 13, 10,  9,101,110,100, 13, 10,  9, 13, 10,  9, 13, 10,  9, 45, 45, 32,
- 83,101,116,117,112, 32,115, 99,114,101,101,110, 32,104,101,114,101, 46, 13, 10,
-  9,105,102, 32, 99, 46,115, 99,114,101,101,110, 32, 97,110,100, 32, 99, 46,109,
-111,100,117,108,101,115, 46,103,114, 97,112,104,105, 99,115, 32,116,104,101,110,
- 32, 13, 10,  9,  9,105,102, 32,108,111,118,101, 46,103,114, 97,112,104,105, 99,
-115, 46, 99,104,101, 99,107, 77,111,100,101, 40, 99, 46,115, 99,114,101,101,110,
- 46,119,105,100,116,104, 44, 32, 99, 46,115, 99,114,101,101,110, 46,104,101,105,
-103,104,116, 44, 32, 99, 46,115, 99,114,101,101,110, 46,102,117,108,108,115, 99,
-114,101,101,110, 41, 32,116,104,101,110, 13, 10,  9,  9,  9,108,111,118,101, 46,
-103,114, 97,112,104,105, 99,115, 46,115,101,116, 77,111,100,101, 40, 99, 46,115,
- 99,114,101,101,110, 46,119,105,100,116,104, 44, 32, 99, 46,115, 99,114,101,101,
-110, 46,104,101,105,103,104,116, 44, 32, 99, 46,115, 99,114,101,101,110, 46,102,
-117,108,108,115, 99,114,101,101,110, 44, 32, 99, 46,115, 99,114,101,101,110, 46,
-118,115,121,110, 99, 44, 32, 99, 46,115, 99,114,101,101,110, 46,102,115, 97, 97,
- 41, 13, 10,  9,  9,101,110,100, 13, 10,  9,  9,108,111,118,101, 46,103,114, 97,
-112,104,105, 99,115, 46,115,101,116, 67, 97,112,116,105,111,110, 40, 99, 46,116,
-105,116,108,101, 41, 13, 10,  9,101,110,100, 13, 10,  9, 13, 10,  9,105,102, 32,
-108,111,118,101, 46,102,105,108,101,115,121,115,116,101,109, 46,101,120,105,115,
-116,115, 40, 34,109, 97,105,110, 46,108,117, 97, 34, 41, 32,116,104,101,110, 32,
-114,101,113,117,105,114,101, 40, 34,109, 97,105,110, 46,108,117, 97, 34, 41, 32,
-101,110,100, 13, 10,  9, 13, 10,101,110,100, 13, 10, 13, 10,102,117,110, 99,116,
-105,111,110, 32,108,111,118,101, 46,114,117,110, 40, 41, 13, 10, 13, 10,  9,105,
-102, 32,108,111,118,101, 46,108,111, 97,100, 32,116,104,101,110, 32,108,111,118,
-101, 46,108,111, 97,100, 40, 41, 32,101,110,100, 13, 10, 13, 10,  9, 45, 45, 32,
- 77, 97,105,110, 32,108,111,111,112, 32,116,105,109,101, 46, 13, 10,  9,119,104,
-105,108,101, 32,116,114,117,101, 32,100,111, 13, 10,  9,  9,108,111,118,101, 46,
-116,105,109,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, 32,116,104,101,110, 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,
-101,116, 68,101,108,116, 97, 40, 41, 41, 32,101,110,100, 13, 10,  9,  9,108,111,
-118,101, 46,103,114, 97,112,104,105, 99,115, 46, 99,108,101, 97,114, 40, 41, 13,
- 10,  9,  9,105,102, 32,108,111,118,101, 46,100,114, 97,119, 32,116,104,101,110,
- 32,108,111,118,101, 46,100,114, 97,119, 40, 41, 32,101,110,100, 13, 10, 13, 10,
-  9,  9, 45, 45, 32, 80,114,111, 99,101,115,115, 32,101,118,101,110,116,115, 46,
- 13, 10,  9,  9,102,111,114, 32,101, 44, 97, 44, 98, 44, 99, 32,105,110, 32,108,
-111,118,101, 46,101,118,101,110,116, 46,112,111,108,108, 40, 41, 32,100,111, 13,
- 10,  9,  9,  9,105,102, 32,101, 32, 61, 61, 32,108,111,118,101, 46,101,118,101,
-110,116, 95,113,117,105,116, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,
-101,110,100, 13, 10,  9,  9,  9,108,111,118,101, 46,104, 97,110,100,108,101,114,
-115, 91,101, 93, 40, 97, 44, 98, 44, 99, 41, 13, 10,  9,  9,101,110,100, 13, 10,
- 13, 10,  9,  9, 45, 45,108,111,118,101, 46,116,105,109,101,114, 46,115,108,101,
-101,112, 40, 49, 48, 41, 13, 10,  9,  9,108,111,118,101, 46,103,114, 97,112,104,
-105, 99,115, 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,
+  9,  9,  9,102,111,110,116, 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,111,110,102,
+105,103, 32,102,105,108,101, 32,101,120,105,115,116,115, 44, 32,108,111, 97,100,
+ 32,105,116, 32, 97,110,100, 32, 97,108,108,111,119, 32,105,116, 32,116,111, 32,
+117,112,100, 97,116,101, 32, 99,111,110,102,105,103, 32,116, 97, 98,108,101, 46,
+ 13, 10,  9,105,102, 32,108,111,118,101, 46,102,105,108,101,115,121,115,116,101,
+109, 46,101,120,105,115,116,115, 40, 34, 99,111,110,102, 46,108,117, 97, 34, 41,
+ 32,116,104,101,110, 13, 10,  9,  9,114,101,113,117,105,114,101, 40, 34, 99,111,
+110,102, 46,108,117, 97, 34, 41, 13, 10,  9,  9,108,111,118,101, 46, 99,111,110,
+102, 40, 99, 41, 13, 10,  9,101,110,100, 13, 10,  9, 13, 10,  9, 45, 45, 32, 71,
+101,116,115, 32,100,101,115,105,114,101,100, 32,109,111,100,117,108,101,115, 46,
+ 13, 10,  9,102,111,114, 32,107, 44,118, 32,105,110, 32,112, 97,105,114,115, 40,
+ 99, 46,109,111,100,117,108,101,115, 41, 32,100,111, 13, 10,  9,  9,105,102, 32,
+118, 32,116,104,101,110, 13, 10,  9,  9,  9,114,101,113,117,105,114,101, 40, 34,
+108,111,118,101, 46, 34, 32, 46, 46, 32,107, 41, 13, 10,  9,  9,101,110,100, 13,
+ 10,  9,101,110,100, 13, 10,  9, 13, 10,  9, 13, 10,  9, 45, 45, 32, 83,101,116,
+117,112, 32,115, 99,114,101,101,110, 32,104,101,114,101, 46, 13, 10,  9,105,102,
+ 32, 99, 46,115, 99,114,101,101,110, 32, 97,110,100, 32, 99, 46,109,111,100,117,
+108,101,115, 46,103,114, 97,112,104,105, 99,115, 32,116,104,101,110, 32, 13, 10,
+  9,  9,105,102, 32,108,111,118,101, 46,103,114, 97,112,104,105, 99,115, 46, 99,
+104,101, 99,107, 77,111,100,101, 40, 99, 46,115, 99,114,101,101,110, 46,119,105,
+100,116,104, 44, 32, 99, 46,115, 99,114,101,101,110, 46,104,101,105,103,104,116,
+ 44, 32, 99, 46,115, 99,114,101,101,110, 46,102,117,108,108,115, 99,114,101,101,
+110, 41, 32,116,104,101,110, 13, 10,  9,  9,  9,108,111,118,101, 46,103,114, 97,
+112,104,105, 99,115, 46,115,101,116, 77,111,100,101, 40, 99, 46,115, 99,114,101,
+101,110, 46,119,105,100,116,104, 44, 32, 99, 46,115, 99,114,101,101,110, 46,104,
+101,105,103,104,116, 44, 32, 99, 46,115, 99,114,101,101,110, 46,102,117,108,108,
+115, 99,114,101,101,110, 44, 32, 99, 46,115, 99,114,101,101,110, 46,118,115,121,
+110, 99, 44, 32, 99, 46,115, 99,114,101,101,110, 46,102,115, 97, 97, 41, 13, 10,
+  9,  9,101,110,100, 13, 10,  9,  9,108,111,118,101, 46,103,114, 97,112,104,105,
+ 99,115, 46,115,101,116, 67, 97,112,116,105,111,110, 40, 99, 46,116,105,116,108,
+101, 41, 13, 10,  9,101,110,100, 13, 10,  9, 13, 10,  9,105,102, 32,108,111,118,
+101, 46,102,105,108,101,115,121,115,116,101,109, 46,101,120,105,115,116,115, 40,
+ 34,109, 97,105,110, 46,108,117, 97, 34, 41, 32,116,104,101,110, 32,114,101,113,
+117,105,114,101, 40, 34,109, 97,105,110, 46,108,117, 97, 34, 41, 32,101,110,100,
+ 13, 10,  9, 13, 10,101,110,100, 13, 10, 13, 10,102,117,110, 99,116,105,111,110,
+ 32,108,111,118,101, 46,114,117,110, 40, 41, 13, 10, 13, 10,  9,105,102, 32,108,
+111,118,101, 46,108,111, 97,100, 32,116,104,101,110, 32,108,111,118,101, 46,108,
+111, 97,100, 40, 41, 32,101,110,100, 13, 10, 13, 10,  9, 45, 45, 32, 77, 97,105,
+110, 32,108,111,111,112, 32,116,105,109,101, 46, 13, 10,  9,119,104,105,108,101,
+ 32,116,114,117,101, 32,100,111, 13, 10,  9,  9,108,111,118,101, 46,116,105,109,
+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, 32,116,104,101,110, 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,101,116, 68,
+101,108,116, 97, 40, 41, 41, 32,101,110,100, 13, 10,  9,  9,108,111,118,101, 46,
+103,114, 97,112,104,105, 99,115, 46, 99,108,101, 97,114, 40, 41, 13, 10,  9,  9,
+105,102, 32,108,111,118,101, 46,100,114, 97,119, 32,116,104,101,110, 32,108,111,
+118,101, 46,100,114, 97,119, 40, 41, 32,101,110,100, 13, 10, 13, 10,  9,  9, 45,
+ 45, 32, 80,114,111, 99,101,115,115, 32,101,118,101,110,116,115, 46, 13, 10,  9,
+  9,102,111,114, 32,101, 44, 97, 44, 98, 44, 99, 32,105,110, 32,108,111,118,101,
+ 46,101,118,101,110,116, 46,112,111,108,108, 40, 41, 32,100,111, 13, 10,  9,  9,
+  9,105,102, 32,101, 32, 61, 61, 32,108,111,118,101, 46,101,118,101,110,116, 95,
+113,117,105,116, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,101,110,100,
+ 13, 10,  9,  9,  9,108,111,118,101, 46,104, 97,110,100,108,101,114,115, 91,101,
+ 93, 40, 97, 44, 98, 44, 99, 41, 13, 10,  9,  9,101,110,100, 13, 10, 13, 10,  9,
+  9, 45, 45,108,111,118,101, 46,116,105,109,101,114, 46,115,108,101,101,112, 40,
+ 49, 48, 41, 13, 10,  9,  9,108,111,118,101, 46,103,114, 97,112,104,105, 99,115,
+ 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, 13, 10, 45, 45, 32, 68,101,102, 97,
-117,108,116, 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, 13, 10, 45, 45, 32, 68,101,102, 97,117,108,116,
+ 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, 13, 10, 13, 10,102,117,110, 99,
-116,105,111,110, 32,108,111,118,101, 46,100,101,102, 97,117,108,116,115, 99,114,
-101,101,110, 40, 41, 13, 10, 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, 13, 10, 13, 10,102,117,110, 99,116,105,111,
+110, 32,108,111,118,101, 46,100,101,102, 97,117,108,116,115, 99,114,101,101,110,
+ 40, 41, 13, 10, 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,
- 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,
+ 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, 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, 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, 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, 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,
- 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,
+ 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,
- 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,
-111,118,101, 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,111,118,101, 46,114,117,110, 44, 32,101,114,114,111,114, 95,112,114,
-105,110,116,101,114, 41, 13, 10, 13, 10,112,114,105,110,116, 40, 34, 68,111,110,
-101, 46, 34, 41,
+111,118,101, 46,114,117,110, 44, 32,101,114,114,111,114, 95,112,114,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);

+ 1 - 3
src/scripts/graphics.lua.h

@@ -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,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,
- 13, 10,101,110,100, 13, 10, 13, 10,102,117,110, 99,116,105,111,110, 32,108,111,
-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,
+ 13, 10,101,110,100, 13, 10, 13, 10,
 };
 
  if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"graphics.lua")==0) lua_call(L, 0, 0);