More bindings, some broke, some not scripting
authorHarley Laue <losinggeneration@gmail.com>
Tue, 23 Aug 2011 00:48:41 -0500
branchscripting
changeset 163 81dc95909040
parent 162 91a8494db13a
child 164 5a6a22204abc
More bindings, some broke, some not
src/core/scripting/lua/CMakeLists.txt
src/core/scripting/lua/binding/hgeBinding.lua
src/core/scripting/lua/binding/hgeanim.lua
src/core/scripting/lua/binding/hgedistort.lua
src/core/scripting/lua/binding/hgefont.lua
src/core/scripting/lua/binding/hgegui.lua
src/core/scripting/lua/binding/hgeguictrls.lua
src/core/scripting/lua/binding/hgeresource.lua
src/core/scripting/lua/binding/hgesprite.lua
src/core/scripting/lua/luna-gen/luna_gen.lua
--- a/src/core/scripting/lua/CMakeLists.txt	Mon Aug 22 16:38:42 2011 -0500
+++ b/src/core/scripting/lua/CMakeLists.txt	Tue Aug 23 00:48:41 2011 -0500
@@ -26,31 +26,31 @@
 set(HGEBINDING_CPP
 # Generated headers
 # 	cpp/lua_hge.h
-# 	cpp/lua_hgeanim.h
+	cpp/lua_hgeanim.h
 	cpp/lua_hgecolor.h
-# 	cpp/lua_hgedistort.h
-# 	cpp/lua_hgefont.h
+	cpp/lua_hgedistort.h
+	cpp/lua_hgefont.h
 # 	cpp/lua_hgegui.h
 # 	cpp/lua_hgeguictrls.h
 # 	cpp/lua_hgeparticle.h
 	cpp/lua_hgerect.h
 	cpp/lua_hgeresource.h
-# 	cpp/lua_hgesprite.h
+	cpp/lua_hgesprite.h
 	cpp/lua_hgestrings.h
 	cpp/lua_hgevector.h
 
 # Generated source files
 # 	cpp/lua_hge.cpp
-# 	cpp/lua_hgeanim.cpp
+	cpp/lua_hgeanim.cpp
 	cpp/lua_hgecolor.cpp
-# 	cpp/lua_hgedistort.cpp
-# 	cpp/lua_hgefont.cpp
+	cpp/lua_hgedistort.cpp
+	cpp/lua_hgefont.cpp
 # 	cpp/lua_hgegui.cpp
 # 	cpp/lua_hgeguictrls.cpp
 # 	cpp/lua_hgeparticle.cpp
 	cpp/lua_hgerect.cpp
-	cpp/lua_hgeresource.cpp
-# 	cpp/lua_hgesprite.cpp
+# 	cpp/lua_hgeresource.cpp
+	cpp/lua_hgesprite.cpp
 	cpp/lua_hgestrings.cpp
 	cpp/lua_hgevector.cpp
 )
--- a/src/core/scripting/lua/binding/hgeBinding.lua	Mon Aug 22 16:38:42 2011 -0500
+++ b/src/core/scripting/lua/binding/hgeBinding.lua	Tue Aug 23 00:48:41 2011 -0500
@@ -6,6 +6,7 @@
 		tbls = tbls .. ' bind' .. v .. ','
 	end
 
+	print(tbls:sub(0, -2))
 	buildDefinitionDB(loadstring(tbls:sub(0, -2))())
 end
 
@@ -33,17 +34,22 @@
 
 function generate()
 	local files = {
+		'hgeAnim',
 		'hgeColor',
+		'hgeDistort',
+		'hgeFont',
+		'hgeSprite',
 		'hgeRect',
 		'hgeStrings',
 		'hgeVector',
-		'hgeResource', -- has members for sprite, animation, font, and others
+-- 		'hgeGui',
+-- 		'hgeResource', -- has members for sprite, animation, font, and others
 -- 		'hge',
 	}
 
 	hgeBuildDefinitionDB(files)
 
-	for i,v in ipairs(files) do
-		hgeBind(v)
-	end
+-- 	for i,v in ipairs(files) do
+-- 		hgeBind(v)
+-- 	end
 end
\ No newline at end of file
--- a/src/core/scripting/lua/binding/hgeanim.lua	Mon Aug 22 16:38:42 2011 -0500
+++ b/src/core/scripting/lua/binding/hgeanim.lua	Tue Aug 23 00:48:41 2011 -0500
@@ -6,58 +6,47 @@
 -- hgeAnimation helper class header
 --
 
+array.pushBack(gen_lua.number_types, 'HTEXTURE')
+
+bindhgeAnim = {
+	classes = {
+		{
+			name = 'hge.Animation',
+			className = 'hgeAnimation',
+			ctors = {
+				'(HTEXTURE tex, int nframes, float FPS, float x, float y, float w, float h)',
+				'(const hgeAnimation &anim)',
+			},
+			memberFunctions = {[[
+				void Play();
+				void Stop();
+				void Resume();
+				void Update(float fDeltaTime);
+				bool IsPlaying() const;
+
+				void SetTexture(HTEXTURE tex);
+				void SetTextureRect(float x1, float y1, float x2, float y2);
+				void SetMode(int mode);
+				void SetSpeed(float FPS);
+				void SetFrame(int n);
+				void SetFrames(int n);
+
+				int GetMode() const;
+				float GetSpeed() const;
+				int GetFrame() const;
+				int GetFrames() const;
+			]]},
+		},
+	},
+	modules = {
+	},
+}
+
 --[[
-
-#include "hgesprite.h"
-
 #define HGEANIM_FWD			0
 #define HGEANIM_REV			1
 #define HGEANIM_PINGPONG	2
 #define HGEANIM_NOPINGPONG	0
 #define HGEANIM_LOOP		4
 #define HGEANIM_NOLOOP		0
-
-/*
-** HGE Animation class
-*/
-class hgeAnimation : public hgeSprite
-{
-public:
-	hgeAnimation(HTEXTURE tex, int nframes, float FPS, float x, float y, float w, float h);
-	hgeAnimation(const hgeAnimation &anim);
-
-	void		Play();
-	void		Stop() { bPlaying=false; }
-	void		Resume() { bPlaying=true; }
-	void		Update(float fDeltaTime);
-	bool		IsPlaying() const { return bPlaying; }
-
-	void		SetTexture(HTEXTURE tex) { hgeSprite::SetTexture(tex); orig_width = hge->Texture_GetWidth(tex, true); }
-	void		SetTextureRect(float x1, float y1, float x2, float y2) { hgeSprite::SetTextureRect(x1,y1,x2,y2); SetFrame(nCurFrame); }
-	void		SetMode(int mode);
-	void		SetSpeed(float FPS) { fSpeed=1.0f/FPS; }
-	void		SetFrame(int n);
-	void		SetFrames(int n) { nFrames=n; }
-
-	int			GetMode() const { return Mode; }
-	float		GetSpeed() const { return 1.0f/fSpeed; }
-	int			GetFrame() const { return nCurFrame; }
-	int			GetFrames() const { return nFrames; }
-
-private:
-	hgeAnimation();
-
-	int			orig_width;
-
-	bool		bPlaying;
-
-	float		fSpeed;
-	float		fSinceLastFrame;
-
-	int			Mode;
-	int			nDelta;
-	int			nFrames;
-	int			nCurFrame;
-};
-
 --]]
