From 0b5d88d2332b91211ae03a3364397369d155e6ba Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 22 Apr 2008 15:55:50 +0000 Subject: - new layout of the projectM lib-dir. - PROJECTM_..._PLUS variable in config-....inc not needed anymore. - Support for projectM 1.1 (=1.10) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1030 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/projectM/0.9/projectM.pas | 590 --------------------- .../projectM/1.0/cwrapper/projectM-cwrapper.sln | 20 - .../projectM/1.0/cwrapper/projectM-cwrapper.vcproj | 207 -------- Game/Code/lib/projectM/1.0/cwrapper/projectM.cpp | 69 --- Game/Code/lib/projectM/1.0/cwrapper/projectM.h | 27 - Game/Code/lib/projectM/1.0/projectM.pas | 336 ------------ Game/Code/lib/projectM/cwrapper/Makefile.in | 30 ++ .../lib/projectM/cwrapper/projectM-cwrapper.cpp | 104 ++++ .../Code/lib/projectM/cwrapper/projectM-cwrapper.h | 65 +++ .../lib/projectM/cwrapper/projectM-cwrapper.sln | 20 + .../lib/projectM/cwrapper/projectM-cwrapper.vcproj | 208 ++++++++ Game/Code/lib/projectM/projectM-0_9.inc | 424 +++++++++++++++ Game/Code/lib/projectM/projectM-1_0.inc | 170 ++++++ Game/Code/lib/projectM/projectM.pas | 230 ++++++++ 14 files changed, 1251 insertions(+), 1249 deletions(-) delete mode 100644 Game/Code/lib/projectM/0.9/projectM.pas delete mode 100644 Game/Code/lib/projectM/1.0/cwrapper/projectM-cwrapper.sln delete mode 100644 Game/Code/lib/projectM/1.0/cwrapper/projectM-cwrapper.vcproj delete mode 100644 Game/Code/lib/projectM/1.0/cwrapper/projectM.cpp delete mode 100644 Game/Code/lib/projectM/1.0/cwrapper/projectM.h delete mode 100644 Game/Code/lib/projectM/1.0/projectM.pas create mode 100755 Game/Code/lib/projectM/cwrapper/Makefile.in create mode 100755 Game/Code/lib/projectM/cwrapper/projectM-cwrapper.cpp create mode 100755 Game/Code/lib/projectM/cwrapper/projectM-cwrapper.h create mode 100644 Game/Code/lib/projectM/cwrapper/projectM-cwrapper.sln create mode 100644 Game/Code/lib/projectM/cwrapper/projectM-cwrapper.vcproj create mode 100644 Game/Code/lib/projectM/projectM-0_9.inc create mode 100644 Game/Code/lib/projectM/projectM-1_0.inc create mode 100644 Game/Code/lib/projectM/projectM.pas (limited to 'Game/Code') diff --git a/Game/Code/lib/projectM/0.9/projectM.pas b/Game/Code/lib/projectM/0.9/projectM.pas deleted file mode 100644 index 5bf11061..00000000 --- a/Game/Code/lib/projectM/0.9/projectM.pas +++ /dev/null @@ -1,590 +0,0 @@ -unit projectM; - -{$IFDEF FPC} - {$IFNDEF win32} - {$LINKLIB libprojectM} - {$ENDIF} - {$MODE DELPHI} - {$PACKENUM 4} - {$PACKRECORDS C} -{$ENDIF} - -interface - -uses - SysUtils; - -const -{$IFDEF win32} - libprojectM = 'libprojectM'; -{$ELSE} - libprojectM = 'libprojectM.so'; -{$ENDIF} - -const - PROJECTM_VERSION = '0.99'; - PROJECTM_TITLE = 'projectM 0.99'; - -type - // 16bit non-interleaved data - TPCM16 = array[0..1, 0..511] of Smallint; - PPCM16 = ^TPCM16; - // 8bit non-interleaved data - TPCM8_512 = array[0..1, 0..511] of byte; - PPCM8_512 = ^TPCM8_512; - -{ Event types } -type - TProjectMEvent = integer; -const - PROJECTM_KEYUP = 0; - PROJECTM_KEYDOWN = 1; - PROJECTM_VIDEORESIZE = 2; - PROJECTM_VIDEOQUIT = 3; - PROJECTM_NONE = 4; - -{ Keycodes } -type - TProjectMKeycode = integer; -const - PROJECTM_K_RETURN = 0; - PROJECTM_K_RIGHT = 1; - PROJECTM_K_LEFT = 2; - PROJECTM_K_UP = 3; - PROJECTM_K_DOWN = 4; - PROJECTM_K_PAGEUP = 5; - PROJECTM_K_PAGEDOWN = 6; - PROJECTM_K_INSERT = 7; - PROJECTM_K_DELETE = 8; - PROJECTM_K_ESCAPE = 9; - PROJECTM_K_LSHIFT = 10; - PROJECTM_K_RSHIFT = 11; - PROJECTM_K_CAPSLOCK = 12; - PROJECTM_K_LCTRL = 13; - PROJECTM_K_HOME = 14; - PROJECTM_K_END = 15; - PROJECTM_K_BACKSPACE = 16; - - PROJECTM_K_F1 = 17; - PROJECTM_K_F2 = (PROJECTM_K_F1 + 1); - PROJECTM_K_F3 = (PROJECTM_K_F1 + 2); - PROJECTM_K_F4 = (PROJECTM_K_F1 + 3); - PROJECTM_K_F5 = (PROJECTM_K_F1 + 4); - PROJECTM_K_F6 = (PROJECTM_K_F1 + 5); - PROJECTM_K_F7 = (PROJECTM_K_F1 + 6); - PROJECTM_K_F8 = (PROJECTM_K_F1 + 7); - PROJECTM_K_F9 = (PROJECTM_K_F1 + 8); - PROJECTM_K_F10 = (PROJECTM_K_F1 + 9); - PROJECTM_K_F11 = (PROJECTM_K_F1 + 10); - PROJECTM_K_F12 = (PROJECTM_K_F1 + 11); - - PROJECTM_K_0 = 48; - PROJECTM_K_1 = (PROJECTM_K_0 + 1); - PROJECTM_K_2 = (PROJECTM_K_0 + 2); - PROJECTM_K_3 = (PROJECTM_K_0 + 3); - PROJECTM_K_4 = (PROJECTM_K_0 + 4); - PROJECTM_K_5 = (PROJECTM_K_0 + 5); - PROJECTM_K_6 = (PROJECTM_K_0 + 6); - PROJECTM_K_7 = (PROJECTM_K_0 + 7); - PROJECTM_K_8 = (PROJECTM_K_0 + 8); - PROJECTM_K_9 = (PROJECTM_K_0 + 9); - - { Upper case } - PROJECTM_K_A_UPPERCASE = 65; - PROJECTM_K_B_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 1); - PROJECTM_K_C_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 2); - PROJECTM_K_D_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 3); - PROJECTM_K_E_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 4); - PROJECTM_K_F_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 5); - PROJECTM_K_G_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 6); - PROJECTM_K_H_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 7); - PROJECTM_K_I_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 8); - PROJECTM_K_J_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 9); - PROJECTM_K_K_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 10); - PROJECTM_K_L_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 11); - PROJECTM_K_M_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 12); - PROJECTM_K_N_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 13); - PROJECTM_K_O_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 14); - PROJECTM_K_P_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 15); - PROJECTM_K_Q_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 16); - PROJECTM_K_R_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 17); - PROJECTM_K_S_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 18); - PROJECTM_K_T_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 19); - PROJECTM_K_U_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 20); - PROJECTM_K_V_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 21); - PROJECTM_K_W_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 22); - PROJECTM_K_X_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 23); - PROJECTM_K_Y_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 24); - PROJECTM_K_Z_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 25); - - { Lower case } - PROJECTM_K_a_LOWERCASE = 97; - PROJECTM_K_b_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 1); - PROJECTM_K_c_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 2); - PROJECTM_K_d_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 3); - PROJECTM_K_e_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 4); - PROJECTM_K_f_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 5); - PROJECTM_K_g_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 6); - PROJECTM_K_h_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 7); - PROJECTM_K_i_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 8); - PROJECTM_K_j_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 9); - PROJECTM_K_k_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 10); - PROJECTM_K_l_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 11); - PROJECTM_K_m_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 12); - PROJECTM_K_n_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 13); - PROJECTM_K_o_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 14); - PROJECTM_K_p_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 15); - PROJECTM_K_q_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 16); - PROJECTM_K_r_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 17); - PROJECTM_K_s_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 18); - PROJECTM_K_t_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 19); - PROJECTM_K_u_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 20); - PROJECTM_K_v_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 21); - PROJECTM_K_w_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 22); - PROJECTM_K_x_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 23); - PROJECTM_K_y_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 24); - PROJECTM_K_z_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 25); - - PROJECTM_K_NONE = (PROJECTM_K_z_LOWERCASE + 1); - -{ Modifiers } -type - TProjectMModifier = integer; -const - PROJECTM_KMOD_LSHIFT = 0; - PROJECTM_KMOD_RSHIFT = 1; - PROJECTM_KMOD_CAPS = 2; - PROJECTM_KMOD_LCTRL = 3; - PROJECTM_KMOD_RCTRL = 4; - -type - PProjectM = ^TProjectM; - TProjectM = class(TObject) - private - _pm: Pointer; - public - constructor Create(gx, gy: integer; fps: integer; - texsize: integer; width, height: integer; - presetsDir, fontsDir: string); - - procedure ResetGL(width, height: Integer); - procedure SetTitle(title: string); - procedure RenderFrame(); - - procedure AddPCMfloat(pcmData: PSingle; samples: integer); - procedure AddPCM16(pcmData: PPCM16); - procedure AddPCM16Data(pcmData: PSmallint; samples: Smallint); - procedure AddPCM8_512(pcmData: PPCM8_512); - - procedure RandomPreset(); - procedure PreviousPreset(); - procedure NextPreset(); - procedure ToggleShowPresetNames(); - - procedure KeyHandler(event: TProjectMEvent; - keycode: TProjectMKeycode; - modifier: TProjectMModifier); - - destructor Destroy(); override; - end; - -implementation - -uses -{$IFNDEF win32} - baseunix, -{$ENDIF} - OpenGL12; - - -{**************** INTERNAL SECTION ****************} - - -type - PPSingle = ^PSingle; - -type - _TContextType = Integer; -const - AGL_CONTEXT = 0; - CGL_CONTEXT = 1; - NSGL_CONTEXT = 2; - GLX_CONTEXT = 3; - WGL_CONTEXT = 4; - -type - _PRenderTarget = ^_TRenderTarget; - _TRenderTarget = record - { Texture size } - texsize: Integer; - - { Application context } - origContextType: _TContextType; - - usePbuffers: Integer; - - {$ifdef LINUX} - lock_func: procedure(); cdecl; - unlock_func: procedure(); cdecl; - {$endif} - - { Opaque pbuffer context and pbuffer } - {$ifdef MACOS} - origContext: Pointer; - pbufferContext: Pointer; - pbuffer: Pointer; - {$endif} - - { Render target texture ID for non-pbuffer systems } - textureID: array[0..2] of TGLuint; - end; - - _PProjectM = ^_TProjectM; - _TProjectM = record - presetURL: PChar; - presetName: PChar; - fontURL: PChar; - - hasInit: Integer; - - noSwitch: Integer; - pcmframes: Integer; - freqframes: Integer; - totalframes: Integer; - - showfps: Integer; - showtitle: Integer; - showpreset: Integer; - showhelp: Integer; - showstats: Integer; - - studio: Integer; - - fbuffer: PGLubyte; - - {$ifndef Win32} - { The first ticks value of the application } - startTime: timeval; - {$else} - startTime: Longint; - {$endif Win32} - Time: Single; - - { Render target texture ID } - renderTarget: _PRenderTarget; - - disp: array[0..79] of Char; - - wave_o: Single; - - //int texsize=1024; //size of texture to do actual graphics - fvw: Integer; //fullscreen dimensions - fvh: Integer; - wvw: Integer; //windowed dimensions - wvh: Integer; - vw: Integer; //runtime dimensions - vh: Integer; - fullscreen: Integer; - - maxsamples: Integer; //size of PCM buffer - numsamples: Integer; //size of new PCM info - pcmdataL: PSingle; //holder for most recent pcm data - pcmdataR: PSingle; //holder for most recent pcm data - - avgtime: Integer; //# frames per preset - - title: PChar; - drawtitle: Integer; - - correction: Integer; - - vol: Single; - - //per pixel equation variables - gridx: PPSingle; //grid containing interpolated mesh - gridy: PPSingle; - origtheta: PPSingle; //grid containing interpolated mesh reference values - origrad: PPSingle; - origx: PPSingle; //original mesh - origy: PPSingle; - origx2: PPSingle; //original mesh - origy2: PPSingle; - - { Timing information } - mspf: Integer; - timed: Integer; - timestart: Integer; - nohard: Integer; - count: Integer; - realfps, - fpsstart: Single; - - { PCM data } - vdataL: array[0..511] of Single; //holders for FFT data (spectrum) - vdataR: array[0..511] of Single; - - { Various toggles } - doPerPixelEffects: Integer; - doIterative: Integer; - - { ENGINE VARIABLES } - { From engine_vars.h } - preset_name: array[0..255] of Char; - - { PER FRAME CONSTANTS BEGIN } - zoom: Single; - zoomexp: Single; - rot: Single; - warp: Single; - - sx: Single; - sy: Single; - dx: Single; - dy: Single; - cx: Single; - cy: Single; - - gy: Integer; - gx: Integer; - - decay: Single; - - wave_r: Single; - wave_g: Single; - wave_b: Single; - wave_x: Single; - wave_y: Single; - wave_mystery: Single; - - ob_size: Single; - ob_r: Single; - ob_g: Single; - ob_b: Single; - ob_a: Single; - - ib_size: Single; - ib_r: Single; - ib_g: Single; - ib_b: Single; - ib_a: Single; - - meshx: Integer; - meshy: Integer; - - mv_a: Single; - mv_r: Single; - mv_g: Single; - mv_b: Single; - mv_l: Single; - mv_x: Single; - mv_y: Single; - mv_dy: Single; - mv_dx: Single; - - treb: Single; - mid: Single; - bass: Single; - bass_old: Single; - beat_sensitivity: Single; - treb_att: Single; - mid_att: Single; - bass_att: Single; - progress: Single; - frame: Integer; - - { PER_FRAME CONSTANTS END } - - { PER_PIXEL CONSTANTS BEGIN } - - x_per_pixel: Single; - y_per_pixel: Single; - rad_per_pixel: Single; - ang_per_pixel: Single; - - { PER_PIXEL CONSTANT END } - - - fRating: Single; - fGammaAdj: Single; - fVideoEchoZoom: Single; - fVideoEchoAlpha: Single; - - nVideoEchoOrientation: Integer; - nWaveMode: Integer; - bAdditiveWaves: Integer; - bWaveDots: Integer; - bWaveThick: Integer; - bModWaveAlphaByVolume: Integer; - bMaximizeWaveColor: Integer; - bTexWrap: Integer; - bDarkenCenter: Integer; - bRedBlueStereo: Integer; - bBrighten: Integer; - bDarken: Integer; - bSolarize: Integer; - bInvert: Integer; - bMotionVectorsOn: Integer; - fps: Integer; - - fWaveAlpha: Single; - fWaveScale: Single; - fWaveSmoothing: Single; - fWaveParam: Single; - fModWaveAlphaStart: Single; - fModWaveAlphaEnd: Single; - fWarpAnimSpeed: Single; - fWarpScale: Single; - fShader: Single; - - - { Q VARIABLES START } - - q1: Single; - q2: Single; - q3: Single; - q4: Single; - q5: Single; - q6: Single; - q7: Single; - q8: Single; - - - { Q VARIABLES END } - - zoom_mesh: PPSingle; - zoomexp_mesh: PPSingle; - rot_mesh: PPSingle; - - sx_mesh: PPSingle; - sy_mesh: PPSingle; - dx_mesh: PPSingle; - dy_mesh: PPSingle; - cx_mesh: PPSingle; - cy_mesh: PPSingle; - - x_mesh: PPSingle; - y_mesh: PPSingle; - rad_mesh: PPSingle; - theta_mesh: PPSingle; - end; - -{ projectM.h declarations } -procedure _projectM_init(pm: _PProjectM); cdecl; external libprojectM name 'projectM_init'; -procedure _projectM_reset(pm: _PProjectM); cdecl; external libprojectM name 'projectM_reset'; -procedure _projectM_resetGL(pm: _PProjectM; width: Integer; height: Integer); cdecl; external libprojectM name 'projectM_resetGL'; -procedure _projectM_setTitle(pm: _PProjectM; title: PChar); cdecl; external libprojectM name 'projectM_setTitle'; -procedure _renderFrame(pm: _PProjectM); cdecl; external libprojectM name 'renderFrame'; - -{ PCM.h declarations } -procedure _addPCMfloat(pcm_data: PSingle; samples: integer); cdecl; external libprojectM name 'addPCMfloat'; -procedure _addPCM16(pcm_data: PPCM16); cdecl; external libprojectM name 'addPCM16'; -procedure _addPCM16Data(pcm_data: PSmallint; samples: Smallint); cdecl; external libprojectM name 'addPCM16Data'; -procedure _addPCM8_512(pcm_data: PPCM8_512); cdecl; external libprojectM name 'addPCM8'; - -{ console_interface.h declarations } -procedure _key_handler(pm: _PProjectM; - event: TProjectMEvent; - keycode: TProjectMKeycode; - modifier: TProjectMModifier); cdecl; external libprojectM name 'key_handler'; - - - - -{**************** EXTERNAL SECTION ****************} - - -constructor TProjectM.Create(gx, gy: integer; fps: integer; - texsize: integer; width, height: integer; - presetsDir, fontsDir: string); -var - pm: _PProjectM; -begin - New(pm); - _pm := pm; - _projectM_reset(pm); - - pm^.fullscreen := 0; - pm^.renderTarget^.texsize := texsize; - pm^.gx := gx; - pm^.gy := gy; - pm^.fps := fps; - pm^.renderTarget^.usePbuffers := 0; - - pm^.fontURL := PChar(fontsDir); - pm^.presetURL := PChar(presetsDir); - - _projectM_init(pm); -end; - -procedure TProjectM.ResetGL(width, height: Integer); -begin - _projectM_resetGL(_pm, width, height); -end; - -procedure TProjectM.SetTitle(title: string); -var pm: _PProjectM; -begin - pm := _pm; - pm^.title := PChar(title); - pm^.showtitle := 1; -end; - -procedure TProjectM.RenderFrame(); -begin - _renderFrame(_pm); -end; - -procedure TProjectM.AddPCMfloat(pcmData: PSingle; samples: integer); -begin - _addPCMfloat(pcmData, samples); -end; - -procedure TProjectM.AddPCM16(pcmData: PPCM16); -begin - _addPCM16(pcmData); -end; - -procedure TProjectM.AddPCM16Data(pcmData: PSmallint; samples: Smallint); -begin - _addPCM16Data(pcmData, samples); -end; - -procedure TProjectM.AddPCM8_512(pcmData: PPCM8_512); -begin - _addPCM8_512(pcmData); -end; - -procedure TProjectM.KeyHandler(event: TProjectMEvent; - keycode: TProjectMKeycode; - modifier: TProjectMModifier); -begin - _key_handler(_pm, event, keycode, modifier); -end; - -procedure TProjectM.RandomPreset(); -begin - KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_r_LOWERCASE, PROJECTM_KMOD_LSHIFT); -end; - -procedure TProjectM.PreviousPreset(); -begin - KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_p_LOWERCASE, PROJECTM_KMOD_LSHIFT); -end; - -procedure TProjectM.NextPreset(); -begin - KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_n_LOWERCASE, PROJECTM_KMOD_LSHIFT); -end; - -procedure TProjectM.ToggleShowPresetNames(); -begin - KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_F3, PROJECTM_KMOD_LSHIFT); -end; - -destructor TProjectM.Destroy(); -begin - Dispose(_PProjectM(_pm)); - _pm := nil; -end; - -end. diff --git a/Game/Code/lib/projectM/1.0/cwrapper/projectM-cwrapper.sln b/Game/Code/lib/projectM/1.0/cwrapper/projectM-cwrapper.sln deleted file mode 100644 index e05f79a3..00000000 --- a/Game/Code/lib/projectM/1.0/cwrapper/projectM-cwrapper.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "projectM-cwrapper", "projectM-cwrapper.vcproj", "{8E653284-12F3-4A90-9D0D-4195557051F7}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8E653284-12F3-4A90-9D0D-4195557051F7}.Debug|Win32.ActiveCfg = Debug|Win32 - {8E653284-12F3-4A90-9D0D-4195557051F7}.Debug|Win32.Build.0 = Debug|Win32 - {8E653284-12F3-4A90-9D0D-4195557051F7}.Release|Win32.ActiveCfg = Release|Win32 - {8E653284-12F3-4A90-9D0D-4195557051F7}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Game/Code/lib/projectM/1.0/cwrapper/projectM-cwrapper.vcproj b/Game/Code/lib/projectM/1.0/cwrapper/projectM-cwrapper.vcproj deleted file mode 100644 index 9c182cac..00000000 --- a/Game/Code/lib/projectM/1.0/cwrapper/projectM-cwrapper.vcproj +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Game/Code/lib/projectM/1.0/cwrapper/projectM.cpp b/Game/Code/lib/projectM/1.0/cwrapper/projectM.cpp deleted file mode 100644 index ff8e2a2f..00000000 --- a/Game/Code/lib/projectM/1.0/cwrapper/projectM.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "projectM.h" - -projectM* projectM_create1(char* config_file) -{ - return new projectM(config_file); -} - -projectM* projectM_create2(int gx, int gy, int fps, int texsize, - int width, int height, char* preset_url, char* title_fonturl, char* title_menuurl) -{ - return new projectM(gx, gy, fps, texsize, width, height, - preset_url, title_fonturl, title_menuurl); -} - -void projectM_resetGL(projectM* pm, int width, int height) -{ - pm->projectM_resetGL(width, height); -} - -void projectM_setTitle(projectM* pm, char* title) -{ - pm->projectM_setTitle(title); -} - -void projectM_renderFrame(projectM* pm) -{ - pm->renderFrame(); -} - -unsigned projectM_initRenderToTexture(projectM* pm) -{ - return pm->initRenderToTexture(); -} - -void projectM_key_handler(projectM* pm, projectMEvent event, - projectMKeycode keycode, projectMModifier modifier) -{ - pm->key_handler(event, keycode, modifier); -} - -void projectM_free(projectM* pm) -{ - delete pm; -} - -void PCM_addPCMfloat(projectM* pm, float *PCMdata, int samples) -{ - pm->pcm->addPCMfloat(PCMdata, samples); -} - -void PCM_addPCM16(projectM* pm, short pcm_data[2][512]) -{ - pm->pcm->addPCM16(pcm_data); -} - -void PCM_addPCM16Data(projectM* pm, const short* pcm_data, short samples) -{ - pm->pcm->addPCM16Data(pcm_data, samples); -} - -void PCM_addPCM8(projectM* pm, unsigned char pcm_data[2][1024]) -{ - pm->pcm->addPCM8(pcm_data); -} - -void PCM_addPCM8_512(projectM* pm, const unsigned char pcm_data[2][512]) -{ - pm->pcm->addPCM8_512(pcm_data); -} diff --git a/Game/Code/lib/projectM/1.0/cwrapper/projectM.h b/Game/Code/lib/projectM/1.0/cwrapper/projectM.h deleted file mode 100644 index a64f2666..00000000 --- a/Game/Code/lib/projectM/1.0/cwrapper/projectM.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __PROJECTM_CWRAPPER_H__ -#define __PROJECTM_CWRAPPER_H__ - -#include "projectM.hpp" - -extern "C" { - DLLEXPORT projectM* projectM_create1(char* config_file); - DLLEXPORT projectM* projectM_create2(int gx, int gy, int fps, int texsize, - int width, int height, char* preset_url, char* title_fonturl, char* title_menuurl); - - DLLEXPORT void projectM_resetGL(projectM* pm, int width, int height); - DLLEXPORT void projectM_setTitle(projectM* pm, char* title); - DLLEXPORT void projectM_renderFrame(projectM* pm); - DLLEXPORT unsigned projectM_initRenderToTexture(projectM* pm); - DLLEXPORT void projectM_key_handler(projectM* pm, projectMEvent event, - projectMKeycode keycode, projectMModifier modifier); - - DLLEXPORT void projectM_free(projectM* pm); - - DLLEXPORT void PCM_addPCMfloat(projectM* pm, float *PCMdata, int samples); - DLLEXPORT void PCM_addPCM16(projectM* pm, short [2][512]); - DLLEXPORT void PCM_addPCM16Data(projectM* pm, const short* pcm_data, short samples); - DLLEXPORT void PCM_addPCM8(projectM* pm, unsigned char [2][1024]); - DLLEXPORT void PCM_addPCM8_512(projectM* pm, const unsigned char [2][512]); -} - -#endif \ No newline at end of file diff --git a/Game/Code/lib/projectM/1.0/projectM.pas b/Game/Code/lib/projectM/1.0/projectM.pas deleted file mode 100644 index 47da36cc..00000000 --- a/Game/Code/lib/projectM/1.0/projectM.pas +++ /dev/null @@ -1,336 +0,0 @@ -unit projectM; - -{$IFDEF FPC} - {$IFNDEF win32} - {$LINKLIB libprojectM} - {$ENDIF} - {$MODE DELPHI} - {$PACKENUM 4} - {$PACKRECORDS C} -{$ENDIF} - -interface - -uses - OpenGL12; - -const -{$IFDEF win32} - libprojectM = 'projectM-cwrapper.dll'; -{$ELSE} - libprojectM = 'libprojectM-cwrapper.so'; -{$ENDIF} - -const - PROJECTM_VERSION = '1.00.00'; - PROJECTM_TITLE = 'projectM 1.00.00'; - -type - // 16bit non-interleaved data - TPCM16 = array[0..1, 0..511] of Smallint; - PPCM16 = ^TPCM16; - // 8bit non-interleaved data (512 samples) - TPCM8_512 = array[0..1, 0..511] of byte; - PPCM8_512 = ^TPCM8_512; - // 8bit non-interleaved data (1024 samples) - TPCM8_1024 = array[0..1, 0..1023] of byte; - PPCM8_1024 = ^TPCM8_512; - -{ Event types } -type - TProjectMEvent = integer; -const - PROJECTM_KEYUP = 0; - PROJECTM_KEYDOWN = 1; - PROJECTM_VIDEORESIZE = 2; - PROJECTM_VIDEOQUIT = 3; - PROJECTM_NONE = 4; - -{ Keycodes } -type - TProjectMKeycode = integer; -const - PROJECTM_K_RETURN = 0; - PROJECTM_K_RIGHT = 1; - PROJECTM_K_LEFT = 2; - PROJECTM_K_UP = 3; - PROJECTM_K_DOWN = 4; - PROJECTM_K_PAGEUP = 5; - PROJECTM_K_PAGEDOWN = 6; - PROJECTM_K_INSERT = 7; - PROJECTM_K_DELETE = 8; - PROJECTM_K_ESCAPE = 9; - PROJECTM_K_LSHIFT = 10; - PROJECTM_K_RSHIFT = 11; - PROJECTM_K_CAPSLOCK = 12; - PROJECTM_K_LCTRL = 13; - PROJECTM_K_HOME = 14; - PROJECTM_K_END = 15; - PROJECTM_K_BACKSPACE = 16; - - PROJECTM_K_F1 = 17; - PROJECTM_K_F2 = (PROJECTM_K_F1 + 1); - PROJECTM_K_F3 = (PROJECTM_K_F1 + 2); - PROJECTM_K_F4 = (PROJECTM_K_F1 + 3); - PROJECTM_K_F5 = (PROJECTM_K_F1 + 4); - PROJECTM_K_F6 = (PROJECTM_K_F1 + 5); - PROJECTM_K_F7 = (PROJECTM_K_F1 + 6); - PROJECTM_K_F8 = (PROJECTM_K_F1 + 7); - PROJECTM_K_F9 = (PROJECTM_K_F1 + 8); - PROJECTM_K_F10 = (PROJECTM_K_F1 + 9); - PROJECTM_K_F11 = (PROJECTM_K_F1 + 10); - PROJECTM_K_F12 = (PROJECTM_K_F1 + 11); - - PROJECTM_K_0 = 48; - PROJECTM_K_1 = (PROJECTM_K_0 + 1); - PROJECTM_K_2 = (PROJECTM_K_0 + 2); - PROJECTM_K_3 = (PROJECTM_K_0 + 3); - PROJECTM_K_4 = (PROJECTM_K_0 + 4); - PROJECTM_K_5 = (PROJECTM_K_0 + 5); - PROJECTM_K_6 = (PROJECTM_K_0 + 6); - PROJECTM_K_7 = (PROJECTM_K_0 + 7); - PROJECTM_K_8 = (PROJECTM_K_0 + 8); - PROJECTM_K_9 = (PROJECTM_K_0 + 9); - - { Upper case } - PROJECTM_K_A_UPPERCASE = 65; - PROJECTM_K_B_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 1); - PROJECTM_K_C_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 2); - PROJECTM_K_D_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 3); - PROJECTM_K_E_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 4); - PROJECTM_K_F_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 5); - PROJECTM_K_G_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 6); - PROJECTM_K_H_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 7); - PROJECTM_K_I_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 8); - PROJECTM_K_J_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 9); - PROJECTM_K_K_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 10); - PROJECTM_K_L_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 11); - PROJECTM_K_M_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 12); - PROJECTM_K_N_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 13); - PROJECTM_K_O_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 14); - PROJECTM_K_P_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 15); - PROJECTM_K_Q_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 16); - PROJECTM_K_R_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 17); - PROJECTM_K_S_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 18); - PROJECTM_K_T_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 19); - PROJECTM_K_U_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 20); - PROJECTM_K_V_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 21); - PROJECTM_K_W_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 22); - PROJECTM_K_X_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 23); - PROJECTM_K_Y_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 24); - PROJECTM_K_Z_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 25); - - { Lower case } - PROJECTM_K_a_LOWERCASE = 97; - PROJECTM_K_b_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 1); - PROJECTM_K_c_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 2); - PROJECTM_K_d_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 3); - PROJECTM_K_e_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 4); - PROJECTM_K_f_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 5); - PROJECTM_K_g_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 6); - PROJECTM_K_h_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 7); - PROJECTM_K_i_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 8); - PROJECTM_K_j_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 9); - PROJECTM_K_k_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 10); - PROJECTM_K_l_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 11); - PROJECTM_K_m_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 12); - PROJECTM_K_n_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 13); - PROJECTM_K_o_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 14); - PROJECTM_K_p_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 15); - PROJECTM_K_q_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 16); - PROJECTM_K_r_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 17); - PROJECTM_K_s_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 18); - PROJECTM_K_t_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 19); - PROJECTM_K_u_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 20); - PROJECTM_K_v_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 21); - PROJECTM_K_w_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 22); - PROJECTM_K_x_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 23); - PROJECTM_K_y_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 24); - PROJECTM_K_z_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 25); - - PROJECTM_K_NONE = (PROJECTM_K_z_LOWERCASE + 1); - -{ Modifiers } -type - TProjectMModifier = integer; -const - PROJECTM_KMOD_LSHIFT = 0; - PROJECTM_KMOD_RSHIFT = 1; - PROJECTM_KMOD_CAPS = 2; - PROJECTM_KMOD_LCTRL = 3; - PROJECTM_KMOD_RCTRL = 4; - - -type - PProjectM = ^TProjectM; - TProjectM = class(TObject) - private - _pm: Pointer; - public - constructor Create(gx, gy: integer; fps: integer; - texsize: integer; width, height: integer; - presetsDir, fontsDir: string; - titleFont: string = 'Vera.ttf'; - menuFont: string = 'Vera.ttf'); overload; - constructor Create(configFile: string); overload; - - procedure ResetGL(width, height: Integer); - procedure SetTitle(title: string); - procedure RenderFrame(); - - procedure AddPCMfloat(pcmData: PSingle; samples: integer); - procedure AddPCM16(pcmData: PPCM16); - procedure AddPCM16Data(pcmData: PSmallint; samples: Smallint); - procedure AddPCM8_512(pcmData: PPCM8_512); - procedure AddPCM8_1024(pcmData: PPCM8_1024); - - procedure RandomPreset(); - procedure PreviousPreset(); - procedure NextPreset(); - procedure ToggleShowPresetNames(); - - function InitRenderToTexture(): GLuint; - - procedure KeyHandler(event: TProjectMEvent; - keycode: TProjectMKeycode; - modifier: TProjectMModifier); - - destructor Destroy(); override; - end; - -implementation - - -{**************** INTERNAL SECTION ****************} - - -type - _PProjectM = Pointer; - -{ projectM.hpp declarations } -function _projectM_create1(config_file: PChar): _PProjectM; cdecl; external libprojectM name 'projectM_create1'; -function _projectM_create2(gx: integer; gy: integer; fps: integer; - texsize: integer; width: integer; height: integer; - preset_url: PChar; title_fonturl: PChar; title_menuurl: PChar): _PProjectM; cdecl; external libprojectM name 'projectM_create2'; - -procedure _projectM_resetGL(pm: _PProjectM; width: integer; height: integer); cdecl; external libprojectM name 'projectM_resetGL'; -procedure _projectM_setTitle(pm: _PProjectM; title: PChar); cdecl; external libprojectM name 'projectM_setTitle'; -procedure _projectM_renderFrame(pm: _PProjectM); cdecl; external libprojectM name 'projectM_renderFrame'; -function _projectM_initRenderToTexture(pm: _PProjectM): Cardinal; cdecl; external libprojectM name 'projectM_initRenderToTexture'; - -procedure _projectM_free(pm: _PProjectM); cdecl; external libprojectM name 'projectM_free'; - -procedure _projectM_key_handler(pm: _PProjectM; event: TProjectMEvent; - keycode: TProjectMKeycode; modifier: TProjectMModifier); cdecl; external libprojectM name 'projectM_key_handler'; - -{ PCM.hpp declarations } -procedure _PCM_addPCMfloat(pm: _PProjectM; pcm_data: PSingle; samples: integer); cdecl; external libprojectM name 'PCM_addPCMfloat'; -procedure _PCM_addPCM16(pm: _PProjectM; pcm_data: PPCM16); cdecl; external libprojectM name 'PCM_addPCM16'; -procedure _PCM_addPCM16Data(pm: _PProjectM; pcm_data: PSmallint; samples: Smallint); cdecl; external libprojectM name 'PCM_addPCM16Data'; -procedure _PCM_addPCM8_512(pm: _PProjectM; pcm_data: PPCM8_512); cdecl; external libprojectM name 'PCM_addPCM8_512'; -procedure _PCM_addPCM8_1024(pm: _PProjectM; pcm_data: PPCM8_1024); cdecl; external libprojectM name 'PCM_addPCM8'; - - -{**************** EXTERNAL SECTION ****************} - -constructor TProjectM.Create(gx, gy: integer; fps: integer; - texsize: integer; width, height: integer; - presetsDir, fontsDir: string; titleFont, menuFont: string); -begin - _pm := _projectM_create2(gx, gy, fps, texsize, width, height, - PChar(presetsDir), - PChar(fontsDir + '/' + titleFont), - PChar(fontsDir + '/' + menuFont)) -end; - -constructor TProjectM.Create(configFile: string); -begin - _pm := _projectM_create1(PChar(configFile)); -end; - -procedure TProjectM.ResetGL(width, height: Integer); -begin - _projectM_resetGL(_pm, width, height); -end; - -procedure TProjectM.SetTitle(title: string); -begin - _projectM_setTitle(_pm, PChar(title)); -end; - -procedure TProjectM.RenderFrame(); -begin - _projectM_renderFrame(_pm); -end; - -procedure TProjectM.AddPCMfloat(pcmData: PSingle; samples: integer); -begin - _PCM_addPCMfloat(_pm, pcmData, samples); -end; - -procedure TProjectM.AddPCM16(pcmData: PPCM16); -begin - _PCM_addPCM16(_pm, pcmData); -end; - -{** - * Passes interleaved stereo PCM-samples to projectM. - *} -procedure TProjectM.AddPCM16Data(pcmData: PSmallint; samples: Smallint); -begin - _PCM_addPCM16Data(_pm, pcmData, samples); -end; - -procedure TProjectM.AddPCM8_512(pcmData: PPCM8_512); -begin - _PCM_addPCM8_512(_pm, pcmData); -end; - -procedure TProjectM.AddPCM8_1024(pcmData: PPCM8_1024); -begin - _PCM_addPCM8_1024(_pm, pcmData); -end; - -{** - * If the result is > -1 projectM will render to a texture. - * The texture-ID is the return-value. - *} -function TProjectM.InitRenderToTexture(): GLuint; -begin - result := _projectM_initRenderToTexture(_pm); -end; - -procedure TProjectM.KeyHandler(event: TProjectMEvent; - keycode: TProjectMKeycode; - modifier: TProjectMModifier); -begin - _projectM_key_handler(_pm, event, keycode, modifier); -end; - -procedure TProjectM.RandomPreset(); -begin - KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_r_LOWERCASE, PROJECTM_KMOD_LSHIFT); -end; - -procedure TProjectM.PreviousPreset(); -begin - KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_p_LOWERCASE, PROJECTM_KMOD_LSHIFT); -end; - -procedure TProjectM.NextPreset(); -begin - KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_n_LOWERCASE, PROJECTM_KMOD_LSHIFT); -end; - -procedure TProjectM.ToggleShowPresetNames(); -begin - KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_F3, PROJECTM_KMOD_LSHIFT); -end; - -destructor TProjectM.Destroy(); -begin - _projectM_free(_pm); - _pm := nil; -end; - -end. diff --git a/Game/Code/lib/projectM/cwrapper/Makefile.in b/Game/Code/lib/projectM/cwrapper/Makefile.in new file mode 100755 index 00000000..d2be8613 --- /dev/null +++ b/Game/Code/lib/projectM/cwrapper/Makefile.in @@ -0,0 +1,30 @@ +OBJECTS = projectM-cwrapper.o +LIBRARY = libprojectM-cwrapper.a + +CXX = @CXX@ +CXXFLAGS += @CXXFLAGS@ +INCLUDES = -I@libprojectM_INCLUDEDIR@/libprojectM +DEFINES = -DPROJECTM_VERSION_INT=@libprojectM_VERSION_INT@ +RANLIB = @RANLIB@ + +.PHONY: all clean distclean strip + +all : $(LIBRARY) + +$(LIBRARY): $(OBJECTS) + ar ruv $(LIBRARY) $(OBJECTS) + $(RANLIB) $(LIBRARY) + +%.o : %.cpp + $(CXX) $(CXXFLAGS) $(DEFINES) $(INCLUDES) -c $(<) -o $@ + +clean : + rm -f $(LIBRARY) + rm -f $(OBJECTS) + +distclean: clean + rm -rf Makefile + +strip : + strip $(LIBRARY) + $(RANLIB) $(LIBRARY) diff --git a/Game/Code/lib/projectM/cwrapper/projectM-cwrapper.cpp b/Game/Code/lib/projectM/cwrapper/projectM-cwrapper.cpp new file mode 100755 index 00000000..4b81130d --- /dev/null +++ b/Game/Code/lib/projectM/cwrapper/projectM-cwrapper.cpp @@ -0,0 +1,104 @@ +#include "projectM-cwrapper.h" + +#define PM_CLASS(pm) ((projectM*)pm) + +#if (PROJECTM_VERSION_INT >= 1010000) +#define PM_PCM(pm) (PM_CLASS(pm)->pcm()) +#else +#define PM_PCM(pm) (PM_CLASS(pm)->pcm) +#endif + +projectM_ptr projectM_create1(char* config_file) +{ + return projectM_ptr(new projectM(config_file)); +} + +#if (PROJECTM_VERSION_INT < 1010000) +projectM_ptr projectM_create2(int gx, int gy, int fps, int texsize, + int width, int height, char* preset_url, + char* title_fonturl, char* title_menuurl) +{ + return projectM_ptr(new projectM(gx, gy, fps, texsize, width, height, + preset_url, title_fonturl, title_menuurl));} +#endif + +void projectM_resetGL(projectM_ptr pm, int width, int height) +{ + PM_CLASS(pm)->projectM_resetGL(width, height); +} + +void projectM_setTitle(projectM_ptr pm, char* title) +{ + PM_CLASS(pm)->projectM_setTitle(title); +} + +void projectM_renderFrame(projectM_ptr pm) +{ + PM_CLASS(pm)->renderFrame(); +} + +unsigned projectM_initRenderToTexture(projectM_ptr pm) +{ + return PM_CLASS(pm)->initRenderToTexture(); +} + +void projectM_key_handler(projectM_ptr pm, projectMEvent event, + projectMKeycode keycode, projectMModifier modifier) +{ + PM_CLASS(pm)->key_handler(event, keycode, modifier); +} + +void projectM_free(projectM_ptr pm) +{ + delete PM_CLASS(pm); +} + +void PCM_addPCMfloat(projectM_ptr pm, float *PCMdata, int samples) +{ + PM_PCM(pm)->addPCMfloat(PCMdata, samples); +} + +void PCM_addPCM16(projectM_ptr pm, short pcm_data[2][512]) +{ + PM_PCM(pm)->addPCM16(pcm_data); +} + +void PCM_addPCM16Data(projectM_ptr pm, const short* pcm_data, short samples) +{ + PM_PCM(pm)->addPCM16Data(pcm_data, samples); +} + +void PCM_addPCM8(projectM_ptr pm, unsigned char pcm_data[2][1024]) +{ + PM_PCM(pm)->addPCM8(pcm_data); +} + +void PCM_addPCM8_512(projectM_ptr pm, const unsigned char pcm_data[2][512]) +{ + PM_PCM(pm)->addPCM8_512(pcm_data); +} + +#define COPY_FIELD(c_ptr, s, fld) (c_ptr->fld = s.fld) + +#if (PROJECTM_VERSION_INT >= 1010000) +void projectM_settings(projectM_ptr pm, Settings* settings) +{ + const projectM::Settings& pmSettings = PM_CLASS(pm)->settings(); + + COPY_FIELD(settings, pmSettings, meshX); + COPY_FIELD(settings, pmSettings, meshY); + COPY_FIELD(settings, pmSettings, fps); + COPY_FIELD(settings, pmSettings, textureSize); + COPY_FIELD(settings, pmSettings, windowWidth); + COPY_FIELD(settings, pmSettings, windowHeight); + settings->presetURL = pmSettings.presetURL.c_str(); + settings->titleFontURL = pmSettings.titleFontURL.c_str(); + settings->menuFontURL = pmSettings.menuFontURL.c_str(); + COPY_FIELD(settings, pmSettings, smoothPresetDuration); + COPY_FIELD(settings, pmSettings, presetDuration); + COPY_FIELD(settings, pmSettings, beatSensitivity); + COPY_FIELD(settings, pmSettings, aspectCorrection); + COPY_FIELD(settings, pmSettings, easterEgg); + COPY_FIELD(settings, pmSettings, shuffleEnabled); +} +#endif diff --git a/Game/Code/lib/projectM/cwrapper/projectM-cwrapper.h b/Game/Code/lib/projectM/cwrapper/projectM-cwrapper.h new file mode 100755 index 00000000..60e1dbb8 --- /dev/null +++ b/Game/Code/lib/projectM/cwrapper/projectM-cwrapper.h @@ -0,0 +1,65 @@ +#ifndef __PROJECTM_CWRAPPER_H__ +#define __PROJECTM_CWRAPPER_H__ + +#include "projectM.hpp" + +#define PROJECTM_VERSION_1_00_00 1000000 // 1.00.00 = 1.0 or 1.01 +#define PROJECTM_VERSION_1_10_00 1010000 // 1.10.00 = 1.1 + +// version of projectM to wrap (see PROJECTM_VERSION) +#ifndef PROJECTM_VERSION_INT +#define PROJECTM_VERSION_INT PROJECTM_VERSION_1_10_00 +#endif + +extern "C" { + + #if (PROJECTM_VERSION_INT >= 1010000) + struct Settings { + int meshX; + int meshY; + int fps; + int textureSize; + int windowWidth; + int windowHeight; + const char* presetURL; + const char* titleFontURL; + const char* menuFontURL; + int smoothPresetDuration; + int presetDuration; + float beatSensitivity; + char aspectCorrection; + float easterEgg; + char shuffleEnabled; + }; + #endif + + typedef void* projectM_ptr; + + DLLEXPORT projectM_ptr projectM_create1(char* config_file); + #if (PROJECTM_VERSION_INT < 1010000) + DLLEXPORT projectM_ptr projectM_create2(int gx, int gy, int fps, int texsize, + int width, int height, char* preset_url, + char* title_fonturl, char* title_menuurl); + #endif + + DLLEXPORT void projectM_resetGL(projectM_ptr pm, int width, int height); + DLLEXPORT void projectM_setTitle(projectM_ptr pm, char* title); + DLLEXPORT void projectM_renderFrame(projectM_ptr pm); + DLLEXPORT unsigned projectM_initRenderToTexture(projectM_ptr pm); + DLLEXPORT void projectM_key_handler(projectM_ptr pm, projectMEvent event, + projectMKeycode keycode, projectMModifier modifier); + + DLLEXPORT void projectM_free(projectM_ptr pm); + + DLLEXPORT void PCM_addPCMfloat(projectM_ptr pm, float *PCMdata, int samples); + DLLEXPORT void PCM_addPCM16(projectM_ptr pm, short [2][512]); + DLLEXPORT void PCM_addPCM16Data(projectM_ptr pm, const short* pcm_data, short samples); + DLLEXPORT void PCM_addPCM8(projectM_ptr pm, unsigned char [2][1024]); + DLLEXPORT void PCM_addPCM8_512(projectM_ptr pm, const unsigned char [2][512]); + + #if (PROJECTM_VERSION_INT >= 1010000) + DLLEXPORT void projectM_settings(projectM_ptr pm, Settings* settings); + #endif +} + +#endif diff --git a/Game/Code/lib/projectM/cwrapper/projectM-cwrapper.sln b/Game/Code/lib/projectM/cwrapper/projectM-cwrapper.sln new file mode 100644 index 00000000..e05f79a3 --- /dev/null +++ b/Game/Code/lib/projectM/cwrapper/projectM-cwrapper.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "projectM-cwrapper", "projectM-cwrapper.vcproj", "{8E653284-12F3-4A90-9D0D-4195557051F7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8E653284-12F3-4A90-9D0D-4195557051F7}.Debug|Win32.ActiveCfg = Debug|Win32 + {8E653284-12F3-4A90-9D0D-4195557051F7}.Debug|Win32.Build.0 = Debug|Win32 + {8E653284-12F3-4A90-9D0D-4195557051F7}.Release|Win32.ActiveCfg = Release|Win32 + {8E653284-12F3-4A90-9D0D-4195557051F7}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Game/Code/lib/projectM/cwrapper/projectM-cwrapper.vcproj b/Game/Code/lib/projectM/cwrapper/projectM-cwrapper.vcproj new file mode 100644 index 00000000..013bc6b7 --- /dev/null +++ b/Game/Code/lib/projectM/cwrapper/projectM-cwrapper.vcproj @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/Code/lib/projectM/projectM-0_9.inc b/Game/Code/lib/projectM/projectM-0_9.inc new file mode 100644 index 00000000..612e92c7 --- /dev/null +++ b/Game/Code/lib/projectM/projectM-0_9.inc @@ -0,0 +1,424 @@ +{$IFDEF Unix} +uses + baseunix; +{$ENDIF} + +const +{$IFDEF MSWINDOWS} + libprojectM = 'libprojectM.dll'; +{$ELSE} + libprojectM = 'libprojectM.so'; +{$ENDIF} + +{**************** INTERNAL SECTION ****************} + + +type + PPSingle = ^PSingle; + +type + _TContextType = Integer; +const + AGL_CONTEXT = 0; + CGL_CONTEXT = 1; + NSGL_CONTEXT = 2; + GLX_CONTEXT = 3; + WGL_CONTEXT = 4; + +type + _PRenderTarget = ^_TRenderTarget; + _TRenderTarget = record + { Texture size } + texsize: Integer; + + { Application context } + origContextType: _TContextType; + + usePbuffers: Integer; + + {$ifdef LINUX} + lock_func: procedure(); cdecl; + unlock_func: procedure(); cdecl; + {$endif} + + { Opaque pbuffer context and pbuffer } + {$ifdef DARWIN} + origContext: Pointer; + pbufferContext: Pointer; + pbuffer: Pointer; + {$endif} + + { Render target texture ID for non-pbuffer systems } + textureID: array[0..2] of TGLuint; + end; + + _PProjectM = ^_TProjectM; + _TProjectM = record + presetURL: PChar; + presetName: PChar; + fontURL: PChar; + + hasInit: Integer; + + noSwitch: Integer; + pcmframes: Integer; + freqframes: Integer; + totalframes: Integer; + + showfps: Integer; + showtitle: Integer; + showpreset: Integer; + showhelp: Integer; + showstats: Integer; + + studio: Integer; + + fbuffer: PGLubyte; + + {$IFNDEF MSWINDOWS} + { The first ticks value of the application } + startTime: timeval; + {$ELSE} + startTime: Longint; + {$ENDIF} + Time: Single; + + { Render target texture ID } + renderTarget: _PRenderTarget; + + disp: array[0..79] of Char; + + wave_o: Single; + + //int texsize=1024; //size of texture to do actual graphics + fvw: Integer; //fullscreen dimensions + fvh: Integer; + wvw: Integer; //windowed dimensions + wvh: Integer; + vw: Integer; //runtime dimensions + vh: Integer; + fullscreen: Integer; + + maxsamples: Integer; //size of PCM buffer + numsamples: Integer; //size of new PCM info + pcmdataL: PSingle; //holder for most recent pcm data + pcmdataR: PSingle; //holder for most recent pcm data + + avgtime: Integer; //# frames per preset + + title: PChar; + drawtitle: Integer; + + correction: Integer; + + vol: Single; + + //per pixel equation variables + gridx: PPSingle; //grid containing interpolated mesh + gridy: PPSingle; + origtheta: PPSingle; //grid containing interpolated mesh reference values + origrad: PPSingle; + origx: PPSingle; //original mesh + origy: PPSingle; + origx2: PPSingle; //original mesh + origy2: PPSingle; + + { Timing information } + mspf: Integer; + timed: Integer; + timestart: Integer; + nohard: Integer; + count: Integer; + realfps, + fpsstart: Single; + + { PCM data } + vdataL: array[0..511] of Single; //holders for FFT data (spectrum) + vdataR: array[0..511] of Single; + + { Various toggles } + doPerPixelEffects: Integer; + doIterative: Integer; + + { ENGINE VARIABLES } + { From engine_vars.h } + preset_name: array[0..255] of Char; + + { PER FRAME CONSTANTS BEGIN } + zoom: Single; + zoomexp: Single; + rot: Single; + warp: Single; + + sx: Single; + sy: Single; + dx: Single; + dy: Single; + cx: Single; + cy: Single; + + gy: Integer; + gx: Integer; + + decay: Single; + + wave_r: Single; + wave_g: Single; + wave_b: Single; + wave_x: Single; + wave_y: Single; + wave_mystery: Single; + + ob_size: Single; + ob_r: Single; + ob_g: Single; + ob_b: Single; + ob_a: Single; + + ib_size: Single; + ib_r: Single; + ib_g: Single; + ib_b: Single; + ib_a: Single; + + meshx: Integer; + meshy: Integer; + + mv_a: Single; + mv_r: Single; + mv_g: Single; + mv_b: Single; + mv_l: Single; + mv_x: Single; + mv_y: Single; + mv_dy: Single; + mv_dx: Single; + + treb: Single; + mid: Single; + bass: Single; + bass_old: Single; + beat_sensitivity: Single; + treb_att: Single; + mid_att: Single; + bass_att: Single; + progress: Single; + frame: Integer; + + { PER_FRAME CONSTANTS END } + + { PER_PIXEL CONSTANTS BEGIN } + + x_per_pixel: Single; + y_per_pixel: Single; + rad_per_pixel: Single; + ang_per_pixel: Single; + + { PER_PIXEL CONSTANT END } + + + fRating: Single; + fGammaAdj: Single; + fVideoEchoZoom: Single; + fVideoEchoAlpha: Single; + + nVideoEchoOrientation: Integer; + nWaveMode: Integer; + bAdditiveWaves: Integer; + bWaveDots: Integer; + bWaveThick: Integer; + bModWaveAlphaByVolume: Integer; + bMaximizeWaveColor: Integer; + bTexWrap: Integer; + bDarkenCenter: Integer; + bRedBlueStereo: Integer; + bBrighten: Integer; + bDarken: Integer; + bSolarize: Integer; + bInvert: Integer; + bMotionVectorsOn: Integer; + fps: Integer; + + fWaveAlpha: Single; + fWaveScale: Single; + fWaveSmoothing: Single; + fWaveParam: Single; + fModWaveAlphaStart: Single; + fModWaveAlphaEnd: Single; + fWarpAnimSpeed: Single; + fWarpScale: Single; + fShader: Single; + + + { Q VARIABLES START } + + q1: Single; + q2: Single; + q3: Single; + q4: Single; + q5: Single; + q6: Single; + q7: Single; + q8: Single; + + + { Q VARIABLES END } + + zoom_mesh: PPSingle; + zoomexp_mesh: PPSingle; + rot_mesh: PPSingle; + + sx_mesh: PPSingle; + sy_mesh: PPSingle; + dx_mesh: PPSingle; + dy_mesh: PPSingle; + cx_mesh: PPSingle; + cy_mesh: PPSingle; + + x_mesh: PPSingle; + y_mesh: PPSingle; + rad_mesh: PPSingle; + theta_mesh: PPSingle; + end; + + PProjectMState = ^TProjectMState; + TProjectMState = record + fontURLStr: string; + presetURLStr: string; + titleStr: string; + pm: _TProjectM; + end; + +{ projectM.h declarations } +procedure _projectM_init(pm: _PProjectM); cdecl; external libprojectM name 'projectM_init'; +procedure _projectM_reset(pm: _PProjectM); cdecl; external libprojectM name 'projectM_reset'; +procedure _projectM_resetGL(pm: _PProjectM; width: Integer; height: Integer); cdecl; external libprojectM name 'projectM_resetGL'; +procedure _projectM_setTitle(pm: _PProjectM; title: PChar); cdecl; external libprojectM name 'projectM_setTitle'; +procedure _renderFrame(pm: _PProjectM); cdecl; external libprojectM name 'renderFrame'; + +{ PCM.h declarations } +procedure _addPCMfloat(pcm_data: PSingle; samples: integer); cdecl; external libprojectM name 'addPCMfloat'; +procedure _addPCM16(pcm_data: PPCM16); cdecl; external libprojectM name 'addPCM16'; +procedure _addPCM16Data(pcm_data: PSmallint; samples: Smallint); cdecl; external libprojectM name 'addPCM16Data'; +procedure _addPCM8_512(pcm_data: PPCM8_512); cdecl; external libprojectM name 'addPCM8'; + +{ console_interface.h declarations } +procedure _key_handler(pm: _PProjectM; + event: TProjectMEvent; + keycode: TProjectMKeycode; + modifier: TProjectMModifier); cdecl; external libprojectM name 'key_handler'; + + + + +{**************** EXTERNAL SECTION ****************} + + +constructor TProjectM.Create(gx, gy: integer; fps: integer; + texsize: integer; width, height: integer; + const presetsDir, fontsDir: string; + const titleFont, menuFont: string); +var + state: PProjectMState; +begin + New(state); + data := state; + + with state^ do + begin + // copy strings (Note: do not use e.g. PChar(presetsDir) directly, it might + // be a pointer to local stack data that is invalid after the calling function returns) + fontURLStr := fontsDir; + presetURLStr := presetsDir; + + _projectM_reset(@pm); + + pm.fullscreen := 0; + pm.renderTarget^.texsize := texsize; + pm.gx := gx; + pm.gy := gy; + pm.fps := fps; + pm.renderTarget^.usePbuffers := 0; + pm.fontURL := PChar(fontURLStr); + pm.presetURL := PChar(presetURLStr); + + _projectM_init(@pm); + end; +end; + +procedure TProjectM.ResetGL(width, height: Integer); +begin + _projectM_resetGL(@PProjectMState(data).pm, width, height); +end; + +procedure TProjectM.SetTitle(const title: string); +var + state: PProjectMState; +begin + state := PProjectMState(data); + with state^ do + begin + titleStr := title; + pm.title := PChar(titleStr); + pm.showtitle := 1; + end; +end; + +procedure TProjectM.RenderFrame(); +begin + _renderFrame(@PProjectMState(data).pm); +end; + +procedure TProjectM.AddPCMfloat(pcmData: PSingle; samples: integer); +begin + _addPCMfloat(pcmData, samples); +end; + +procedure TProjectM.AddPCM16(pcmData: PPCM16); +begin + _addPCM16(pcmData); +end; + +procedure TProjectM.AddPCM16Data(pcmData: PSmallint; samples: Smallint); +begin + _addPCM16Data(pcmData, samples); +end; + +procedure TProjectM.AddPCM8_512(pcmData: PPCM8_512); +begin + _addPCM8_512(pcmData); +end; + +procedure TProjectM.KeyHandler(event: TProjectMEvent; + keycode: TProjectMKeycode; + modifier: TProjectMModifier); +begin + _key_handler(@PProjectMState(data).pm, event, keycode, modifier); +end; + +procedure TProjectM.RandomPreset(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_r_LOWERCASE, PROJECTM_KMOD_LSHIFT); +end; + +procedure TProjectM.PreviousPreset(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_p_LOWERCASE, PROJECTM_KMOD_LSHIFT); +end; + +procedure TProjectM.NextPreset(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_n_LOWERCASE, PROJECTM_KMOD_LSHIFT); +end; + +procedure TProjectM.ToggleShowPresetNames(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_F3, PROJECTM_KMOD_LSHIFT); +end; + +destructor TProjectM.Destroy(); +begin + Dispose(PProjectMState(data)); + data := nil; +end; + diff --git a/Game/Code/lib/projectM/projectM-1_0.inc b/Game/Code/lib/projectM/projectM-1_0.inc new file mode 100644 index 00000000..a1c1c1f4 --- /dev/null +++ b/Game/Code/lib/projectM/projectM-1_0.inc @@ -0,0 +1,170 @@ +//uses + +const +{$IFDEF MSWINDOWS} + // Note: static linking is not possible with delphi because it does neither + // accept gcc nor MSVC object files (only Intel-style ones). + libprojectM_cwrapper = 'projectM-cwrapper.dll'; +{$ELSE} + // static libs are not supported in the "external"-clause + libprojectM_cwrapper = ''; + // statically link the cwrapper and dynamically link projectM + {$L 'cwrapper/libprojectM-cwrapper.a'} + {$LINKLIB projectM} +{$ENDIF} + +{**************** INTERNAL SECTION ****************} + + +type + _PProjectM = Pointer; + +{ projectM.hpp declarations } +function _projectM_create1(config_file: PChar): _PProjectM; cdecl; external libprojectM_cwrapper name 'projectM_create1'; +{$IF PROJECTM_VERSION < 1010000} +function _projectM_create2(gx: integer; gy: integer; fps: integer; + texsize: integer; width: integer; height: integer; + preset_url: PChar; title_fonturl: PChar; title_menuurl: PChar): _PProjectM; cdecl; external libprojectM_cwrapper name 'projectM_create2'; +{$IFEND} + +procedure _projectM_resetGL(pm: _PProjectM; width: integer; height: integer); cdecl; external libprojectM_cwrapper name 'projectM_resetGL'; +procedure _projectM_setTitle(pm: _PProjectM; title: PChar); cdecl; external libprojectM_cwrapper name 'projectM_setTitle'; +procedure _projectM_renderFrame(pm: _PProjectM); cdecl; external libprojectM_cwrapper name 'projectM_renderFrame'; +function _projectM_initRenderToTexture(pm: _PProjectM): Cardinal; cdecl; external libprojectM_cwrapper name 'projectM_initRenderToTexture'; + +procedure _projectM_free(pm: _PProjectM); cdecl; external libprojectM_cwrapper name 'projectM_free'; + +procedure _projectM_key_handler(pm: _PProjectM; event: TProjectMEvent; + keycode: TProjectMKeycode; modifier: TProjectMModifier); cdecl; external libprojectM_cwrapper name 'projectM_key_handler'; + +{$IF PROJECTM_VERSION >= 1010000} +procedure _projectM_settings(pm: _PProjectM; settings: PSettings); cdecl; external libprojectM_cwrapper name 'projectM_settings'; +{$IFEND} + +{ PCM.hpp declarations } +procedure _PCM_addPCMfloat(pm: _PProjectM; pcm_data: PSingle; samples: integer); cdecl; external libprojectM_cwrapper name 'PCM_addPCMfloat'; +procedure _PCM_addPCM16(pm: _PProjectM; pcm_data: PPCM16); cdecl; external libprojectM_cwrapper name 'PCM_addPCM16'; +procedure _PCM_addPCM16Data(pm: _PProjectM; pcm_data: PSmallint; samples: Smallint); cdecl; external libprojectM_cwrapper name 'PCM_addPCM16Data'; +procedure _PCM_addPCM8_512(pm: _PProjectM; pcm_data: PPCM8_512); cdecl; external libprojectM_cwrapper name 'PCM_addPCM8_512'; +procedure _PCM_addPCM8_1024(pm: _PProjectM; pcm_data: PPCM8_1024); cdecl; external libprojectM_cwrapper name 'PCM_addPCM8'; + + +{**************** EXTERNAL SECTION ****************} + +// This constructor is present in projectM 1.0(1) but does not work with +// linux because of a bug. +(* +constructor TProjectM.Create(gx, gy: integer; fps: integer; + texsize: integer; width, height: integer; + const presetsDir, fontsDir: string; + const titleFont, menuFont: string); +begin + data := _projectM_create2(gx, gy, fps, texsize, width, height, + PChar(presetsDir), + PChar(fontsDir + PathDelim + titleFont), + PChar(fontsDir + PathDelim + menuFont)); +end; +*) + +constructor TProjectM.Create(const configFile: string); +begin + // we cannot catch C++ exceptions in delphi, so we have to check + // if configFile is valid first + if (FileExists(configFile)) then + data := _projectM_create1(PChar(configFile)) + else + raise Exception.Create('Invalid file: ' + configFile); +end; + +procedure TProjectM.ResetGL(width, height: Integer); +begin + _projectM_resetGL(data, width, height); +end; + +procedure TProjectM.SetTitle(const title: string); +begin + _projectM_setTitle(data, PChar(title)); +end; + +procedure TProjectM.RenderFrame(); +begin + _projectM_renderFrame(data); +end; + +procedure TProjectM.AddPCMfloat(pcmData: PSingle; samples: integer); +begin + _PCM_addPCMfloat(data, pcmData, samples); +end; + +procedure TProjectM.AddPCM16(pcmData: PPCM16); +begin + _PCM_addPCM16(data, pcmData); +end; + +{** + * Passes interleaved stereo PCM-samples to projectM. + *} +procedure TProjectM.AddPCM16Data(pcmData: PSmallint; samples: Smallint); +begin + _PCM_addPCM16Data(data, pcmData, samples); +end; + +procedure TProjectM.AddPCM8_512(pcmData: PPCM8_512); +begin + _PCM_addPCM8_512(data, pcmData); +end; + +procedure TProjectM.AddPCM8_1024(pcmData: PPCM8_1024); +begin + _PCM_addPCM8_1024(data, pcmData); +end; + +{** + * If the result is > -1 projectM will render to a texture. + * The texture-ID is the return-value. + *} +function TProjectM.InitRenderToTexture(): GLuint; +begin + result := _projectM_initRenderToTexture(data); +end; + +procedure TProjectM.KeyHandler(event: TProjectMEvent; + keycode: TProjectMKeycode; + modifier: TProjectMModifier); +begin + _projectM_key_handler(data, event, keycode, modifier); +end; + +procedure TProjectM.RandomPreset(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_r_LOWERCASE, PROJECTM_KMOD_LSHIFT); +end; + +procedure TProjectM.PreviousPreset(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_p_LOWERCASE, PROJECTM_KMOD_LSHIFT); +end; + +procedure TProjectM.NextPreset(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_n_LOWERCASE, PROJECTM_KMOD_LSHIFT); +end; + +procedure TProjectM.ToggleShowPresetNames(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_F3, PROJECTM_KMOD_LSHIFT); +end; + +{$IF PROJECTM_VERSION >= 1010000} +procedure TProjectM.Settings(var settings: TSettings); +begin + _projectM_settings(data, @settings); +end; +{$IFEND} + +destructor TProjectM.Destroy(); +begin + _projectM_free(data); + data := nil; +end; + diff --git a/Game/Code/lib/projectM/projectM.pas b/Game/Code/lib/projectM/projectM.pas new file mode 100644 index 00000000..998b9b0c --- /dev/null +++ b/Game/Code/lib/projectM/projectM.pas @@ -0,0 +1,230 @@ +unit projectM; + +{$IFDEF FPC} + {$MODE DELPHI} + {$PACKENUM 4} (* use 4-byte enums *) + {$PACKRECORDS C} (* C/C++-compatible record packing *) +{$ELSE} + {$MINENUMSIZE 4} (* use 4-byte enums *) +{$ENDIF} + +interface + +uses + SysUtils, + OpenGL12, + UConfig; + +type + // 16bit non-interleaved data + TPCM16 = array[0..1, 0..511] of Smallint; + PPCM16 = ^TPCM16; + // 8bit non-interleaved data (512 samples) + TPCM8_512 = array[0..1, 0..511] of byte; + PPCM8_512 = ^TPCM8_512; + // 8bit non-interleaved data (1024 samples) + TPCM8_1024 = array[0..1, 0..1023] of byte; + PPCM8_1024 = ^TPCM8_512; + +{ Event types } +type + TProjectMEvent = integer; +const + PROJECTM_KEYUP = 0; + PROJECTM_KEYDOWN = 1; + PROJECTM_VIDEORESIZE = 2; + PROJECTM_VIDEOQUIT = 3; + PROJECTM_NONE = 4; + +{ Keycodes } +type + TProjectMKeycode = integer; +const + PROJECTM_K_RETURN = 0; + PROJECTM_K_RIGHT = 1; + PROJECTM_K_LEFT = 2; + PROJECTM_K_UP = 3; + PROJECTM_K_DOWN = 4; + PROJECTM_K_PAGEUP = 5; + PROJECTM_K_PAGEDOWN = 6; + PROJECTM_K_INSERT = 7; + PROJECTM_K_DELETE = 8; + PROJECTM_K_ESCAPE = 9; + PROJECTM_K_LSHIFT = 10; + PROJECTM_K_RSHIFT = 11; + PROJECTM_K_CAPSLOCK = 12; + PROJECTM_K_LCTRL = 13; + PROJECTM_K_HOME = 14; + PROJECTM_K_END = 15; + PROJECTM_K_BACKSPACE = 16; + + PROJECTM_K_F1 = 17; + PROJECTM_K_F2 = (PROJECTM_K_F1 + 1); + PROJECTM_K_F3 = (PROJECTM_K_F1 + 2); + PROJECTM_K_F4 = (PROJECTM_K_F1 + 3); + PROJECTM_K_F5 = (PROJECTM_K_F1 + 4); + PROJECTM_K_F6 = (PROJECTM_K_F1 + 5); + PROJECTM_K_F7 = (PROJECTM_K_F1 + 6); + PROJECTM_K_F8 = (PROJECTM_K_F1 + 7); + PROJECTM_K_F9 = (PROJECTM_K_F1 + 8); + PROJECTM_K_F10 = (PROJECTM_K_F1 + 9); + PROJECTM_K_F11 = (PROJECTM_K_F1 + 10); + PROJECTM_K_F12 = (PROJECTM_K_F1 + 11); + + PROJECTM_K_0 = 48; + PROJECTM_K_1 = (PROJECTM_K_0 + 1); + PROJECTM_K_2 = (PROJECTM_K_0 + 2); + PROJECTM_K_3 = (PROJECTM_K_0 + 3); + PROJECTM_K_4 = (PROJECTM_K_0 + 4); + PROJECTM_K_5 = (PROJECTM_K_0 + 5); + PROJECTM_K_6 = (PROJECTM_K_0 + 6); + PROJECTM_K_7 = (PROJECTM_K_0 + 7); + PROJECTM_K_8 = (PROJECTM_K_0 + 8); + PROJECTM_K_9 = (PROJECTM_K_0 + 9); + + { Upper case } + PROJECTM_K_A_UPPERCASE = 65; + PROJECTM_K_B_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 1); + PROJECTM_K_C_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 2); + PROJECTM_K_D_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 3); + PROJECTM_K_E_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 4); + PROJECTM_K_F_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 5); + PROJECTM_K_G_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 6); + PROJECTM_K_H_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 7); + PROJECTM_K_I_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 8); + PROJECTM_K_J_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 9); + PROJECTM_K_K_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 10); + PROJECTM_K_L_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 11); + PROJECTM_K_M_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 12); + PROJECTM_K_N_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 13); + PROJECTM_K_O_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 14); + PROJECTM_K_P_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 15); + PROJECTM_K_Q_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 16); + PROJECTM_K_R_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 17); + PROJECTM_K_S_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 18); + PROJECTM_K_T_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 19); + PROJECTM_K_U_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 20); + PROJECTM_K_V_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 21); + PROJECTM_K_W_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 22); + PROJECTM_K_X_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 23); + PROJECTM_K_Y_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 24); + PROJECTM_K_Z_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 25); + + { Lower case } + PROJECTM_K_a_LOWERCASE = 97; + PROJECTM_K_b_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 1); + PROJECTM_K_c_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 2); + PROJECTM_K_d_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 3); + PROJECTM_K_e_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 4); + PROJECTM_K_f_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 5); + PROJECTM_K_g_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 6); + PROJECTM_K_h_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 7); + PROJECTM_K_i_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 8); + PROJECTM_K_j_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 9); + PROJECTM_K_k_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 10); + PROJECTM_K_l_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 11); + PROJECTM_K_m_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 12); + PROJECTM_K_n_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 13); + PROJECTM_K_o_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 14); + PROJECTM_K_p_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 15); + PROJECTM_K_q_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 16); + PROJECTM_K_r_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 17); + PROJECTM_K_s_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 18); + PROJECTM_K_t_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 19); + PROJECTM_K_u_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 20); + PROJECTM_K_v_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 21); + PROJECTM_K_w_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 22); + PROJECTM_K_x_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 23); + PROJECTM_K_y_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 24); + PROJECTM_K_z_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 25); + + PROJECTM_K_NONE = (PROJECTM_K_z_LOWERCASE + 1); + +{ Modifiers } +type + TProjectMModifier = integer; +const + PROJECTM_KMOD_LSHIFT = 0; + PROJECTM_KMOD_RSHIFT = 1; + PROJECTM_KMOD_CAPS = 2; + PROJECTM_KMOD_LCTRL = 3; + PROJECTM_KMOD_RCTRL = 4; + +type + PSettings = ^TSettings; + TSettings = record + meshX: integer; + meshY: integer; + fps: integer; + textureSize: integer; + windowWidth: integer; + windowHeight: integer; + presetURL: PChar; + titleFontURL: PChar; + menuFontURL: PChar; + smoothPresetDuration: integer; + presetDuration: integer; + beatSensitivity: single; + aspectCorrection: byte; + easterEgg: single; + shuffleEnabled: byte; + end; + +type + PProjectM = ^TProjectM; + TProjectM = class(TObject) + private + data: Pointer; + public + {$IF PROJECTM_VERSION < 1000000} + constructor Create(gx, gy: integer; fps: integer; + texsize: integer; width, height: integer; + const presetsDir, fontsDir: string; + const titleFont: string = 'Vera.ttf'; + const menuFont: string = 'Vera.ttf'); overload; + {$IFEND} + {$IF PROJECTM_VERSION >= 1000000} + constructor Create(const configFile: string); overload; + {$IFEND} + + procedure ResetGL(width, height: Integer); + procedure SetTitle(const title: string); + procedure RenderFrame(); + + procedure AddPCMfloat(pcmData: PSingle; samples: integer); + procedure AddPCM16(pcmData: PPCM16); + procedure AddPCM16Data(pcmData: PSmallint; samples: Smallint); + procedure AddPCM8_512(pcmData: PPCM8_512); + {$IF PROJECTM_VERSION >= 1000000} + procedure AddPCM8_1024(pcmData: PPCM8_1024); + {$IFEND} + + procedure RandomPreset(); + procedure PreviousPreset(); + procedure NextPreset(); + procedure ToggleShowPresetNames(); + + {$IF PROJECTM_VERSION >= 1000000} + function InitRenderToTexture(): GLuint; + {$IFEND} + + procedure KeyHandler(event: TProjectMEvent; + keycode: TProjectMKeycode; + modifier: TProjectMModifier); + + {$IF PROJECTM_VERSION >= 1010000} + procedure Settings(var settings: TSettings); + {$IFEND} + + destructor Destroy(); override; + end; + +implementation + +{$IF PROJECTM_VERSION >= 1000000} + {$I projectM-1_0.inc} +{$ELSE} + {$I projectM-0_9.inc} +{$IFEND} + +end. -- cgit v1.2.3