Added WRL frontend for Win8 and WP8
Merged Qt, SDL and WRL frontend on the same corewrapper Moved OpenGL code out of SDL and Qt frontends to OpenGl backend (JGfx.cpp) Updated file system and network code to be compatible with WRL
This commit is contained in:
@@ -32,7 +32,7 @@ std::string ToHex(T* pointer)
|
||||
#define DebugTrace(inString) \
|
||||
{ \
|
||||
std::ostringstream stream; \
|
||||
stream << inString; \
|
||||
stream << inString << std::endl; \
|
||||
qDebug("%s", stream.str().c_str()); \
|
||||
}
|
||||
#elif defined (ANDROID)
|
||||
@@ -48,7 +48,7 @@ std::string ToHex(T* pointer)
|
||||
{ \
|
||||
std::ostringstream stream; \
|
||||
stream << inString << std::endl; \
|
||||
OutputDebugString(stream.str().c_str()); \
|
||||
OutputDebugStringA(stream.str().c_str()); \
|
||||
}
|
||||
#endif // QT_CONFIG
|
||||
#endif // Win32, Linux
|
||||
|
||||
+90
-60
@@ -16,7 +16,7 @@
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if (!defined IOS) && (!defined ANDROID) && (!defined QT_CONFIG)
|
||||
#if (!defined IOS) && (!defined ANDROID) && (!defined QT_CONFIG) && (!defined WP8)
|
||||
#include <gif_lib.h>
|
||||
#endif //IOS ANDROID
|
||||
|
||||
@@ -24,9 +24,7 @@
|
||||
|
||||
|
||||
#if defined (WIN32)
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#elif defined (PSP)
|
||||
|
||||
#include <pspgu.h>
|
||||
@@ -53,7 +51,7 @@
|
||||
#define COSF(x) cosf(x*DEG2RAD)
|
||||
#endif
|
||||
|
||||
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) || (defined WIN32)
|
||||
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) || ((defined WIN32) && !defined(WP8))
|
||||
typedef struct
|
||||
{
|
||||
GLfloat m[4][4];
|
||||
@@ -68,18 +66,23 @@ class JRenderer
|
||||
{
|
||||
protected:
|
||||
|
||||
JRenderer();
|
||||
~JRenderer();
|
||||
void InitRenderer();
|
||||
void DestroyRenderer();
|
||||
JRenderer();
|
||||
~JRenderer();
|
||||
void InitRenderer();
|
||||
void DestroyRenderer();
|
||||
|
||||
float mActualWidth;
|
||||
float mActualHeight;
|
||||
float mWindowWidth;
|
||||
float mWindowHeight;
|
||||
|
||||
float mLeft;
|
||||
float mTop;
|
||||
float mRight;
|
||||
float mBottom;
|
||||
|
||||
public:
|
||||
|
||||
#if defined (PSP)
|
||||
int PixelSize(int textureMode);
|
||||
int PixelSize(int textureMode);
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -529,28 +532,44 @@ public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetImageFilter(JImageFilter* imageFilter);
|
||||
|
||||
/**
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// To be called each time the containing window size changes.
|
||||
///
|
||||
/// @param window - pointer to some platform specific window object.
|
||||
/// @param inWidth - new width of the window.
|
||||
/// @param inHeight - new height of the window.
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void OnWindowsSizeChanged(void* window, float inWidth, float inHeight);
|
||||
|
||||
/**
|
||||
** Set/Get methods for the actual display screen size.
|
||||
*/
|
||||
inline void SetActualWidth(float inWidth)
|
||||
{
|
||||
mActualWidth = inWidth;
|
||||
}
|
||||
*/
|
||||
inline void SetViewPort(float inLeft, float inTop, float inRight, float inBottom)
|
||||
{
|
||||
mLeft = inLeft;
|
||||
mTop = inTop;
|
||||
mRight = inRight;
|
||||
mBottom = inBottom;
|
||||
}
|
||||
|
||||
inline void SetActualHeight(float inHeight)
|
||||
{
|
||||
mActualHeight = inHeight;
|
||||
}
|
||||
inline void GetViewPort(float& outLeft, float& outTop, float& outRight, float& outBottom)
|
||||
{
|
||||
outLeft = mLeft;
|
||||
outTop = mTop;
|
||||
outRight = mRight;
|
||||
outBottom = mBottom;
|
||||
}
|
||||
|
||||
inline float GetActualWidth()
|
||||
{
|
||||
return mActualWidth;
|
||||
}
|
||||
inline float GetActualWidth()
|
||||
{
|
||||
return (mRight - mLeft);
|
||||
}
|
||||
|
||||
inline float GetActualHeight()
|
||||
{
|
||||
return mActualHeight;
|
||||
}
|
||||
inline float GetActualHeight()
|
||||
{
|
||||
return (mBottom - mTop);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -564,10 +583,10 @@ private:
|
||||
bool mVRAM;
|
||||
};
|
||||
|
||||
#if (!defined IOS) && (!defined QT_CONFIG)
|
||||
#if (!defined IOS) && (!defined QT_CONFIG)
|
||||
void LoadJPG(TextureInfo &textureInfo, const char *filename, int mode = 0, int TextureFormat = TEXTURE_FORMAT);
|
||||
int LoadPNG(TextureInfo &textureInfo, const char *filename, int mode = 0, int TextureFormat = TEXTURE_FORMAT);
|
||||
#if (!defined ANDROID) && (!defined QT_CONFIG)
|
||||
#if (!defined ANDROID) && (!defined QT_CONFIG) && (!defined WP8)
|
||||
void LoadGIF(TextureInfo &textureInfo, const char *filename, int mode = 0, int TextureFormat = TEXTURE_FORMAT);
|
||||
int image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bgcolor, InputFunc readFunc,int mode = 0, int TextureFormat = TEXTURE_FORMAT);
|
||||
#endif // (ANDROID) How can we get gif support for android ?
|
||||
@@ -575,41 +594,52 @@ private:
|
||||
|
||||
static JRenderer* mInstance;
|
||||
|
||||
#if (!defined PSP)
|
||||
#ifdef WP8
|
||||
Microsoft::WRL::ComPtr<ID3D11Device1> m_d3dDevice;
|
||||
Microsoft::WRL::ComPtr<ID3D11DeviceContext1> m_d3dContext;
|
||||
D3D_FEATURE_LEVEL m_featureLevel;
|
||||
Microsoft::WRL::ComPtr<IDXGISwapChain1> m_swapChain;
|
||||
Microsoft::WRL::ComPtr<ID3D11RenderTargetView> m_renderTargetView;
|
||||
Microsoft::WRL::ComPtr<ID3D11DepthStencilView> m_depthStencilView;
|
||||
Microsoft::WRL::ComPtr<IUnknown> m_Window;
|
||||
ID3D11Buffer* m_vertexBuffer;
|
||||
ID3D11Buffer* m_indexBuffer;
|
||||
|
||||
#elif (!defined PSP) && (!defined WP8) && (!defined CONSOLE_CONFIG)
|
||||
|
||||
GLuint mCurrentTex;
|
||||
#if ((defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) || (defined WIN32)) && (!defined CONSOLE_CONFIG)
|
||||
// MVP matrix
|
||||
ESMatrix theMvpMatrix;
|
||||
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) || (defined WIN32)
|
||||
// MVP matrix
|
||||
ESMatrix theMvpMatrix;
|
||||
|
||||
// Handle to a program object
|
||||
GLuint prog1;
|
||||
// Attribute locations
|
||||
GLint prog1_positionLoc;
|
||||
GLint prog1_colorLoc;
|
||||
// Uniform locations
|
||||
GLint prog1_mvpLoc;
|
||||
// Handle to a program object
|
||||
GLuint prog1;
|
||||
// Attribute locations
|
||||
GLint prog1_positionLoc;
|
||||
GLint prog1_colorLoc;
|
||||
// Uniform locations
|
||||
GLint prog1_mvpLoc;
|
||||
|
||||
// Handle to a program object
|
||||
GLuint prog2;
|
||||
// Sampler location
|
||||
GLint prog2_samplerLoc;
|
||||
// Attribute locations
|
||||
GLint prog2_positionLoc;
|
||||
GLint prog2_texCoordLoc;
|
||||
GLint prog2_colorLoc;
|
||||
// MVP matrix
|
||||
ESMatrix prog2_mvpMatrix;
|
||||
// Uniform locations
|
||||
GLint prog2_mvpLoc;
|
||||
// Handle to a program object
|
||||
GLuint prog2;
|
||||
// Sampler location
|
||||
GLint prog2_samplerLoc;
|
||||
// Attribute locations
|
||||
GLint prog2_positionLoc;
|
||||
GLint prog2_texCoordLoc;
|
||||
GLint prog2_colorLoc;
|
||||
// MVP matrix
|
||||
ESMatrix prog2_mvpMatrix;
|
||||
// Uniform locations
|
||||
GLint prog2_mvpLoc;
|
||||
|
||||
#endif // (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0)
|
||||
#else
|
||||
void *fbp0, *fbp1, *zbp;
|
||||
PIXEL_TYPE* mVRAM;
|
||||
int mCurrentTex;
|
||||
int mCurrentBlend;
|
||||
int mCurrentTextureFormat;
|
||||
#elif (defined PSP)
|
||||
void *fbp0, *fbp1, *zbp;
|
||||
PIXEL_TYPE* mVRAM;
|
||||
int mCurrentTex;
|
||||
int mCurrentBlend;
|
||||
int mCurrentTextureFormat;
|
||||
#endif
|
||||
|
||||
bool mVsync;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef _JSOCKET_H_
|
||||
#define _JSOCKET_H_
|
||||
|
||||
#include <queue>
|
||||
#include "Threading.h"
|
||||
using namespace std;
|
||||
|
||||
#define SERVER_PORT 5001
|
||||
|
||||
+176
-147
@@ -31,6 +31,13 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef WP8
|
||||
#define _XM_NO_INTRINSICS_
|
||||
#include <wrl/client.h>
|
||||
#include <d3d11_1.h>
|
||||
#include <DirectXMath.h>
|
||||
#endif
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(arg)
|
||||
#endif
|
||||
@@ -39,10 +46,10 @@
|
||||
#define MAX_CHANNEL 128
|
||||
|
||||
enum {
|
||||
JGE_ERR_CANT_OPEN_FILE = -1,
|
||||
JGE_ERR_PNG = -2,
|
||||
JGE_ERR_MALLOC_FAILED = -4,
|
||||
JGE_ERR_GENERIC = -5,
|
||||
JGE_ERR_CANT_OPEN_FILE = -1,
|
||||
JGE_ERR_PNG = -2,
|
||||
JGE_ERR_MALLOC_FAILED = -4,
|
||||
JGE_ERR_GENERIC = -5,
|
||||
};
|
||||
|
||||
#ifdef PSP
|
||||
@@ -74,44 +81,43 @@ enum {
|
||||
#define SCREEN_WIDTH_F 480.0f
|
||||
#define SCREEN_HEIGHT_F 272.0f
|
||||
|
||||
|
||||
#ifdef CONSOLE_CONFIG
|
||||
#define DEFAULT_BLEND 0
|
||||
#define BLEND_OPTION_ADD 0
|
||||
#define BLEND_OPTION_BLEND 0
|
||||
#define BLEND_ZERO 0
|
||||
#define BLEND_ONE 0
|
||||
#define BLEND_SRC_COLOR 0
|
||||
#define BLEND_ONE_MINUS_SRC_COLOR 0
|
||||
#define BLEND_SRC_ALPHA 0
|
||||
#define BLEND_ONE_MINUS_SRC_ALPHA 0
|
||||
#define BLEND_DST_ALPHA 0
|
||||
#define BLEND_ONE_MINUS_DST_ALPHA 0
|
||||
#define BLEND_DST_COLOR 0
|
||||
#define BLEND_ONE_MINUS_DST_COLOR 0
|
||||
#define BLEND_SRC_ALPHA_SATURATE 0
|
||||
#define GU_PSM_5551 0
|
||||
#define DEFAULT_BLEND 0
|
||||
#define BLEND_OPTION_ADD 0
|
||||
#define BLEND_OPTION_BLEND 0
|
||||
#define BLEND_ZERO 0
|
||||
#define BLEND_ONE 0
|
||||
#define BLEND_SRC_COLOR 0
|
||||
#define BLEND_ONE_MINUS_SRC_COLOR 0
|
||||
#define BLEND_SRC_ALPHA 0
|
||||
#define BLEND_ONE_MINUS_SRC_ALPHA 0
|
||||
#define BLEND_DST_ALPHA 0
|
||||
#define BLEND_ONE_MINUS_DST_ALPHA 0
|
||||
#define BLEND_DST_COLOR 0
|
||||
#define BLEND_ONE_MINUS_DST_COLOR 0
|
||||
#define BLEND_SRC_ALPHA_SATURATE 0
|
||||
#define GU_PSM_5551 0
|
||||
#else
|
||||
#ifdef WIN32
|
||||
// #define DEFAULT_BLEND BLEND_DEFAULT
|
||||
// #define BLEND_OPTION_ADD BLEND_COLORADD
|
||||
// #define BLEND_OPTION_BLEND (BLEND_COLORADD | BLEND_ALPHABLEND | BLEND_NOZWRITE)
|
||||
#else
|
||||
#define DEFAULT_BLEND GU_TFX_MODULATE
|
||||
#define BLEND_OPTION_ADD GU_TFX_ADD
|
||||
#define BLEND_OPTION_BLEND GU_TFX_BLEND
|
||||
#define DEFAULT_BLEND GU_TFX_MODULATE
|
||||
#define BLEND_OPTION_ADD GU_TFX_ADD
|
||||
#define BLEND_OPTION_BLEND GU_TFX_BLEND
|
||||
#endif
|
||||
#endif // CONSOLE_CONFIG
|
||||
|
||||
#if (defined WIN32) && (!defined LINUX)
|
||||
#if ((defined WIN32) || (defined WP8)) && (!defined LINUX)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#if defined(LINUX) && (!defined WIN32) || defined(IOS) || defined (ANDROID)
|
||||
typedef uint8_t byte;
|
||||
typedef uint32_t DWORD;
|
||||
typedef uint8_t BYTE;
|
||||
typedef uint8_t byte;
|
||||
typedef uint32_t DWORD;
|
||||
typedef uint8_t BYTE;
|
||||
#ifndef IOS
|
||||
typedef bool BOOL;
|
||||
typedef bool BOOL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -122,25 +128,26 @@ typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
#define PIXEL_TYPE DWORD
|
||||
#define ARGB(a, r, g, b) ((PIXEL_TYPE)((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
|
||||
#define RGBA(r, g, b, a) ((PIXEL_TYPE)((a) << 24) | ((b) << 16) | ((g) << 8) | (r))
|
||||
#define TEXTURE_FORMAT 0
|
||||
|
||||
#define ARGB(a, r, g, b) ((PIXEL_TYPE)((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
|
||||
#define RGBA(r, g, b, a) ((PIXEL_TYPE)((a) << 24) | ((b) << 16) | ((g) << 8) | (r))
|
||||
#ifndef PSP
|
||||
#define TEXTURE_FORMAT 0
|
||||
#endif //PSP
|
||||
|
||||
|
||||
#ifndef CONSOLE_CONFIG
|
||||
#ifndef QT_CONFIG
|
||||
#if defined (IOS)
|
||||
#import <OpenGLES/ES2/gl.h>
|
||||
#import <OpenGLES/ES2/glext.h>
|
||||
#import <OpenGLES/ES1/gl.h>
|
||||
#import <OpenGLES/ES1/glext.h>
|
||||
#import <OpenGLES/ES2/gl.h>
|
||||
#import <OpenGLES/ES2/glext.h>
|
||||
#import <OpenGLES/ES1/gl.h>
|
||||
# import <OpenGLES/ES1/glext.h>
|
||||
#elif defined (ANDROID)
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#elif defined (WIN32) || defined (LINUX)
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#elif (defined (WIN32) && !defined (WP8)) || defined (LINUX)
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
#else
|
||||
# include <QtOpenGL>
|
||||
@@ -158,117 +165,159 @@ typedef uint32_t u32;
|
||||
|
||||
#if defined (PSP)
|
||||
|
||||
#ifndef ABGR8888
|
||||
#define ABGR8888
|
||||
#endif
|
||||
#ifndef ABGR8888
|
||||
#define ABGR8888
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (ABGR8888)
|
||||
#define PIXEL_TYPE u32
|
||||
#ifndef ARGB
|
||||
#define ARGB(a, r, g, b) (PIXEL_TYPE)((a << 24) | (b << 16) | (g << 8) | r) // macro to assemble pixels in correct format
|
||||
#endif
|
||||
#define MAKE_COLOR(a, c) (a << 24 | c)
|
||||
#define MASK_ALPHA 0xFF000000 // masks for accessing individual pixels
|
||||
#define MASK_BLUE 0x00FF0000
|
||||
#define MASK_GREEN 0x0000FF00
|
||||
#define MASK_RED 0x000000FF
|
||||
#if defined (ABGR8888)
|
||||
#define PIXEL_TYPE u32
|
||||
#ifndef ARGB
|
||||
#define ARGB(a, r, g, b) (PIXEL_TYPE)((a << 24) | (b << 16) | (g << 8) | r) // macro to assemble pixels in correct format
|
||||
#endif
|
||||
#define MAKE_COLOR(a, c) (a << 24 | c)
|
||||
#define MASK_ALPHA 0xFF000000 // masks for accessing individual pixels
|
||||
#define MASK_BLUE 0x00FF0000
|
||||
#define MASK_GREEN 0x0000FF00
|
||||
#define MASK_RED 0x000000FF
|
||||
|
||||
#define PIXEL_SIZE 4
|
||||
#define PIXEL_FORMAT PSP_DISPLAY_PIXEL_FORMAT_8888
|
||||
#define PIXEL_SIZE 4
|
||||
#define PIXEL_FORMAT PSP_DISPLAY_PIXEL_FORMAT_8888
|
||||
|
||||
#define BUFFER_FORMAT GU_PSM_8888
|
||||
#define TEXTURE_FORMAT GU_PSM_8888
|
||||
#define TEXTURE_COLOR_FORMAT GU_COLOR_8888
|
||||
#define BUFFER_FORMAT GU_PSM_8888
|
||||
#define TEXTURE_FORMAT GU_PSM_8888
|
||||
#define TEXTURE_COLOR_FORMAT GU_COLOR_8888
|
||||
|
||||
|
||||
#elif defined (ABGR5551)
|
||||
#elif defined (ABGR5551)
|
||||
|
||||
#ifndef ARGB
|
||||
#define ARGB(a, r, g, b) ((r >> 3) | ((g >> 3) << 5) | ((b >> 3) << 10) | ((a >> 7) << 15))
|
||||
#endif
|
||||
#define MAKE_COLOR(a, c) (((a>>7)<<15) | c)
|
||||
#define MASK_ALPHA 0x8000
|
||||
#define MASK_BLUE 0x7C00
|
||||
#define MASK_GREEN 0x03E0
|
||||
#define MASK_RED 0x001F
|
||||
#define PIXEL_TYPE u16
|
||||
#define PIXEL_SIZE 2
|
||||
#define PIXEL_FORMAT PSP_DISPLAY_PIXEL_FORMAT_5551
|
||||
#ifndef ARGB
|
||||
#define ARGB(a, r, g, b) ((r >> 3) | ((g >> 3) << 5) | ((b >> 3) << 10) | ((a >> 7) << 15))
|
||||
#endif
|
||||
#define MAKE_COLOR(a, c) (((a>>7)<<15) | c)
|
||||
#define MASK_ALPHA 0x8000
|
||||
#define MASK_BLUE 0x7C00
|
||||
#define MASK_GREEN 0x03E0
|
||||
#define MASK_RED 0x001F
|
||||
#define PIXEL_TYPE u16
|
||||
#define PIXEL_SIZE 2
|
||||
#define PIXEL_FORMAT PSP_DISPLAY_PIXEL_FORMAT_5551
|
||||
|
||||
#define BUFFER_FORMAT GU_PSM_8888
|
||||
#define TEXTURE_FORMAT GU_PSM_5551
|
||||
#define TEXTURE_COLOR_FORMAT GU_COLOR_5551
|
||||
#define BUFFER_FORMAT GU_PSM_8888
|
||||
#define TEXTURE_FORMAT GU_PSM_5551
|
||||
#define TEXTURE_COLOR_FORMAT GU_COLOR_5551
|
||||
|
||||
#elif defined (ABGR4444)
|
||||
#ifndef ARGB
|
||||
#define ARGB(a, r, g, b) ((r >> 4) | ((g >> 4) << 4) | ((b >> 4) << 8) | ((a >> 4) << 12))
|
||||
#endif
|
||||
#define MAKE_COLOR(a, c) (((a>>4)<<12) | c)
|
||||
#define MASK_ALPHA 0xF000
|
||||
#define MASK_BLUE 0x0F00
|
||||
#define MASK_GREEN 0x00F0
|
||||
#define MASK_RED 0x000F
|
||||
#define PIXEL_TYPE u16
|
||||
#define PIXEL_SIZE 2
|
||||
#define PIXEL_FORMAT PSP_DISPLAY_PIXEL_FORMAT_4444
|
||||
#elif defined (ABGR4444)
|
||||
#ifndef ARGB
|
||||
#define ARGB(a, r, g, b) ((r >> 4) | ((g >> 4) << 4) | ((b >> 4) << 8) | ((a >> 4) << 12))
|
||||
#endif
|
||||
#define MAKE_COLOR(a, c) (((a>>4)<<12) | c)
|
||||
#define MASK_ALPHA 0xF000
|
||||
#define MASK_BLUE 0x0F00
|
||||
#define MASK_GREEN 0x00F0
|
||||
#define MASK_RED 0x000F
|
||||
#define PIXEL_TYPE u16
|
||||
#define PIXEL_SIZE 2
|
||||
#define PIXEL_FORMAT PSP_DISPLAY_PIXEL_FORMAT_4444
|
||||
|
||||
#define BUFFER_FORMAT GU_PSM_4444
|
||||
#define TEXTURE_FORMAT GU_PSM_4444
|
||||
#define TEXTURE_COLOR_FORMAT GU_COLOR_4444
|
||||
#define BUFFER_FORMAT GU_PSM_4444
|
||||
#define TEXTURE_FORMAT GU_PSM_4444
|
||||
#define TEXTURE_COLOR_FORMAT GU_COLOR_4444
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define FRAME_BUFFER_WIDTH 512
|
||||
#define FRAME_BUFFER_SIZE FRAME_BUFFER_WIDTH*SCREEN_HEIGHT*PIXEL_SIZE
|
||||
#define FRAME_BUFFER_WIDTH 512
|
||||
#define FRAME_BUFFER_SIZE FRAME_BUFFER_WIDTH*SCREEN_HEIGHT*PIXEL_SIZE
|
||||
|
||||
#define SLICE_SIZE_F 64.0f
|
||||
typedef unsigned int DWORD;
|
||||
#define SLICE_SIZE_F 64.0f
|
||||
typedef unsigned int DWORD;
|
||||
|
||||
#define BLEND_ZERO 0x1000
|
||||
#define BLEND_ONE 0x1002
|
||||
#define BLEND_SRC_COLOR GU_SRC_COLOR
|
||||
#define BLEND_ONE_MINUS_SRC_COLOR GU_ONE_MINUS_SRC_COLOR
|
||||
#define BLEND_SRC_ALPHA GU_SRC_ALPHA
|
||||
#define BLEND_ONE_MINUS_SRC_ALPHA GU_ONE_MINUS_SRC_ALPHA
|
||||
#define BLEND_DST_ALPHA GU_DST_ALPHA
|
||||
#define BLEND_ONE_MINUS_DST_ALPHA GU_ONE_MINUS_DST_ALPHA
|
||||
#define BLEND_DST_COLOR GU_DST_COLOR
|
||||
#define BLEND_ONE_MINUS_DST_COLOR GU_ONE_MINUS_DST_COLOR
|
||||
#define BLEND_SRC_ALPHA_SATURATE BLEND_ONE
|
||||
#define BLEND_ZERO 0x1000
|
||||
#define BLEND_ONE 0x1002
|
||||
#define BLEND_SRC_COLOR GU_SRC_COLOR
|
||||
#define BLEND_ONE_MINUS_SRC_COLOR GU_ONE_MINUS_SRC_COLOR
|
||||
#define BLEND_SRC_ALPHA GU_SRC_ALPHA
|
||||
#define BLEND_ONE_MINUS_SRC_ALPHA GU_ONE_MINUS_SRC_ALPHA
|
||||
#define BLEND_DST_ALPHA GU_DST_ALPHA
|
||||
#define BLEND_ONE_MINUS_DST_ALPHA GU_ONE_MINUS_DST_ALPHA
|
||||
#define BLEND_DST_COLOR GU_DST_COLOR
|
||||
#define BLEND_ONE_MINUS_DST_COLOR GU_ONE_MINUS_DST_COLOR
|
||||
#define BLEND_SRC_ALPHA_SATURATE BLEND_ONE
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ScePspFVector2 texture;
|
||||
ScePspFVector3 pos;
|
||||
} PSPVertex3D;
|
||||
typedef struct
|
||||
{
|
||||
ScePspFVector2 texture;
|
||||
ScePspFVector3 pos;
|
||||
} PSPVertex3D;
|
||||
|
||||
#else //non PSP
|
||||
#elif !defined(WP8) //non PSP
|
||||
|
||||
|
||||
#define BLEND_ZERO GL_ZERO
|
||||
#define BLEND_ONE GL_ONE
|
||||
#define BLEND_SRC_COLOR GL_SRC_COLOR
|
||||
#define BLEND_ONE_MINUS_SRC_COLOR GL_ONE_MINUS_SRC_COLOR
|
||||
#define BLEND_SRC_ALPHA GL_SRC_ALPHA
|
||||
#define BLEND_ONE_MINUS_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||
#define BLEND_DST_ALPHA GL_DST_ALPHA
|
||||
#define BLEND_ONE_MINUS_DST_ALPHA GL_ONE_MINUS_DST_ALPHA
|
||||
#define BLEND_DST_COLOR GL_DST_COLOR
|
||||
#define BLEND_ONE_MINUS_DST_COLOR GL_ONE_MINUS_DST_COLOR
|
||||
#define BLEND_SRC_ALPHA_SATURATE GL_SRC_ALPHA_SATURATE
|
||||
#define BLEND_ZERO GL_ZERO
|
||||
#define BLEND_ONE GL_ONE
|
||||
#define BLEND_SRC_COLOR GL_SRC_COLOR
|
||||
#define BLEND_ONE_MINUS_SRC_COLOR GL_ONE_MINUS_SRC_COLOR
|
||||
#define BLEND_SRC_ALPHA GL_SRC_ALPHA
|
||||
#define BLEND_ONE_MINUS_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||
#define BLEND_DST_ALPHA GL_DST_ALPHA
|
||||
#define BLEND_ONE_MINUS_DST_ALPHA GL_ONE_MINUS_DST_ALPHA
|
||||
#define BLEND_DST_COLOR GL_DST_COLOR
|
||||
#define BLEND_ONE_MINUS_DST_COLOR GL_ONE_MINUS_DST_COLOR
|
||||
#define BLEND_SRC_ALPHA_SATURATE GL_SRC_ALPHA_SATURATE
|
||||
|
||||
#define GU_PSM_8888 0
|
||||
#define GU_PSM_5551 0
|
||||
#define GU_PSM_4444 0
|
||||
#define GU_PSM_5650 0
|
||||
#else // WP8
|
||||
#define BLEND_ZERO 0
|
||||
#define BLEND_ONE 0
|
||||
#define BLEND_SRC_COLOR 0
|
||||
#define BLEND_ONE_MINUS_SRC_COLOR 0
|
||||
#define BLEND_SRC_ALPHA 0
|
||||
#define BLEND_ONE_MINUS_SRC_ALPHA 0
|
||||
#define BLEND_DST_ALPHA 0
|
||||
#define BLEND_ONE_MINUS_DST_ALPHA 0
|
||||
#define BLEND_DST_COLOR 0
|
||||
#define BLEND_ONE_MINUS_DST_COLOR 0
|
||||
#define BLEND_SRC_ALPHA_SATURATE 0
|
||||
|
||||
#define TEXTURE_FORMAT 0
|
||||
#define GU_PSM_8888 0
|
||||
#define GU_PSM_5551 0
|
||||
#define GU_PSM_4444 0
|
||||
#define GU_PSM_5650 0
|
||||
#endif
|
||||
#else
|
||||
typedef uint32_t GLuint;
|
||||
typedef float GLfloat;
|
||||
#endif //CONSOLE_CONFIG
|
||||
|
||||
|
||||
typedef enum Buttons
|
||||
{
|
||||
JGE_BTN_NONE = 0, // No button pressed
|
||||
JGE_BTN_QUIT, // Home on PSP
|
||||
JGE_BTN_MENU, // Start on PSP
|
||||
JGE_BTN_CTRL, // Select
|
||||
JGE_BTN_POWER, // Hold
|
||||
JGE_BTN_SOUND, // Music note
|
||||
JGE_BTN_RIGHT,
|
||||
JGE_BTN_LEFT,
|
||||
JGE_BTN_UP,
|
||||
JGE_BTN_DOWN,
|
||||
JGE_BTN_OK, // Circle in Japan, Cross in Europe
|
||||
JGE_BTN_CANCEL, // Triangle
|
||||
JGE_BTN_PRI, // Square (primary)
|
||||
JGE_BTN_SEC, // Cross or Circle (secondary)
|
||||
JGE_BTN_PREV, // Left trigger
|
||||
JGE_BTN_NEXT, // Right trigger
|
||||
JGE_BTN_FULLSCREEN, // Switch to fullscreen (obviously, PC only)
|
||||
|
||||
JGE_BTN_MAX = JGE_BTN_FULLSCREEN + 1
|
||||
} JButton;
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
struct Vertex
|
||||
{
|
||||
@@ -352,11 +401,14 @@ public:
|
||||
|
||||
int mFilter;
|
||||
|
||||
#if defined (PSP)
|
||||
#if defined (PSP)
|
||||
int mTextureFormat;
|
||||
int mTexId;
|
||||
bool mInVideoRAM;
|
||||
PIXEL_TYPE* mBits;
|
||||
#elif defined (WP8)
|
||||
ID3D11Texture2D* mTexId;
|
||||
u8* mBuffer;
|
||||
#else
|
||||
GLuint mTexId;
|
||||
u8* mBuffer;
|
||||
@@ -537,28 +589,5 @@ public:
|
||||
};
|
||||
|
||||
|
||||
typedef enum Buttons
|
||||
{
|
||||
JGE_BTN_NONE = 0, // No button pressed
|
||||
JGE_BTN_QUIT, // Home on PSP
|
||||
JGE_BTN_MENU, // Start on PSP
|
||||
JGE_BTN_CTRL, // Select
|
||||
JGE_BTN_POWER, // Hold
|
||||
JGE_BTN_SOUND, // Music note
|
||||
JGE_BTN_RIGHT,
|
||||
JGE_BTN_LEFT,
|
||||
JGE_BTN_UP,
|
||||
JGE_BTN_DOWN,
|
||||
JGE_BTN_OK, // Circle in Japan, Cross in Europe
|
||||
JGE_BTN_CANCEL, // Triangle
|
||||
JGE_BTN_PRI, // Square (primary)
|
||||
JGE_BTN_SEC, // Cross or Circle (secondary)
|
||||
JGE_BTN_PREV, // Left trigger
|
||||
JGE_BTN_NEXT, // Right trigger
|
||||
JGE_BTN_FULLSCREEN, // Switch to fullscreen (obviously, PC only)
|
||||
|
||||
JGE_BTN_MAX = JGE_BTN_FULLSCREEN + 1
|
||||
} JButton;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+76
-2
@@ -1,7 +1,7 @@
|
||||
#ifndef THREADING_H
|
||||
#define THREADING_H
|
||||
|
||||
#if !defined(PSP) && !defined(QT_CONFIG)
|
||||
#if !defined(PSP) && !defined(QT_CONFIG) && !defined(WP8)
|
||||
#include <boost/date_time.hpp>
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -14,7 +14,7 @@
|
||||
#endif
|
||||
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#elif !defined(QT_CONFIG)
|
||||
#elif defined(PSP)
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
@@ -538,6 +538,80 @@ namespace boost
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(WP8)
|
||||
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
typedef std::thread thread;
|
||||
|
||||
template <class Mutex>
|
||||
struct unique_lock
|
||||
{
|
||||
unique_lock(Mutex& inMutex) : mMutex(&inMutex)
|
||||
{
|
||||
mMutex->lock();
|
||||
}
|
||||
|
||||
~unique_lock()
|
||||
{
|
||||
mMutex->unlock();
|
||||
}
|
||||
|
||||
Mutex* mMutex;
|
||||
};
|
||||
|
||||
class mutex
|
||||
{
|
||||
public:
|
||||
|
||||
typedef unique_lock<mutex> scoped_lock;
|
||||
|
||||
mutex()
|
||||
: mQMutex()
|
||||
{
|
||||
}
|
||||
|
||||
~mutex()
|
||||
{
|
||||
}
|
||||
|
||||
void lock()
|
||||
{
|
||||
mQMutex.lock();
|
||||
}
|
||||
|
||||
void unlock()
|
||||
{
|
||||
mQMutex.unlock();
|
||||
}
|
||||
|
||||
std::mutex mQMutex;
|
||||
|
||||
private:
|
||||
mutex(mutex const&);
|
||||
mutex& operator=(mutex const&);
|
||||
};
|
||||
|
||||
namespace posix_time
|
||||
{
|
||||
typedef unsigned int milliseconds;
|
||||
}
|
||||
|
||||
/**
|
||||
** boost's platform neutral sleep call.
|
||||
*/
|
||||
namespace this_thread
|
||||
{
|
||||
inline void sleep(boost::posix_time::milliseconds const& time)
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(time));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // THREADING_H
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
#ifndef COREWRAPPER_H
|
||||
#define COREWRAPPER_H
|
||||
|
||||
#include "../include/JGE.h"
|
||||
#include "../include/JTypes.h"
|
||||
#include "../include/JApp.h"
|
||||
#include "../include/JFileSystem.h"
|
||||
#include "../include/JRenderer.h"
|
||||
#include "../include/JGameLauncher.h"
|
||||
|
||||
class WagicCore
|
||||
{
|
||||
private:
|
||||
|
||||
public:
|
||||
explicit WagicCore();
|
||||
virtual ~WagicCore();
|
||||
void initApp();
|
||||
|
||||
void doOK() {
|
||||
doAndEnqueue(JGE_BTN_OK);
|
||||
};
|
||||
void doNext() {
|
||||
doAndEnqueue(JGE_BTN_PREV);
|
||||
};
|
||||
void doCancel() {
|
||||
doAndEnqueue(JGE_BTN_SEC);
|
||||
};
|
||||
void doMenu() {
|
||||
doAndEnqueue(JGE_BTN_MENU);
|
||||
};
|
||||
void done() {
|
||||
while(m_buttonQueue.size())
|
||||
{
|
||||
m_engine->ReleaseKey(m_buttonQueue.front());
|
||||
m_buttonQueue.pop();
|
||||
}
|
||||
m_engine->ResetInput();
|
||||
};
|
||||
void doScroll(int x, int y) {
|
||||
m_engine->Scroll(x, y);
|
||||
};
|
||||
int getNominalHeight(){ return SCREEN_HEIGHT;};
|
||||
int getNominalWidth(){ return SCREEN_WIDTH;};
|
||||
float getNominalRatio() { return ((float)SCREEN_WIDTH / (float)SCREEN_HEIGHT);};
|
||||
bool getActive() { return m_active; };
|
||||
void setActive(bool active);
|
||||
void onKeyDown(LocalKeySym);
|
||||
void onKeyUp(LocalKeySym);
|
||||
void onWindowResize(void* window, float width, float height);
|
||||
void onWheelChanged(int deltaX, int deltaY);
|
||||
static char* getApplicationName() {
|
||||
return JGameLauncher::GetName();
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
LEFT,
|
||||
MIDLE,
|
||||
RIGHT
|
||||
} PointerId;
|
||||
|
||||
bool onPointerPressed(PointerId, int, int);
|
||||
bool onPointerReleased(PointerId, int, int);
|
||||
bool onPointerMoved(PointerId, int, int);
|
||||
bool onUpdate();
|
||||
bool onRender();
|
||||
void registerDefaultBindings();
|
||||
static WagicCore* getInstance() { return s_instance; };
|
||||
char *GetName(){ return m_launcher->GetName();};
|
||||
|
||||
private:
|
||||
void doAndEnqueue(JButton action) {
|
||||
m_engine->HoldKey_NoRepeat(action);
|
||||
m_buttonQueue.push(action);
|
||||
}
|
||||
|
||||
private:
|
||||
static WagicCore* s_instance;
|
||||
JGE* m_engine;
|
||||
JApp* m_app;
|
||||
JGameLauncher* m_launcher;
|
||||
int64_t m_lastTickCount;
|
||||
std::queue<JButton> m_buttonQueue;
|
||||
bool m_active;
|
||||
};
|
||||
|
||||
|
||||
#endif // COREWRAPPER_H
|
||||
@@ -1,5 +1,7 @@
|
||||
#ifndef COREWRAPPER_H
|
||||
#define COREWRAPPER_H
|
||||
#ifndef QTCOREWRAPPER_H
|
||||
#define QTCOREWRAPPER_H
|
||||
|
||||
#include "../include/corewrapper.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QElapsedTimer>
|
||||
@@ -7,12 +9,6 @@
|
||||
#include <QtDeclarative>
|
||||
#include <QGraphicsItem>
|
||||
#endif //QT_WIDGET
|
||||
#include "../include/JGE.h"
|
||||
#include "../include/JTypes.h"
|
||||
#include "../include/JApp.h"
|
||||
#include "../include/JFileSystem.h"
|
||||
#include "../include/JRenderer.h"
|
||||
#include "../include/JGameLauncher.h"
|
||||
|
||||
#if (defined Q_WS_MAEMO_5)
|
||||
// For screen on/off events support
|
||||
@@ -23,23 +19,11 @@
|
||||
#include <QDBusInterface>
|
||||
#endif //Q_WS_MAEMO_5
|
||||
|
||||
class WagicWrapper
|
||||
{
|
||||
public:
|
||||
WagicWrapper();
|
||||
virtual ~WagicWrapper();
|
||||
|
||||
private:
|
||||
JGE* m_engine;
|
||||
JApp* m_app;
|
||||
JGameLauncher* m_launcher;
|
||||
};
|
||||
|
||||
|
||||
#ifdef QT_WIDGET
|
||||
class WagicCore : public QGLWidget
|
||||
class QtWagicCore : public QGLWidget
|
||||
#else
|
||||
class WagicCore : public QDeclarativeItem
|
||||
class QtWagicCore : public QDeclarativeItem
|
||||
#endif
|
||||
{
|
||||
private:
|
||||
@@ -48,7 +32,6 @@ private:
|
||||
#else
|
||||
typedef QDeclarativeItem super;
|
||||
#endif //QT_WIDGET
|
||||
void initApp();
|
||||
|
||||
public:
|
||||
Q_OBJECT
|
||||
@@ -59,36 +42,30 @@ public:
|
||||
|
||||
|
||||
public:
|
||||
explicit WagicCore(super *parent = 0);
|
||||
virtual ~WagicCore();
|
||||
static int runTestSuite();
|
||||
explicit QtWagicCore(super *parent = 0);
|
||||
virtual ~QtWagicCore();
|
||||
|
||||
Q_INVOKABLE void doOK() {
|
||||
doAndEnqueue(JGE_BTN_OK);
|
||||
m_Wagic.doOK();
|
||||
};
|
||||
Q_INVOKABLE void doNext() {
|
||||
doAndEnqueue(JGE_BTN_PREV);
|
||||
m_Wagic.doNext();
|
||||
};
|
||||
Q_INVOKABLE void doCancel() {
|
||||
doAndEnqueue(JGE_BTN_SEC);
|
||||
m_Wagic.doCancel();
|
||||
};
|
||||
Q_INVOKABLE void doMenu() {
|
||||
doAndEnqueue(JGE_BTN_MENU);
|
||||
m_Wagic.doMenu();
|
||||
};
|
||||
Q_INVOKABLE void done() {
|
||||
while(m_buttonQueue.size())
|
||||
{
|
||||
m_engine->ReleaseKey(m_buttonQueue.front());
|
||||
m_buttonQueue.pop();
|
||||
}
|
||||
m_engine->ResetInput();
|
||||
m_Wagic.done();
|
||||
};
|
||||
Q_INVOKABLE void pixelInput(int x, int y);
|
||||
Q_INVOKABLE qint64 getTick() {
|
||||
return g_startTimer.elapsed();
|
||||
};
|
||||
Q_INVOKABLE void doScroll(int x, int y, int) {
|
||||
m_engine->Scroll(x, y);
|
||||
m_Wagic.doScroll(x, y);
|
||||
};
|
||||
int getNominalHeight(){ return SCREEN_HEIGHT;};
|
||||
int getNominalWidth(){ return SCREEN_WIDTH;};
|
||||
@@ -137,20 +114,14 @@ private slots:
|
||||
|
||||
private:
|
||||
void timerEvent( QTimerEvent* );
|
||||
void doAndEnqueue(JButton action) {
|
||||
m_engine->HoldKey_NoRepeat(action);
|
||||
m_buttonQueue.push(action);
|
||||
}
|
||||
|
||||
public:
|
||||
// used mainly to mesure the delta between 2 updates
|
||||
static QElapsedTimer g_startTimer;
|
||||
private:
|
||||
JGE* m_engine;
|
||||
JApp* m_app;
|
||||
JGameLauncher* m_launcher;
|
||||
WagicCore m_Wagic;
|
||||
|
||||
qint64 m_lastTickCount;
|
||||
std::queue<JButton> m_buttonQueue;
|
||||
int m_timerId;
|
||||
bool m_active;
|
||||
QRect m_viewPort;
|
||||
@@ -171,4 +142,4 @@ private:
|
||||
QML_DECLARE_TYPE(WagicCore)
|
||||
#endif //QT_WIDGET
|
||||
|
||||
#endif // COREWRAPPER_H
|
||||
#endif // QTCOREWRAPPER_H
|
||||
Reference in New Issue
Block a user