--- a/src/core/scripting/lua/binding/hgedistort.lua	Mon Aug 22 16:38:42 2011 -0500
+++ b/src/core/scripting/lua/binding/hgedistort.lua	Tue Aug 23 00:48:41 2011 -0500
@@ -6,54 +6,58 @@
 -- hgeDistortionMesh helper class header
 --
 
+bindhgeDistort = {
+	classes = {
+		{
+			name = 'hge.DistortionMesh',
+			className = 'hgeDistortionMesh',
+			ctors = {
+				'(int cols, int rows)',
+				'(const hgeDistortionMesh &dm)',
+			},
+			memberFunctions =  {[[
+				hgeDistortionMesh& operator=(const hgeDistortionMesh &dm);
+
+				void Render(float x, float y);
+				void Clear(DWORD col, float z);
+
+				void SetTexture(HTEXTURE tex);
+				void SetTextureRect(float x, float y, float w, float h);
+				void SetBlendMode(int blend);
+				void SetZ(int col, int row, float z);
+				void SetColor(int col, int row, DWORD color);
+				void SetDisplacement(int col, int row, float dx, float dy, int ref);
+
+				HTEXTURE GetTexture() const;
+				int GetBlendMode() const;
+				float GetZ(int col, int row) const;
+				DWORD GetColor(int col, int row) const;
+
+				int GetRows();
+				int GetCols();
+			]],
+			-- luna-gen seems to fail on these
+-- 				'void GetTextureRect(float *x, float *y, float *w, float *h) const;',
+-- 				'void GetDisplacement(int col, int row, float* dx, float* dy, int ref) const;',
+
+			},
+		},
+	},
+	modules = {
+	},
+}
+
 --[[
 
 #define HGEDISP_NODE		0
 #define HGEDISP_TOPLEFT		1
 #define HGEDISP_CENTER		2
 
-/*
-** HGE Distortion mesh class
-*/
 class hgeDistortionMesh
 {
 public:
-     hgeDistortionMesh(int cols, int rows);
-     hgeDistortionMesh(const hgeDistortionMesh &dm);
-     ~hgeDistortionMesh();
-
-	 hgeDistortionMesh&	operator= (const hgeDistortionMesh &dm);
-
-     void		Render(float x, float y);
-     void		Clear(DWORD col=0xFFFFFFFF, float z=0.5f);
-
-     void		SetTexture(HTEXTURE tex);
-     void		SetTextureRect(float x, float y, float w, float h);
-     void		SetBlendMode(int blend);
-     void		SetZ(int col, int row, float z);
-     void		SetColor(int col, int row, DWORD color);
-     void		SetDisplacement(int col, int row, float dx, float dy, int ref);
-
-     HTEXTURE	GetTexture() const {return quad.tex;}
-     void		GetTextureRect(float *x, float *y, float *w, float *h) const { *x=tx; *y=ty; *w=width; *h=height; }
-     int		GetBlendMode() const { return quad.blend; }
-     float		GetZ(int col, int row) const;
-     DWORD		GetColor(int col, int row) const;
-     void		GetDisplacement(int col, int row, float *dx, float *dy, int ref) const;
-
-	 int		GetRows() { return nRows; }
-	 int		GetCols() { return nCols; }
-
-private:
-	hgeDistortionMesh();
-
-	static HGE	*hge;
-
-	hgeVertex	*disp_array;
-	int			nRows, nCols;
-	float		cellw,cellh;
-	float		tx,ty,width,height;
-	hgeQuad		quad;
+	void GetTextureRect(float *x, float *y, float *w, float *h) const;
+	void GetDisplacement(int col, int row, float *dx, float *dy, int ref) const;
 };
 
 --]]
--- a/src/core/scripting/lua/binding/hgefont.lua	Mon Aug 22 16:38:42 2011 -0500
+++ b/src/core/scripting/lua/binding/hgefont.lua	Tue Aug 23 00:48:41 2011 -0500
@@ -6,10 +6,54 @@
 -- hgeFont helper class header
 --
 
+bindhgeFont = {
+	classes = {
+		{
+			name = 'hge.Font',
+			className = 'hgeFont',
+			ctors  = {
+				'(const char *filename, bool bMipmap)',
+			},
+			memberFunctions = {[[
+				void Render(float x, float y, int align, const char *string);
+			]],
+-- 				'void printf(float x, float y, int align, const char *format, ...);',
+-- 				'void printfb(float x, float y, float w, float h, int align, const char *format, ...);',
+			[[
+				void SetColor(DWORD col);
+				void SetZ(float z);
+				void SetBlendMode(int blend);
+				void SetScale(float scale);
+				void SetProportion(float prop);
+				void SetRotation(float rot);
+				void SetTracking(float tracking);
+				void SetSpacing(float spacing);
+
+				DWORD GetColor() const;
+				float GetZ() const;
+				int GetBlendMode() const;
+				float GetScale() const;
+				float GetProportion() const;
+				float GetRotation() const;
+				float GetTracking() const;
+				float GetSpacing() const;
+			]],
+
+-- 				'hgeSprite* GetSprite(char c) const;'
+-- 				'float GetPreWidth(char c) const;'
+-- 				'float GetPostWidth(char c) const;'
+			[[
+				float GetHeight() const;
+				float GetStringWidth(const char *string, bool bMultiline) const;
+			]]},
+		},
+	},
+	modules = {
+	},
+}
+
 --[[
 
-#include "hgesprite.h"
-
 #define HGETEXT_LEFT		0
 #define HGETEXT_RIGHT		1
 #define HGETEXT_CENTER		2
@@ -20,68 +64,15 @@
 #define HGETEXT_MIDDLE		8
 #define HGETEXT_VERTMASK	0x0C
 
-/*
-** HGE Font class
-*/
 class hgeFont
 {
 public:
-	hgeFont(const char *filename, bool bMipmap=false);
-	~hgeFont();
-
-	void		Render(float x, float y, int align, const char *string);
 	void		printf(float x, float y, int align, const char *format, ...);
 	void		printfb(float x, float y, float w, float h, int align, const char *format, ...);
 
-	void		SetColor(DWORD col);
-	void		SetZ(float z);
-	void		SetBlendMode(int blend);
-	void		SetScale(float scale) {fScale=scale;}
-	void		SetProportion(float prop) { fProportion=prop; }
-	void		SetRotation(float rot) {fRot=rot;}
-	void		SetTracking(float tracking) {fTracking=tracking;}
-	void		SetSpacing(float spacing) {fSpacing=spacing;}
-
-	DWORD		GetColor() const {return dwCol;}
-	float		GetZ() const {return fZ;}
-	int			GetBlendMode() const {return nBlend;}
-	float		GetScale() const {return fScale;}
-	float		GetProportion() const { return fProportion; }
-	float		GetRotation() const {return fRot;}
-	float		GetTracking() const {return fTracking;}
-	float		GetSpacing() const {return fSpacing;}
-
-	hgeSprite*	GetSprite(char chr) const { return letters[(unsigned char)chr]; }
-	float		GetPreWidth(char chr) const { return pre[(unsigned char)chr]; }
-	float		GetPostWidth(char chr) const { return post[(unsigned char)chr]; }
-	float		GetHeight() const { return fHeight; }
-	float		GetStringWidth(const char *string, bool bMultiline=true) const;
-
-private:
-	hgeFont();
-	hgeFont(const hgeFont &fnt);
-	hgeFont&	operator= (const hgeFont &fnt);
-
-	char*		_get_line(char *file, char *line);
-
-	static HGE	*hge;
-
-	static char	buffer[1024];
-
-	HTEXTURE	hTexture;
-	hgeSprite*	letters[256];
-	float		pre[256];
-	float		post[256];
-	float		fHeight;
-	float		fScale;
-	float		fProportion;
-	float		fRot;
-	float		fTracking;
-	float		fSpacing;
-
-	DWORD		dwCol;
-	float		fZ;
-	int			nBlend;
+	hgeSprite*	GetSprite(char chr) const;
+	float		GetPreWidth(char chr) const;
+	float		GetPostWidth(char chr) const;
 };
 
 --]]
