Start of binding HGE scripting
authorHarley Laue <losinggeneration@gmail.com>
Mon, 22 Aug 2011 16:01:30 -0500
branchscripting
changeset 161 89f11a855a6a
parent 160 611dfa42cd91
child 162 91a8494db13a
Start of binding HGE
src/core/scripting/lua/binding/hge.lua
src/core/scripting/lua/binding/hgeBinding.lua
--- a/src/core/scripting/lua/binding/hge.lua	Mon Aug 22 15:13:47 2011 -0500
+++ b/src/core/scripting/lua/binding/hge.lua	Mon Aug 22 16:01:30 2011 -0500
@@ -6,6 +6,139 @@
 -- System layer API
 --
 
+bindhge = {
+	classes = {
+		{
+			name = 'hge',
+			className = 'HGE',
+			ctors = {
+				'()',
+			},
+			memberFunctions = {
+				{ rename = 'release', 'void Release();' },
+
+				{ rename = 'system_initiate', 'bool System_Initiate();' },
+				{ rename = 'system_shutdown', 'void System_Shutdown();' },
+				{ rename = 'system_start', 'bool System_Start();' },
+				{ rename = 'system_geterrormessage', 'const char* System_GetErrorMessage();' },
+				{ rename = 'system_log', 'void System_Log(const char *format, ...);' },
+				{ rename = 'system_launch', 'bool System_Launch(const char *url);' },
+				{ rename = 'system_snapshot', 'void System_Snapshot(const char *filename);' },
+
+				{ rename = 'system_set_bool_state', 'void System_SetState(hgeBoolState state, bool value);' },
+				{ rename = 'system_set_func_state', 'void System_SetState(hgeFuncState state, hgeCallback value);' },
+				{ rename = 'system_set_hwnd_state', 'void System_SetState(hgeHwndState state, HWND value);' },
+				{ rename = 'system_set_int_state', 'void System_SetState(hgeIntState state, int value);' },
+				{ rename = 'system_set_string_state', 'void System_SetState(hgeStringState state, const char *value);' },
+				{ rename = 'system_get_bool_state', 'bool System_GetState(hgeBoolState state);' },
+				{ rename = 'system_get_func_state', 'hgeCallback System_GetState(hgeFuncState state);' },
+				{ rename = 'system_get_hwnd_state', 'HWND System_GetState(hgeHwndState state);' },
+				{ rename = 'system_get_int_state', 'int System_GetState(hgeIntState state);' },
+				{ rename = 'system_get_string_state', 'const char* System_GetState(hgeStringState state);' },
+
+				{ rename = 'resource_load', 'void* Resource_Load(const char *filename, DWORD *size);' },
+				{ rename = 'resource_free', 'void Resource_Free(void *res);' },
+				{ rename = 'resource_attachpack', 'bool Resource_AttachPack(const char *filename, const char *password);' },
+				{ rename = 'resource_removepack', 'void Resource_RemovePack(const char *filename);' },
+				{ rename = 'resource_removeallpacks', 'void Resource_RemoveAllPacks();' },
+				{ rename = 'resource_makepath', 'char* Resource_MakePath(const char *filename);' },
+				{ rename = 'resource_enumfiles', 'char* Resource_EnumFiles(const char *wildcard);' },
+				{ rename = 'resource_enumfolders', 'char* Resource_EnumFolders(const char *wildcard);' },
+
+				{ rename = 'ini_setint', 'void Ini_SetInt(const char *section, const char *name, int value);' },
+				{ rename = 'ini_getint', 'int Ini_GetInt(const char *section, const char *name, int def_val);' },
+				{ rename = 'ini_setfloat', 'void Ini_SetFloat(const char *section, const char *name, float value);' },
+				{ rename = 'ini_getfloat', 'float Ini_GetFloat(const char *section, const char *name, float def_val);' },
+				{ rename = 'ini_setstring', 'void Ini_SetString(const char *section, const char *name, const char *value);' },
+				{ rename = 'ini_getstring', 'char* Ini_GetString(const char *section, const char *name, const char *def_val);' },
+
+				{ rename = 'random_seed', 'void Random_Seed(int seed);' },
+				{ rename = 'random_int', 'int Random_Int(int min, int max);' },
+				{ rename = 'random_float', 'float Random_Float(float min, float max);' },
+
+				{ rename = 'timer_gettime', 'float Timer_GetTime();' },
+				{ rename = 'timer_getdelta', 'float Timer_GetDelta();' },
+				{ rename = 'timer_getfps', 'int Timer_GetFPS();' },
+
+				{ rename = 'effect_load', 'HEFFECT Effect_Load(const char *filename, DWORD size);' },
+				{ rename = 'effect_free', 'void Effect_Free(HEFFECT eff);' },
+				{ rename = 'effect_play', 'HCHANNEL Effect_Play(HEFFECT eff);' },
+				{ rename = 'effect_playex', 'HCHANNEL Effect_PlayEx(HEFFECT eff, int volume, int pan, float pitch, bool loop);' },
+
+				{ rename = 'music_load', 'HMUSIC Music_Load(const char *filename, DWORD size);' },
+				{ rename = 'music_free', 'void Music_Free(HMUSIC mus);' },
+				{ rename = 'music_play', 'HCHANNEL Music_Play(HMUSIC mus, bool loop, int volume, int order, int row);' },
+				{ rename = 'music_setamplification', 'void Music_SetAmplification(HMUSIC music, int ampl);' },
+				{ rename = 'music_getamplification', 'int Music_GetAmplification(HMUSIC music);' },
+				{ rename = 'music_getlength', 'int Music_GetLength(HMUSIC music);' },
+				{ rename = 'music_setpos', 'void Music_SetPos(HMUSIC music, int order, int row);' },
+				{ rename = 'music_getpos', 'bool Music_GetPos(HMUSIC music, int *order, int *row);' },
+				{ rename = 'music_setinstrvolume', 'void Music_SetInstrVolume(HMUSIC music, int instr, int volume);' },
+				{ rename = 'music_getinstrvolume', 'int Music_GetInstrVolume(HMUSIC music, int instr);' },
+				{ rename = 'music_setchannelvolume', 'void Music_SetChannelVolume(HMUSIC music, int channel, int volume);' },
+				{ rename = 'music_getchannelvolume', 'int Music_GetChannelVolume(HMUSIC music, int channel);' },
+
+				{ rename = 'stream_load', 'HSTREAM Stream_Load(const char *filename, DWORD size);' },
+				{ rename = 'stream_free', 'void Stream_Free(HSTREAM stream);' },
+				{ rename = 'stream_play', 'HCHANNEL Stream_Play(HSTREAM stream, bool loop, int volume);' },
+
+				{ rename = 'channel_setpanning', 'void Channel_SetPanning(HCHANNEL chn, int pan);' },
+				{ rename = 'channel_setvolume', 'void Channel_SetVolume(HCHANNEL chn, int volume);' },
+				{ rename = 'channel_setpitch', 'void Channel_SetPitch(HCHANNEL chn, float pitch);' },
+				{ rename = 'channel_pause', 'void Channel_Pause(HCHANNEL chn);' },
+				{ rename = 'channel_resume', 'void Channel_Resume(HCHANNEL chn);' },
+				{ rename = 'channel_stop', 'void Channel_Stop(HCHANNEL chn);' },
+				{ rename = 'channel_pauseall', 'void Channel_PauseAll();' },
+				{ rename = 'channel_resumeall', 'void Channel_ResumeAll();' },
+				{ rename = 'channel_stopall', 'void Channel_StopAll();' },
+				{ rename = 'channel_isplaying', 'bool Channel_IsPlaying(HCHANNEL chn);' },
+				{ rename = 'channel_getlength', 'float Channel_GetLength(HCHANNEL chn);' },
+				{ rename = 'channel_getpos', 'float Channel_GetPos(HCHANNEL chn);' },
+				{ rename = 'channel_setpos', 'void Channel_SetPos(HCHANNEL chn, float fSeconds);' },
+				{ rename = 'channel_slideto', 'void Channel_SlideTo(HCHANNEL channel, float time, int volume, int pan, float pitch);' },
+				{ rename = 'channel_issliding', 'bool Channel_IsSliding(HCHANNEL channel);' },
+
+				{ rename = 'input_getmousepos', 'void Input_GetMousePos(float *x, float *y);' },
+				{ rename = 'input_setmousepos', 'void Input_SetMousePos(float x, float y);' },
+				{ rename = 'input_getmousewheel', 'int Input_GetMouseWheel();' },
+				{ rename = 'input_ismouseover', 'bool Input_IsMouseOver();' },
+				{ rename = 'input_keydown', 'bool Input_KeyDown(int key);' },
+				{ rename = 'input_keyup', 'bool Input_KeyUp(int key);' },
+				{ rename = 'input_getkeystate', 'bool Input_GetKeyState(int key);' },
+				{ rename = 'input_getkeyname', 'const char* Input_GetKeyName(int key);' },
+				{ rename = 'input_getkey', 'int Input_GetKey();' },
+				{ rename = 'input_getchar', 'int Input_GetChar();' },
+				{ rename = 'input_getevent', 'bool Input_GetEvent(hgeInputEvent *event);' },
+
+				{ rename = 'gfx_beginscene', 'bool Gfx_BeginScene(HTARGET target);' },
+				{ rename = 'gfx_endscene', 'void Gfx_EndScene();' },
+				{ rename = 'gfx_clear', 'void Gfx_Clear(DWORD color);' },
+				{ rename = 'gfx_renderline', 'void Gfx_RenderLine(float x1, float y1, float x2, float y2, DWORD color, float z);' },
+				{ rename = 'gfx_rendertriple', 'void Gfx_RenderTriple(const hgeTriple *triple);' },
+				{ rename = 'gfx_renderquad', 'void Gfx_RenderQuad(const hgeQuad *quad);' },
+				{ rename = 'gfx_startbatch', 'hgeVertex* Gfx_StartBatch(int prim_type, HTEXTURE tex, int blend, int *max_prim);' },
+				{ rename = 'gfx_finishbatch', 'void Gfx_FinishBatch(int nprim);' },
+				{ rename = 'gfx_setclipping', 'void Gfx_SetClipping(int x, int y, int w, int h);' },
+				{ rename = 'gfx_settransform', 'void Gfx_SetTransform(float x, float y, float dx, float dy, float rot, float hscale, float vscale);' },
+
+				{ rename = 'target_create', 'HTARGET Target_Create(int width, int height, bool zbuffer);' },
+				{ rename = 'target_free', 'void Target_Free(HTARGET target);' },
+				{ rename = 'target_gettexture', 'HTEXTURE Target_GetTexture(HTARGET target);' },
+
+				{ rename = 'texture_create', 'HTEXTURE Texture_Create(int width, int height);' },
+				{ rename = 'texture_load', 'HTEXTURE Texture_Load(const char *filename, DWORD size, bool bMipmap);' },
+				{ rename = 'texture_free', 'void Texture_Free(HTEXTURE tex);' },
+				{ rename = 'texture_getwidth', 'int Texture_GetWidth(HTEXTURE tex, bool bOriginal);' },
+				{ rename = 'texture_getheight', 'int Texture_GetHeight(HTEXTURE tex, bool bOriginal);' },
+				{ rename = 'texture_lock', 'DWORD* Texture_Lock(HTEXTURE tex, bool bReadOnly, int left, int top, int width, int height);' },
+				{ rename = 'textureunlock', 'void Texture_Unlock(HTEXTURE tex);' },
+			},
+		}
+	},
+	modules = {
+	}
+}
+
 --[[
 #define HGE_VERSION 0x181
 
--- a/src/core/scripting/lua/binding/hgeBinding.lua	Mon Aug 22 15:13:47 2011 -0500
+++ b/src/core/scripting/lua/binding/hgeBinding.lua	Mon Aug 22 16:01:30 2011 -0500
@@ -38,6 +38,7 @@
 		'hgeStrings',
 		'hgeVector',
 		'hgeResource', -- has members for sprite, animation, font, and others
+-- 		'hge',
 	}
 
 	hgeBuildDefinitionDB(files)