J :
* Key buffer update : Add functions & clean the file
This commit is contained in:
+45
-25
@@ -25,31 +25,35 @@
|
|||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
void JGEControl();
|
void JGEControl();
|
||||||
BOOL JGEGetKeyState(int key);
|
BOOL JGEGetKeyState(int key);
|
||||||
bool JGEGetButtonState(u32 button);
|
bool JGEGetButtonState(u32 button);
|
||||||
bool JGEGetButtonClick(u32 button);
|
bool JGEGetButtonClick(u32 button);
|
||||||
|
u32 JGEReadKey();
|
||||||
|
void JGEResetInput();
|
||||||
|
|
||||||
#elif LINUX
|
#elif LINUX
|
||||||
|
|
||||||
void JGEControl();
|
void JGEControl();
|
||||||
BOOL JGEGetKeyState(int key);
|
BOOL JGEGetKeyState(int key);
|
||||||
bool JGEGetButtonState(uint32_t button);
|
bool JGEGetButtonState(u32 button);
|
||||||
bool JGEGetButtonClick(uint32_t button);
|
bool JGEGetButtonClick(u32 button);
|
||||||
|
u32 JGEReadKey();
|
||||||
|
void JGEResetInput();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <pspgu.h>
|
#include <pspgu.h>
|
||||||
#include <pspkernel.h>
|
#include <pspkernel.h>
|
||||||
#include <pspdisplay.h>
|
#include <pspdisplay.h>
|
||||||
#include <pspdebug.h>
|
#include <pspdebug.h>
|
||||||
#include <pspctrl.h>
|
#include <pspctrl.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pspaudiolib.h>
|
#include <pspaudiolib.h>
|
||||||
#include <psprtc.h>
|
#include <psprtc.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -71,13 +75,13 @@ class JMusic;
|
|||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
class JGE
|
class JGE
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
JApp *mApp;
|
JApp *mApp;
|
||||||
// JResourceManager *mResourceManager;
|
// JResourceManager *mResourceManager;
|
||||||
// JFileSystem* mFileSystem;
|
// JFileSystem* mFileSystem;
|
||||||
|
|
||||||
// JParticleSystem* mParticleSystem;
|
// JParticleSystem* mParticleSystem;
|
||||||
// JMotionSystem* mMotionSystem;
|
// JMotionSystem* mMotionSystem;
|
||||||
|
|
||||||
|
|
||||||
#if defined (WIN32) || defined (LINUX)
|
#if defined (WIN32) || defined (LINUX)
|
||||||
@@ -112,7 +116,7 @@ private:
|
|||||||
static JGE* mInstance;
|
static JGE* mInstance;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
/// Get JGE instance.
|
/// Get JGE instance.
|
||||||
@@ -173,6 +177,22 @@ public:
|
|||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
bool GetButtonClick(u32 button);
|
bool GetButtonClick(u32 button);
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
/// Get the next keypress.
|
||||||
|
///
|
||||||
|
/// @return Next pressed button, or 0 if none.
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
u32 ReadButton();
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
/// Reset the input buffer.
|
||||||
|
/// This is necessary because there might be phases when GetButtonState
|
||||||
|
/// or GetButtonClick are used, thereby accumulating keypresses in the
|
||||||
|
/// key buffer.
|
||||||
|
///
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
void ResetInput();
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
/// Get x value of the analog pad.
|
/// Get x value of the analog pad.
|
||||||
///
|
///
|
||||||
@@ -217,7 +237,7 @@ public:
|
|||||||
void SetDelta(int delta);
|
void SetDelta(int delta);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
JGE();
|
JGE();
|
||||||
~JGE();
|
~JGE();
|
||||||
|
|
||||||
|
|||||||
+35
-35
@@ -88,11 +88,11 @@ JGE::JGE()
|
|||||||
mCurrentMusic = NULL;
|
mCurrentMusic = NULL;
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
// mResourceManager = new JResourceManager();
|
// mResourceManager = new JResourceManager();
|
||||||
// mFileSystem = new JFileSystem();
|
// mFileSystem = new JFileSystem();
|
||||||
|
|
||||||
// mParticleSystem = NULL;//new JParticleSystem(500);
|
// mParticleSystem = NULL;//new JParticleSystem(500);
|
||||||
// mMotionSystem = NULL;//new JMotionSystem();
|
// mMotionSystem = NULL;//new JMotionSystem();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,17 +107,17 @@ JGE::~JGE()
|
|||||||
//DestroyGfx();
|
//DestroyGfx();
|
||||||
//DestroySfx();
|
//DestroySfx();
|
||||||
|
|
||||||
// if (mResourceManager != NULL)
|
// if (mResourceManager != NULL)
|
||||||
// delete mResourceManager;
|
// delete mResourceManager;
|
||||||
//
|
//
|
||||||
// if (mFileSystem != NULL)
|
// if (mFileSystem != NULL)
|
||||||
// delete mFileSystem;
|
// delete mFileSystem;
|
||||||
//
|
//
|
||||||
// if (mParticleSystem != NULL)
|
// if (mParticleSystem != NULL)
|
||||||
// delete mParticleSystem;
|
// delete mParticleSystem;
|
||||||
//
|
//
|
||||||
// if (mMotionSystem != NULL)
|
// if (mMotionSystem != NULL)
|
||||||
// delete mMotionSystem;
|
// delete mMotionSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -199,11 +199,11 @@ JGE::JGE()
|
|||||||
|
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
// mResourceManager = new JResourceManager();
|
// mResourceManager = new JResourceManager();
|
||||||
// mFileSystem = new JFileSystem();
|
// mFileSystem = new JFileSystem();
|
||||||
//
|
//
|
||||||
// mParticleSystem = new JParticleSystem(500);
|
// mParticleSystem = new JParticleSystem(500);
|
||||||
// mMotionSystem = new JMotionSystem();
|
// mMotionSystem = new JMotionSystem();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,17 +216,17 @@ JGE::~JGE()
|
|||||||
//DestroyGfx();
|
//DestroyGfx();
|
||||||
//DestroySfx();
|
//DestroySfx();
|
||||||
|
|
||||||
// delete mResourceManager;
|
// delete mResourceManager;
|
||||||
// delete mFileSystem;
|
// delete mFileSystem;
|
||||||
// delete mParticleSystem;
|
// delete mParticleSystem;
|
||||||
// delete mMotionSystem;
|
// delete mMotionSystem;
|
||||||
|
|
||||||
// if (mApp != NULL)
|
// if (mApp != NULL)
|
||||||
// {
|
// {
|
||||||
// mApp->Destroy();
|
// mApp->Destroy();
|
||||||
// delete mApp;
|
// delete mApp;
|
||||||
// mApp = NULL;
|
// mApp = NULL;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -259,8 +259,8 @@ void JGE::Init()
|
|||||||
|
|
||||||
//Create();
|
//Create();
|
||||||
|
|
||||||
// mCurrMS = 1.0f;
|
// mCurrMS = 1.0f;
|
||||||
// mFPSSlice = 0;
|
// mFPSSlice = 0;
|
||||||
|
|
||||||
//struct timeval tp;
|
//struct timeval tp;
|
||||||
//gettimeofday(&tp, NULL);
|
//gettimeofday(&tp, NULL);
|
||||||
@@ -441,9 +441,9 @@ void JGE::printf(const char *format, ...)
|
|||||||
vsprintf(mDebuggingMsg, format, list);
|
vsprintf(mDebuggingMsg, format, list);
|
||||||
va_end(list);
|
va_end(list);
|
||||||
|
|
||||||
// FILE *f = fopen("jge.log", "a+");
|
// FILE *f = fopen("jge.log", "a+");
|
||||||
// fprintf(f, "%s\n", mDebuggingMsg);
|
// fprintf(f, "%s\n", mDebuggingMsg);
|
||||||
// fclose(f);
|
// fclose(f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user