--- a/src/core/scripting/lua/binding/hgegui.lua	Mon Aug 22 16:38:42 2011 -0500
+++ b/src/core/scripting/lua/binding/hgegui.lua	Tue Aug 23 00:48:41 2011 -0500
@@ -6,13 +6,82 @@
 -- hgeGUI helper classes header
 --
 
+bindhgeGui = {
+	classes = {
+		{
+			name = 'hge.GUIObject',
+			className = 'hgeGUIObject',
+			ctors = {
+				'()',
+			},
+			properties = {
+				'int id;',
+				'bool bStatic;',
+				'bool bVisible;',
+				'bool bEnabled;',
+				'hgeRect rect;',
+				'DWORD color;',
+
+				'hgeGUI *gui;',
+				'hgeGUIObject *next;',
+				'hgeGUIObject *prev;',
+			},
+			memberFunctions = {
+				{ 'void Update(float dt);' },
+
+				{ 'virtual void Enter();' },
+				{ 'virtual void Leave();' },
+				{ 'virtual void Reset();' },
+				{ 'virtual bool IsDone();' },
+				{ 'virtual void Focus(bool bFocused);' },
+				{ 'virtual void MouseOver(bool bOver);' },
+
+				{ 'virtual bool MouseMove(float x, float y);' },
+				{ 'virtual bool MouseLButton(bool bDown);' },
+				{ 'virtual bool MouseRButton(bool bDown);' },
+				{ 'virtual bool MouseWheel(int nNotches);' },
+				{ 'virtual bool KeyClick(int key, int chr);' },
+
+				{ 'virtual void SetColor(DWORD _color);' },
+			},
+		},
+		{
+			name = 'hge.GUI',
+			className = 'hgeGUI',
+			ctors = {
+				'()',
+			},
+			memberFunctions = {
+				{ 'void AddCtrl(hgeGUIObject *ctrl);' },
+				{ 'void DelCtrl(int id);' },
+				{ 'hgeGUIObject*	GetCtrl(int id) const;' },
+
+				{ 'void MoveCtrl(int id, float x, float y);' },
+				{ 'void ShowCtrl(int id, bool bVisible);' },
+				{ 'void EnableCtrl(int id, bool bEnabled);' },
+
+				{ 'void SetNavMode(int mode);' },
+				{ 'void SetCursor(hgeSprite *spr);' },
+				{ 'void SetColor(DWORD color);' },
+				{ 'void SetFocus(int id);' },
+				{ 'int GetFocus() const;' },
+
+				{ 'void Enter();' },
+				{ 'void Leave();' },
+				{ 'void Reset();' },
+				{ 'void Move(float dx, float dy);' },
+
+				{ 'int Update(float dt);' },
+				{ 'void Render();' },
+			},
+		},
+	},
+	modules = {
+	},
+}
+
 --[[
 
-#include "hge.h"
-#include "hgesprite.h"
-#include "hgerect.h"
-
-
 #define HGEGUI_NONAVKEYS		0
 #define HGEGUI_LEFTRIGHT		1
 #define HGEGUI_UPDOWN			2
@@ -20,55 +89,42 @@
 
 class hgeGUI;
 
-/*
-** hgeGUIObject
-*/
 class hgeGUIObject
 {
 public:
-	hgeGUIObject()	{ hge=hgeCreate(HGE_VERSION); color=0xFFFFFFFF; }
-	virtual			~hgeGUIObject() { hge->Release(); }
+	hgeGUIObject();
+	virtual ~hgeGUIObject();
 
-	virtual void	Render() = 0;
-	virtual void	Update(float dt) {}
+	virtual void Render() = 0;
+	virtual void Update(float dt);
 
-	virtual void	Enter() {}
-	virtual void	Leave() {}
-	virtual void	Reset() {}
-	virtual bool	IsDone() { return true; }
-	virtual void	Focus(bool bFocused) {}
-	virtual void	MouseOver(bool bOver) {}
+	virtual void Enter();
+	virtual void Leave();
+	virtual void Reset();
+	virtual bool IsDone();
+	virtual void Focus(bool bFocused);
+	virtual void MouseOver(bool bOver);
 
-	virtual bool	MouseMove(float x, float y) { return false; }
-	virtual bool	MouseLButton(bool bDown) { return false; }
-	virtual bool	MouseRButton(bool bDown) { return false; }
-	virtual bool	MouseWheel(int nNotches) { return false; }
-	virtual bool	KeyClick(int key, int chr) { return false; }
+	virtual bool MouseMove(float x, float y);
+	virtual bool MouseLButton(bool bDown);
+	virtual bool MouseRButton(bool bDown);
+	virtual bool MouseWheel(int nNotches);
+	virtual bool KeyClick(int key, int chr);
 
-	virtual void	SetColor(DWORD _color) { color=_color; }
+	virtual void SetColor(DWORD _color);
 
-	int				id;
-	bool			bStatic;
-	bool			bVisible;
-	bool			bEnabled;
-	hgeRect			rect;
-	DWORD			color;
+	int id;
+	bool bStatic;
+	bool bVisible;
+	bool bEnabled;
+	hgeRect rect;
+	DWORD color;
 
-	hgeGUI			*gui;
-	hgeGUIObject	*next;
-	hgeGUIObject	*prev;
-
-protected:
-	hgeGUIObject(const hgeGUIObject &go);
-	hgeGUIObject&	operator= (const hgeGUIObject &go);
-
-	static HGE		*hge;
+	hgeGUI *gui;
+	hgeGUIObject *next;
+	hgeGUIObject *prev;
 };
 
-
-/*
-** hgeGUI
-*/
 class hgeGUI
 {
 public:
@@ -96,27 +152,6 @@
 
 	int				Update(float dt);
 	void			Render();
-
-private:
-	hgeGUI(const hgeGUI &);
-	hgeGUI&			operator= (const hgeGUI&);
-	bool			ProcessCtrl(hgeGUIObject *ctrl);
-
-	static HGE		*hge;
-
-	hgeGUIObject	*ctrls;
-	hgeGUIObject	*ctrlLock;
-	hgeGUIObject	*ctrlFocus;
-	hgeGUIObject	*ctrlOver;
-
-	int				navmode;
-	int				nEnterLeave;
-	hgeSprite		*sprCursor;
-
-	float			mx,my;
-	int				nWheel;
-	bool			bLPressed, bLReleased;
-	bool			bRPressed, bRReleased;
 };
 
 --]]
--- a/src/core/scripting/lua/binding/hgeguictrls.lua	Mon Aug 22 16:38:42 2011 -0500
+++ b/src/core/scripting/lua/binding/hgeguictrls.lua	Tue Aug 23 00:48:41 2011 -0500
@@ -8,137 +8,87 @@
 
 --[[
 
-#include "hge.h"
-#include "hgesprite.h"
-#include "hgefont.h"
-#include "hgerect.h"
-#include "hgegui.h"
+#define hgeButtonGetState(gui,id) ((hgeGUIButton*)gui->GetCtrl(id))->GetState()
+#define hgeButtonSetState(gui,id,b) ((hgeGUIButton*)gui->GetCtrl(id))->SetState(b)
+#define hgeSliderGetValue(gui,id) ((hgeGUISlider*)gui->GetCtrl(id))->GetValue()
+#define hgeSliderSetValue(gui,id,f) ((hgeGUISlider*)gui->GetCtrl(id))->SetValue(f)
+#define hgeGetTextCtrl(gui,id) ((hgeGUIText*)gui->GetCtrl(id))
+#define hgeGetListboxCtrl(gui,id) ((hgeGUIListbox*)gui->GetCtrl(id))
 
-#define hgeButtonGetState(gui,id)		((hgeGUIButton*)gui->GetCtrl(id))->GetState()
-#define hgeButtonSetState(gui,id,b)		((hgeGUIButton*)gui->GetCtrl(id))->SetState(b)
-#define hgeSliderGetValue(gui,id)		((hgeGUISlider*)gui->GetCtrl(id))->GetValue()
-#define hgeSliderSetValue(gui,id,f)		((hgeGUISlider*)gui->GetCtrl(id))->SetValue(f)
-#define hgeGetTextCtrl(gui,id)			((hgeGUIText*)gui->GetCtrl(id))
-#define hgeGetListboxCtrl(gui,id)		((hgeGUIListbox*)gui->GetCtrl(id))
-
-/*
-** hgeGUIText
-*/
 class hgeGUIText : public hgeGUIObject
 {
 public:
 	hgeGUIText(int id, float x, float y, float w, float h, hgeFont *fnt);
 
-	void			SetMode(int _align);
-	void			SetText(const char *_text);
-	void			printf(const char *format, ...);
+	void SetMode(int _align);
+	void SetText(const char *_text);
+	void printf(const char *format, ...);
 
-	virtual void	Render();
-
-private:
-	hgeFont*		font;
-	float			tx, ty;
-	int				align;
-	char			text[256];
+	virtual void Render();
 };
 
-
-/*
-** hgeGUIButton
-*/
 class hgeGUIButton : public hgeGUIObject
 {
 public:
 	hgeGUIButton(int id, float x, float y, float w, float h, HTEXTURE tex, float tx, float ty);
-	virtual			~hgeGUIButton();
+	virtual ~hgeGUIButton();
 
-	void			SetMode(bool _bTrigger) { bTrigger=_bTrigger; }
-	void			SetState(bool _bPressed) { bPressed=_bPressed; }
-	bool			GetState() const { return bPressed; }
+	void SetMode(bool _bTrigger) { bTrigger=_bTrigger; }
+	void SetState(bool _bPressed) { bPressed=_bPressed; }
+	bool GetState() const { return bPressed; }
 
-	virtual void	Render();
-	virtual bool	MouseLButton(bool bDown);
-
-private:
-	bool			bTrigger;
-	bool			bPressed;
-	bool			bOldState;
-	hgeSprite		*sprUp, *sprDown;
+	virtual void Render();
+	virtual bool MouseLButton(bool bDown);
 };
 
-
-/*
-** hgeGUISlider
-*/
-#define HGESLIDER_BAR			0
-#define HGESLIDER_BARRELATIVE	1
-#define HGESLIDER_SLIDER		2
+#define HGESLIDER_BAR 0
+#define HGESLIDER_BARRELATIVE 1
+#define HGESLIDER_SLIDER 2
 
 class hgeGUISlider : public hgeGUIObject
 {
 public:
 	hgeGUISlider(int id, float x, float y, float w, float h, HTEXTURE tex, float tx, float ty, float sw, float sh, bool vertical=false);
-	virtual			~hgeGUISlider();
+	virtual ~hgeGUISlider();
 
-	void			SetMode(float _fMin, float _fMax, int _mode) { fMin=_fMin; fMax=_fMax; mode=_mode; }
-	void			SetValue(float _fVal);
-	float			GetValue() const { return fVal; }
+	void SetMode(float _fMin, float _fMax, int _mode) { fMin=_fMin; fMax=_fMax; mode=_mode; }
+	void SetValue(float _fVal);
+	float GetValue() const { return fVal; }
 
-	virtual void	Render();
-	virtual bool	MouseMove(float x, float y);
-	virtual bool	MouseLButton(bool bDown);
-
-private:
-	bool			bPressed;
-	bool			bVertical;
-	int				mode;
-	float			fMin, fMax, fVal;
-	float			sl_w, sl_h;
-	hgeSprite		*sprSlider;
+	virtual void Render();
+	virtual bool MouseMove(float x, float y);
+	virtual bool MouseLButton(bool bDown);
 };
 
-
-/*
-** hgeGUIListbox
-*/
 struct hgeGUIListboxItem
 {
-	char				text[64];
-	hgeGUIListboxItem	*next;
+	char text[64];
+	hgeGUIListboxItem *next;
 };
 
 class hgeGUIListbox : public hgeGUIObject
 {
 public:
 	hgeGUIListbox(int id, float x, float y, float w, float h, hgeFont *fnt, DWORD tColor, DWORD thColor, DWORD hColor);
-	virtual			~hgeGUIListbox();
+	virtual ~hgeGUIListbox();
 
-	int				AddItem(char *item);
-	void			DeleteItem(int n);
-	int				GetSelectedItem() { return nSelectedItem; }
-	void			SetSelectedItem(int n) { if(n>=0 && n<GetNumItems()) nSelectedItem=n; }
-	int				GetTopItem() { return nTopItem; }
-	void			SetTopItem(int n) { if(n>=0 && n<=GetNumItems()-GetNumRows()) nTopItem=n; }
+	int AddItem(char *item);
+	void DeleteItem(int n);
+	int GetSelectedItem() { return nSelectedItem; }
+	void SetSelectedItem(int n) { if(n>=0 && n<GetNumItems()) nSelectedItem=n; }
+	int GetTopItem() { return nTopItem; }
+	void SetTopItem(int n) { if(n>=0 && n<=GetNumItems()-GetNumRows()) nTopItem=n; }
 
-	char			*GetItemText(int n);
-	int				GetNumItems() { return nItems; }
-	int				GetNumRows() { return int((rect.y2-rect.y1)/font->GetHeight()); }
-	void			Clear();
+	char *GetItemText(int n);
+	int GetNumItems() { return nItems; }
+	int GetNumRows() { return int((rect.y2-rect.y1)/font->GetHeight()); }
+	void Clear();
 
-	virtual void	Render();
-	virtual bool	MouseMove(float x, float y) { mx=x; my=y; return false; }
-	virtual bool	MouseLButton(bool bDown);
-	virtual bool	MouseWheel(int nNotches);
-	virtual bool	KeyClick(int key, int chr);
-
-private:
-	hgeSprite		*sprHighlight;
-	hgeFont			*font;
-	DWORD			textColor, texthilColor;
-
-	int					nItems, nSelectedItem, nTopItem;
-	float				mx, my;
-	hgeGUIListboxItem	*pItems;
+	virtual void Render();
+	virtual bool MouseMove(float x, float y) { mx=x; my=y; return false; }
+	virtual bool MouseLButton(bool bDown);
+	virtual bool MouseWheel(int nNotches);
+	virtual bool KeyClick(int key, int chr);
 };
 
 --]]
--- a/src/core/scripting/lua/binding/hgeresource.lua	Mon Aug 22 16:38:42 2011 -0500
+++ b/src/core/scripting/lua/binding/hgeresource.lua	Tue Aug 23 00:48:41 2011 -0500
@@ -49,11 +49,11 @@
 -- 				{ rename = 'getstream', 'HSTREAM GetStream(const char *name, int resgroup)' },
 -- 				{ rename = 'gettarget', 'HTARGET GetTarget(const char *name)' },
 
--- 				{ rename = 'getsprite', 'hgeSprite* GetSprite(const char *name)' },
--- 				{ rename = 'getanimation', 'hgeAnimation* GetAnimation(const char *name)' },
--- 				{ rename = 'getfont', 'hgeFont* GetFont(const char *name)' },
+				{ rename = 'getsprite', 'hgeSprite* GetSprite(const char *name)' },
+				{ rename = 'getanimation', 'hgeAnimation* GetAnimation(const char *name)' },
+				{ rename = 'getfont', 'hgeFont* GetFont(const char *name)' },
 -- 				{ rename = 'getparticlesystem', 'hgeParticleSystem* GetParticleSystem(const char *name)' },
--- 				{ rename = 'getdistortionmesh', 'hgeDistortionMesh* GetDistortionMesh(const char *name)' },
+				{ rename = 'getdistortionmesh', 'hgeDistortionMesh* GetDistortionMesh(const char *name)' },
 				{ rename = 'getstringtable', 'hgeStringTable* GetStringTable(const char *name, int resgroup)' },
 			},
 		},
--- a/src/core/scripting/lua/binding/hgesprite.lua	Mon Aug 22 16:38:42 2011 -0500
+++ b/src/core/scripting/lua/binding/hgesprite.lua	Tue Aug 23 00:48:41 2011 -0500
@@ -6,6 +6,46 @@
 -- hgeSprite helper class header
 --
 
+bindhgeSprite = {
+	classes = {
+		name = 'hge.Sprite',
+		className = 'hgeSprite',
+		ctors = {
+			'(HTEXTURE tex, float x, float y, float w, float h)',
+			'(const hgeSprite &spr)',
+		},
+		memberFunctions = {
+			{ 'void Render(float x, float y);' },
+			{ 'void RenderEx(float x, float y, float rot, float hscale=1.0f, float vscale);' },
+			{ 'void RenderStretch(float x1, float y1, float x2, float y2);' },
+			{ 'void Render4V(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3);' },
+
+			{ 'void SetTexture(HTEXTURE tex);' },
+			{ 'void SetTextureRect(float x, float y, float w, float h, bool adjSize);' },
+			{ 'void SetColor(DWORD col, int i);' },
+			{ 'void SetZ(float z, int i);' },
+			{ 'void SetBlendMode(int blend);' },
+			{ 'void SetHotSpot(float x, float y);' },
+			{ 'void SetFlip(bool bX, bool bY, bool bHotSpot = false);' },
+
+			{ 'HTEXTURE GetTexture() const;' },
+			{ 'void GetTextureRect(float *x, float *y, float *w, float *h) const;' },
+			{ 'DWORD GetColor(int i) const;' },
+			{ 'float GetZ(int i) const;' },
+			{ 'int GetBlendMode() const;' },
+			{ 'void GetHotSpot(float *x, float *y) const;' },
+			{ 'void GetFlip(bool *bX, bool *bY) const;' },
+
+			{ 'float GetWidth() const;' },
+			{ 'float GetHeight() const;' },
+			{ 'hgeRect* GetBoundingBox(float x, float y, hgeRect *rect) const;' },
+			{ 'hgeRect* GetBoundingBoxEx(float x, float y, float rot, float hscale, float vscale, hgeRect *rect) const;' },
+		}
+	},
+	modules = {
+	},
+}
+
 --[[
 
 #include "hgerect.h"
@@ -14,48 +54,46 @@
 ** HGE Sprite class
 */
 class hgeSprite
-{
+;
 public:
-	hgeSprite(HTEXTURE tex, float x, float y, float w, float h);
-	hgeSprite(const hgeSprite &spr);
-	~hgeSprite() { hge->Release(); }
+ hgeSprite(HTEXTURE tex, float x, float y, float w, float h);
+ hgeSprite(const hgeSprite &spr);
 
+ void Render(float x, float y);
+ void RenderEx(float x, float y, float rot, float hscale=1.0f, float vscale);
+ void RenderStretch(float x1, float y1, float x2, float y2);
+ void Render4V(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3);
 
-	void		Render(float x, float y);
-	void		RenderEx(float x, float y, float rot, float hscale=1.0f, float vscale=0.0f);
-	void		RenderStretch(float x1, float y1, float x2, float y2);
-	void		Render4V(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3);
+ void SetTexture(HTEXTURE tex);
+ void SetTextureRect(float x, float y, float w, float h, bool adjSize);
+ void SetColor(DWORD col, int i);
+ void SetZ(float z, int i);
+ void SetBlendMode(int blend);
+ void SetHotSpot(float x, float y);
+ void SetFlip(bool bX, bool bY, bool bHotSpot = false);
 
-	void		SetTexture(HTEXTURE tex);
-	void		SetTextureRect(float x, float y, float w, float h, bool adjSize = true);
-	void		SetColor(DWORD col, int i=-1);
-	void		SetZ(float z, int i=-1);
-	void		SetBlendMode(int blend) { quad.blend=blend; }
-	void		SetHotSpot(float x, float y) { hotX=x; hotY=y; }
-	void		SetFlip(bool bX, bool bY, bool bHotSpot = false);
+ HTEXTURE GetTexture() const;
+ void GetTextureRect(float *x, float *y, float *w, float *h) const;
+ DWORD GetColor(int i) const;
+ float GetZ(int i) const;
+ int GetBlendMode() const;
+ void GetHotSpot(float *x, float *y) const;
+ void GetFlip(bool *bX, bool *bY) const;
 
-	HTEXTURE	GetTexture() const { return quad.tex; }
-	void		GetTextureRect(float *x, float *y, float *w, float *h) const { *x=tx; *y=ty; *w=width; *h=height; }
-	DWORD		GetColor(int i=0) const { return quad.v[i].col; }
-	float		GetZ(int i=0) const { return quad.v[i].z; }
-	int			GetBlendMode() const { return quad.blend; }
-	void		GetHotSpot(float *x, float *y) const { *x=hotX; *y=hotY; }
-	void		GetFlip(bool *bX, bool *bY) const { *bX=bXFlip; *bY=bYFlip; }
-
-	float		GetWidth() const { return width; }
-	float		GetHeight() const { return height; }
-	hgeRect*	GetBoundingBox(float x, float y, hgeRect *rect) const { rect->Set(x-hotX, y-hotY, x-hotX+width, y-hotY+height); return rect; }
-	hgeRect*	GetBoundingBoxEx(float x, float y, float rot, float hscale, float vscale,  hgeRect *rect) const;
+ float GetWidth() const;
+ float GetHeight() const;
+ hgeRect* GetBoundingBox(float x, float y, hgeRect *rect) const;
+ hgeRect* GetBoundingBoxEx(float x, float y, float rot, float hscale, float vscale, hgeRect *rect) const;
 
 protected:
-	hgeSprite();
-	static HGE	*hge;
+ hgeSprite();
+ static HGE *hge;
 
-	hgeQuad		quad;
-	float		tx, ty, width, height;
-	float		tex_width, tex_height;
-	float		hotX, hotY;
-	bool		bXFlip, bYFlip, bHSFlip;
+ hgeQuad quad;
+ float tx, ty, width, height;
+ float tex_width, tex_height;
+ float hotX, hotY;
+ bool bXFlip, bYFlip, bHSFlip;
 };
 
 --]]
\ No newline at end of file
--- a/src/core/scripting/lua/luna-gen/luna_gen.lua	Mon Aug 22 16:38:42 2011 -0500
+++ b/src/core/scripting/lua/luna-gen/luna_gen.lua	Tue Aug 23 00:48:41 2011 -0500
@@ -6,7 +6,7 @@
 	verbosecpp=true  -- easy for debugging cpp compilation error
 	verbose=false
 	gen_lua={}
-	gen_lua.supportedClassProperties={'^ifdef$','^ifndef$','^isLuaInheritable$','^decl$','^if_$', '^enums$','^inheritsFrom$', '^name$','^className$','^ctors$','^wrapperCode$','^globalWrapperCode',  '^staticMemberFunctions$', '^memberFunctionsFromFile$', '^memberFunctions$','^isExtendableFromLua$','^read_properties$','^write_properties$','^custumFunctionsToRegister$', '^properties$',}
+	gen_lua.supportedClassProperties={'^ifdef$','^ifndef$','^isLuaInheritable$','^decl$','^if_$', '^enums$','^inheritsFrom$', '^name$','^className$','^ctors$','^wrapperCode$','^globalWrapperCode',  '^staticMemberFunctions$', '^memberFunctionsFromFile$', '^memberFunctions$','^isExtendableFromLua$','^read_properties$','^write_properties$','^customFunctionsToRegister$', '^properties$',}
 	gen_lua.number_types={'int', 'double', 'float'}
 	gen_lua.enum_types={}
 	gen_lua.boolean_types={'bool'}
@@ -22,7 +22,7 @@
 end
 
 -- How to read code.
--- Parsing: 
+-- Parsing:
 -- function buildDefinitionDB(...)
 
 -- Main: at the end of this file
@@ -32,7 +32,7 @@
 	gen_lua.type_error_msg='type "gen_lua.type_names" to see all registered types'
 	gen_lua.cpp_contents={}
 	gen_lua.complex_type_names={} -- in pattern form
-	gen_lua.luna_types={} -- will be obtained from build definitionsDB. 
+	gen_lua.luna_types={} -- will be obtained from build definitionsDB.
 	gen_lua.type_names={'void'} -- in normalized form (see normalizeClassName below)
 	gen_lua.usedHashValue={}
 	gen_lua.getNameSpace={}
@@ -96,13 +96,13 @@
 		return valfalse
 	end
 	function codeDostring(luaCode)
-		return "	luna_dostring(L,"..luacodeInCquote(luaCode)..");" -- luaL_dostring followed by pcall error checking 
+		return "	luna_dostring(L,"..luacodeInCquote(luaCode)..");" -- luaL_dostring followed by pcall error checking
 	end
 	function codeRequireMylib(additionalLuaCode)
 		return "luna_dostring(L, "..luacodeInCquote([[
 		package.path="]]..script_path..[[/?.lua;package.path"
 		require('mylib')
-		]]..(additionalLuaCode or "") ) -- closing luacodeInCquote 
+		]]..(additionalLuaCode or "") ) -- closing luacodeInCquote
 		..");\n" -- closing luaL_dostring
 	end
 	function writeLaunchLuaDebugger()
@@ -143,7 +143,7 @@
 	end
 	function tokenizeArg(arg, tokens) -- input: const char* a -> output: const, char, *, a
 		local ttokens= string.tokenize(arg, '%s')
-		
+
 		for j,m in ipairs(tokens) do
 			local tokens={}
 			for i,v in ipairs(ttokens) do
@@ -151,7 +151,7 @@
 			end
 			ttokens=tokens
 		end
-		
+
 		return ttokens
 	end
 	function genInterfaceName(luaclass)
@@ -181,8 +181,8 @@
 	function addReturnType(vv, cppname)
 		if vv.if_ then
 			addLine('#if '..vv.if_)
-		end 
-		
+		end
+
 		local catch=gen_lua.catch_cpp_exception
 		if vv.returnType.c=='void' then
 			if catch then addLine('\ttry {') end
@@ -207,10 +207,10 @@
 					addLine('	Luna<'..cpp_parent_classname..' >::push(L,('..cpp_parent_classname..' *)ret,'..tostring(adopt)..',"'..cp.uniqueLuaClassname..'");')
 					if catch then addLine('\t} catch(std::exception& e) { luaL_error( L,e.what()); }') end
 				else
-					ii=string.find(ia.t,'%&') 
+					ii=string.find(ia.t,'%&')
 					if ii then
 						local adopt=false
-						-- reference type: 
+						-- reference type:
 						if catch then addLine('\ttry {') end
 						addLine('\t'..vv.returnType.t..' ret='..cppname..'('..parsedNames(vv.args)..');')
 						addLine('	Luna<'..cpp_parent_classname..' >::push(L,&ret,'..tostring(adopt)..',"'..cp.uniqueLuaClassname..'");')
@@ -259,7 +259,7 @@
 			addLine('#else')
 			addLine('   return 0;')
 			addLine('#endif')
-		end 
+		end
 		addLine('  }')
 	end
 	function addLine(line)
@@ -272,7 +272,7 @@
 			local lines=string.lines(line)
 			local lline=lines[#lines]
 			if #lline<61 then
-				lines[#lines]=lline..string.rep(' ',61-#lline) 
+				lines[#lines]=lline..string.rep(' ',61-#lline)
 			end
 			line=table.concat(lines, '\n')
 			array.pushBack(gen_lua.cpp_contents, line.." // "..linen)
@@ -280,7 +280,7 @@
 			array.pushBack(gen_lua.cpp_contents, line)
 		end
 	end
-	function isLunaType(ia) 
+	function isLunaType(ia)
 		if ia.t==nil then lgerror('Error! isLunaType') end
 		return findLunaClassProperty(ia)~=nil
 	end
@@ -289,7 +289,7 @@
 		if( not str) then lgerror('findLunaClassProperty', ia.t, ia.n, ia.c) end
 		return gen_lua.luna_types[normalizeClassName(str)]
 	end
-	function isNumberType(ia) 
+	function isNumberType(ia)
 		if ia.t==nil then lgerror('Error! isNumberType') end
 		if string.isMatched(ia.t, gen_lua.number_types) then
 			return true
@@ -306,14 +306,14 @@
 		end
 		return false
 	end
-	function isBooleanType(ia) 
+	function isBooleanType(ia)
 		if ia.t==nil then lgerror('Error! isBooleanType') end
 		if string.isMatched(ia.t, gen_lua.boolean_types) then
 			return true
 		end
 		return false
 	end
-	function isStringType(ia) 
+	function isStringType(ia)
 		if ia.t==nil then lgerror('Error! isStringType') end
 		if string.isMatched(ia.t, gen_lua.string_types) then
 			return true
@@ -386,7 +386,7 @@
 			if not s2 or s2<s then lgerror('unknown function definition format', fn)  end
 
 			local part2=string.sub(fn, e,s2)
-			
+
 			part1=string.trimRight(part1)
 			local a,b=os.rightTokenize(part1, '%s')
 
@@ -429,7 +429,7 @@
 				if select(1,string.find(t_modifiers,'*')) then
 					addLine('	'..t..' '..ia.n..'=static_cast<'..cppclass_name..' *>(Luna<'..cpp_parent_classname..' >::check(L,'..i..'));')
 				else
-					local ii=string.find(ia.t,'%&') 
+					local ii=string.find(ia.t,'%&')
 					if not ii then t=t..'&' end -- add reference
 					addLine('	'..t..' '..ia.n..'=static_cast<'..cppclass_name..' &>(*Luna<'..cpp_parent_classname..' >::check(L,'..i..'));')
 				end
@@ -440,7 +440,7 @@
 					addLine('	'..ia.t..' '..ia.n..'=('..ia.t..')(int)lua_tonumber(L,'..i..');')
 				else
 					addLine('	'..ia.t..' '..ia.n..'=('..ia.t..')lua_tonumber(L,'..i..');')
-				end	
+				end
 			elseif isBooleanType(ia) then
 				addLine('	'..ia.t..' '..ia.n..'=('..ia.t..')lua_toboolean(L,'..i..');')
 			else
@@ -486,7 +486,7 @@
 	function write(ctn)
 		local lines=string.lines(ctn)
 
-		if verbose then 
+		if verbose then
 			for i,l in ipairs(lines) do
 				print ("::"..ctn)
 			end
@@ -532,7 +532,7 @@
 	end
 	function normalizeClassName(classNameOrPattern)
 		local str=classNameOrPattern
-		
+
 		if select(1,string.find(str,'%%')) then
 			str=patternToNormalizedClassName(str)
 		end
@@ -541,7 +541,7 @@
 
 		local tokens=tokenizeArg(str, token_sep)
 		local sm={}
-		for i=1, #tokens do 
+		for i=1, #tokens do
 			for j=1, #token_sep do
 				if select(1,string.find(tokens[i],token_sep[j]))~=nil then
 					sm[i]=true
@@ -551,7 +551,7 @@
 			end
 		end
 		local out=""
-		for i=1, #tokens-1 do 
+		for i=1, #tokens-1 do
 			if sm[i] or sm[i+1] then
 				out=out..tokens[i].."~"
 			else
@@ -559,7 +559,7 @@
 			end
 		end
 		out=out..tokens[#tokens]
-		return out 
+		return out
 	end
 	-- e.g. str: (int x, double d)
 	-- return {{ t='int', n='x'}, {t='double', n='d'}}
@@ -599,7 +599,7 @@
 				-- print(tokens[i])
 				local matched=string.isLongestMatched(tokens[i],typenames, "[%(,]")
 				if not matched
-					and not string.isLongestMatched(tokens[i], gen_lua.modifiers) 
+					and not string.isLongestMatched(tokens[i], gen_lua.modifiers)
 					and gen_lua.luna_types[tokens[i]]==nil
 					then
 					if i==#tokens then
@@ -608,11 +608,11 @@
 						lgerror('Error unknown type name : '..normalizedClassNameToClassName(args[iarg])..'\n'..gen_lua.type_error_msg)
 					end
 				end
-				if matched then 
-					
+				if matched then
+
 					if gmatched==nil or ( #typenames[gmatched]<#typenames[matched]) then
 						-- prefer longer match
-						gmatched=matched 
+						gmatched=matched
 					end
 				end
 			end
@@ -650,7 +650,7 @@
 			if type(v)=="string" then
 				local lines=string.lines(v)
 				for il,l in ipairs(lines) do
-					local s=string.find(l,'//') 
+					local s=string.find(l,'//')
 					if s then l=string.sub(l, 1, s-1)  end -- remove comments
 					local s=string.find(l,'@')
 					if s then -- parse options
@@ -697,11 +697,11 @@
 			end
 		end
 		util.writeFile(filename, ctx_new)
-			
+
 	end
 end
 
--- rectify function definitions 
+-- rectify function definitions
 -- input: void asdf(int narg, std::string param)
 -- output: {returnType= 'void', cppname='asdf', luaname='asdf', args={{t='int', n='nArg'},{t='std::string', n='param'}}}
 -- note that this modifies bindTarget table significantly!
@@ -713,7 +713,7 @@
 			for k,v in ipairs(bindTarget.modules) do
 
 				v.namespace,v.name=string.rightTokenize(v.namespace, '%.')
-				if v.name=='_G' then 
+				if v.name=='_G' then
 					v.namespace='_G'
 				end
 				if not v.namespace then
@@ -778,24 +778,24 @@
 			end
 		end
 		luaclass.iluaclass=iluaclass
-		luaclass.className=normalizeClassName(luaclass.className or 
+		luaclass.className=normalizeClassName(luaclass.className or
 											  string.gsub(luaclass.name, '%.', '::'))
 		array.pushBack(gen_lua.type_names, luaclass.className)
-		-- if namespace (say NS) is defined, 
+		-- if namespace (say NS) is defined,
 		-- two metatables are defined:
 		--  1. __luna.NS_luaclass_name
 		--  2.  NS.luaclass_name
-		--  where 2 is simply a reference to 1. 
-		--  Note that this doens't have performance overhead but has slight memory overhead 
+		--  where 2 is simply a reference to 1.
+		--  Note that this doens't have performance overhead but has slight memory overhead
 		--  (depending on the number of classes as opposed to the number of instances)
-		
+
 		do
 			-- process luaclass name and namespace name
 			local uluaclass_name=luaclass.name
 			if gen_lua.getNameSpace[luaclass.className] then
 				luaclass.namespace=gen_lua.getNameSpace[luaclass.className]
 			end
-			
+
 			local v=luaclass
 			if v.namespace==nil then
 				v.namespace,v.name=string.rightTokenize(v.name, '%.')
@@ -850,7 +850,7 @@
 	for iluaclass, luaclass in ipairs(bindTarget.classes) do
 		if luaclass.properties then
 			-- auto generate read_properties and write_properties functions
-			
+
 			if not luaclass.wrapperCode then luaclass.wrapperCode='' end
 			if not luaclass.read_properties then luaclass.read_properties= {} end
 			if not luaclass.write_properties then luaclass.write_properties={} end
@@ -861,7 +861,7 @@
 			for ip, p in ipairs(luaclass.properties) do
 				local cc=string.lines(p)
 				for i=1,#cc do
-					local s=string.find(cc[i],'//') 
+					local s=string.find(cc[i],'//')
 					if s then cc[i]=string.sub(cc[i], 1, s-1)  end -- remove comments
 					cc[i]=string.trimSpaces(cc[i])
 					if string.len(cc[i])>1 then
@@ -871,7 +871,7 @@
 			end
 
 			for ip, p in ipairs(propertyLines) do
-				
+
 				local s=string.find(p,'@')
 				local luaname
 				if s then -- parse options
@@ -925,13 +925,13 @@
 	for iluaclass, luaclass in ipairs(bindTarget.classes) do
 		if luaclass.isLuaInheritable then
 			local cpp_parent_classname=normalizedClassNameToClassName(luaclass.uppermostParent.className)
-			if luaclass.custumFunctionsToRegister==nil then
-				luaclass.custumFunctionsToRegister={}
+			if luaclass.customFunctionsToRegister==nil then
+				luaclass.customFunctionsToRegister={}
 			end
 			luaclass.isExtendableFromLua=true
-			luaclass.defineInheritedIndexMetaMethods=true 
+			luaclass.defineInheritedIndexMetaMethods=true
 			-- TODO: need to add the metatable.__index fallback in the default __index and __newindex functions.
-			array.pushBack(luaclass.custumFunctionsToRegister, {'::Luna<'..cpp_parent_classname..' >::new_modified_T', 'new_modified_T'})
+			array.pushBack(luaclass.customFunctionsToRegister, {'::Luna<'..cpp_parent_classname..' >::new_modified_T', 'new_modified_T'})
 		end
 	end
 
@@ -940,7 +940,7 @@
 
 		if luaclass.ctors then -- parse ctor
 			luaclass.ctors=rectifyFunctions(luaclass.ctors)
-			for i, ctor in ipairs(luaclass.ctors) do 
+			for i, ctor in ipairs(luaclass.ctors) do
 				local arg=parseArg(luaclass.ctors[i])
 				if #arg==1 and arg[1].t=='void' then -- void a(void)  -> void a()
 					arg[1]=nil
@@ -958,10 +958,10 @@
 
 				local cc=string.lines(contents)
 				for i=1,#cc do
-					local s=string.find(cc[i],'//') 
+					local s=string.find(cc[i],'//')
 					if s then cc[i]=string.sub(cc[i], 1, s-1)  end -- remove comments
 				end
-				
+
 				for i=2,#mfff do
 					local funcName=mfff[i] -- {luaname, cppname}
 					local declFound
@@ -993,7 +993,7 @@
 			luaclass.memberFunctions=rectifyFunctions(luaclass.memberFunctions)
 
 			for i,v in ipairs(luaclass.memberFunctions) do
-				local vv=parseMemberFunction(v)	
+				local vv=parseMemberFunction(v)
 				luaclass.memberFunctions[i]=vv
 			end
 		end
@@ -1002,7 +1002,7 @@
 			luaclass.staticMemberFunctions=rectifyFunctions(luaclass.staticMemberFunctions)
 
 			for i,v in ipairs(luaclass.staticMemberFunctions) do
-				local vv=parseMemberFunction(v)	
+				local vv=parseMemberFunction(v)
 				luaclass.staticMemberFunctions[i]=vv
 			end
 		end
@@ -1027,8 +1027,8 @@
 			for i,v in ipairs(luaclass.allMemberFunctions) do
 				if #v.extended_args==1 and v.luaname=='__sub' then
 					v.luaname='__unm' -- this has to be negation
-					v.extended_args[2]=shallowCopyTable(v.extended_args[1])  
-					v.extended_args[2].n='self2' -- lua_gettop is 2 for __unm operator. A bit unintuitive. 
+					v.extended_args[2]=shallowCopyTable(v.extended_args[1])
+					v.extended_args[2].n='self2' -- lua_gettop is 2 for __unm operator. A bit unintuitive.
 				end
 
 				if v.ifndef then
@@ -1037,7 +1037,7 @@
 					v.if_='defined ('..v.ifdef..')'
 				end
 			end
-			
+
 			tagOverloadedFunctions(luaclass.allMemberFunctions)
 		end
 	end
@@ -1150,7 +1150,7 @@
 					addTypeCheck(vv.args);
 				end
 			end
-			
+
 			if luaclass.allMemberFunctions then
 				-- static members
 				for i,v in ipairs(luaclass.allMemberFunctions) do
@@ -1187,7 +1187,7 @@
 		do -- write members
 			for i,v in ipairs(luaclass.allMemberFunctions) do
 				local vv=luaclass.allMemberFunctions[i]
-		
+
 				addLine('  static int _bind_'..vv.luaname..'(lua_State *L)\n  {')
 
 				addParsedArg(vv, vv.extended_args)
@@ -1216,8 +1216,8 @@
 		end
 		collectDefinition(luaclass.allMemberFunctions)
 
-		if luaclass.custumFunctionsToRegister then
-			for i,v in ipairs(luaclass.custumFunctionsToRegister) do
+		if luaclass.customFunctionsToRegister then
+			for i,v in ipairs(luaclass.customFunctionsToRegister) do
 				if type(v)=='table' then
 					array.pushBack(functionsToRegister,{v[1],v[2]})
 				else
@@ -1250,7 +1250,7 @@
 			do
 				local lc=luaclass
 				while lc do
-					
+
 					local cppclass_name=normalizedClassNameToClassName(lc.className)
 					if lc.read_properties and #lc.read_properties>0 then
 						addLine([[
@@ -1261,7 +1261,7 @@
 						{
 							luna_mfp fnc=i->second;
 							lua_pop(L,1); // remove self
-							return fnc(L); 
+							return fnc(L);
 						}
 							}
 						]])
@@ -1293,16 +1293,16 @@
 					lua_rawget(L, -2);
 					return 1;
 					]])
-				
+
 				addLine([[
 			}]])
 
-			addLine([[ 
+			addLine([[
 			static int __newindex(lua_State* L) {]])
 			do
 				local lc=luaclass
 				while lc do
-					
+
 					local cppclass_name=normalizedClassNameToClassName(lc.className)
 					if lc.write_properties and #lc.write_properties>0 then
 						addLine([[
@@ -1312,7 +1312,7 @@
 							luna_mfp fnc=i->second;
 							lua_insert(L,2); // swap key and value
 							lua_settop(L,2); // delete key
-							return fnc(L); 
+							return fnc(L);
 						}
 						]])
 					end
@@ -1323,7 +1323,7 @@
 					end
 				end
 			end
-				
+
 				if luaclass.isExtendableFromLua then
 					addLine([[
 					luna_t::userdataType* u=luna_t::checkRaw(L,1);
@@ -1373,7 +1373,7 @@
 			addLine('  }')
 		end
 
-		
+
 		if luaclass.isModule then
 			addLine('const char '..cppinterface_name..'::moduleName[] = "'..luaclass_name..'";')
 		else
@@ -1456,17 +1456,17 @@
 			end
 		else
 			if luaclass.isModule then
-				addLine(codeDostring([[ 
-				if ]]..luaclass_name..[[==nil then 
+				addLine(codeDostring([[
+				if ]]..luaclass_name..[[==nil then
 					]]..luaclass_name..[[={}
-				end 
+				end
 				__luna.overwriteMethodsFrom(]]..	luaclass_name..[[, __luna.]].. luaclass.uniqueLuaClassname..[[)
 				]]))
 			else
 				addLine('	luna_dostring(L, "'..luaclass_name..'=__luna.'..luaclass.uniqueLuaClassname..'");')
 				addLine(codeDostring([[
 				__luna.]]..luaclass.uniqueLuaClassname..[[.luna_class=']]..luaclass_name..[[']]))
-			end	
+			end
 		end
 		if luaclass.inheritsFrom then
 			local pc= findLunaClassProperty({c=luaclass.inheritsFrom })
@@ -1488,7 +1488,7 @@
 								   addLine('  luna_dostring(L, stringStreams.str().c_str());\n}')
 							   end
 						   end
-						   
+
 		if luaclass.if_ then
 			addLine('#endif //'..luaclass.if_)
 		end
@@ -1516,6 +1516,6 @@
 		end
 	else
 		print('usage: lua luna_gen.lua input_file [options]')
-		print(' e.g. lua luna_gen.lua a.lua verbosecpp=true') 
+		print(' e.g. lua luna_gen.lua a.lua verbosecpp=true')
 	end
 end