Created a dedicate console Qt based wagic application and run it in the
travis file.
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
language: cpp
|
||||
script: "qmake projects/mtg/wagic-qt.pro CONFIG+=testsuite CONFIG+=debug && make -j 8"
|
||||
script: "qmake projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug && make -j 8 && ./wagic"
|
||||
|
||||
@@ -80,25 +80,56 @@ enum {
|
||||
// #define BLEND_OPTION_ADD BLEND_COLORADD
|
||||
// #define BLEND_OPTION_BLEND (BLEND_COLORADD | BLEND_ALPHABLEND | BLEND_NOZWRITE)
|
||||
#else
|
||||
#ifndef CONSOLE_CONFIG
|
||||
#define DEFAULT_BLEND GU_TFX_MODULATE
|
||||
#define BLEND_OPTION_ADD GU_TFX_ADD
|
||||
#define BLEND_OPTION_BLEND GU_TFX_BLEND
|
||||
#else
|
||||
#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
|
||||
|
||||
#endif // CONSOLE_CONFIG
|
||||
#endif
|
||||
|
||||
#if (defined WIN32) && (!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;
|
||||
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
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
|
||||
#ifndef IOS
|
||||
typedef bool BOOL;
|
||||
typedef bool BOOL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef CONSOLE_CONFIG
|
||||
#ifndef QT_CONFIG
|
||||
#if defined (IOS)
|
||||
#import <OpenGLES/ES2/gl.h>
|
||||
@@ -215,13 +246,6 @@ enum {
|
||||
|
||||
#else //non PSP
|
||||
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
|
||||
|
||||
#define BLEND_ZERO GL_ZERO
|
||||
#define BLEND_ONE GL_ONE
|
||||
@@ -235,44 +259,15 @@ typedef uint32_t u32;
|
||||
#define BLEND_ONE_MINUS_DST_COLOR GL_ONE_MINUS_DST_COLOR
|
||||
#define BLEND_SRC_ALPHA_SATURATE GL_SRC_ALPHA_SATURATE
|
||||
|
||||
#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 GU_PSM_8888 0
|
||||
#define GU_PSM_5551 0
|
||||
#define GU_PSM_4444 0
|
||||
#define GU_PSM_5650 0
|
||||
#define PIXEL_TYPE DWORD
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
#else
|
||||
typedef uint32_t GLuint;
|
||||
#endif //CONSOLE_CONFIG
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
struct Vertex
|
||||
@@ -542,5 +537,28 @@ 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
|
||||
|
||||
@@ -34,6 +34,10 @@ The content that users should not be touching.
|
||||
#include "../include/JLogger.h"
|
||||
#include <dirent.h>
|
||||
|
||||
#ifdef QT_CONFIG
|
||||
#include <QDir>
|
||||
#endif
|
||||
|
||||
JFileSystem* JFileSystem::mInstance = NULL;
|
||||
|
||||
JZipCache::JZipCache()
|
||||
|
||||
508
JGE/src/JGfx-fake.cpp
Normal file
508
JGE/src/JGfx-fake.cpp
Normal file
@@ -0,0 +1,508 @@
|
||||
//-------------------------------------------------------------------------------------
|
||||
//
|
||||
// JGE++ is a hardware accelerated 2D game SDK for PSP/Windows.
|
||||
#include "../../include/JGE.h"
|
||||
#include "../../include/JRenderer.h"
|
||||
#include "../../include/JResourceManager.h"
|
||||
#include "../../include/JFileSystem.h"
|
||||
#include "../../include/JAssert.h"
|
||||
|
||||
JQuad::JQuad(JTexture *tex, float x, float y, float width, float height)
|
||||
:mTex(tex), mX(x), mY(y), mWidth(width), mHeight(height)
|
||||
{
|
||||
JASSERT(tex != NULL);
|
||||
JRenderer::GetInstance()->TransferTextureToGLContext(*tex);
|
||||
|
||||
mHotSpotX = 0.0f;
|
||||
mHotSpotY = 0.0f;
|
||||
//mBlend = BLEND_DEFAULT;
|
||||
for (int i=0;i<4;i++)
|
||||
mColor[i].color = 0xFFFFFFFF;
|
||||
|
||||
mHFlipped = false;
|
||||
mVFlipped = false;
|
||||
|
||||
SetTextureRect(x, y, width, height);
|
||||
}
|
||||
|
||||
void JQuad::SetTextureRect(float x, float y, float w, float h)
|
||||
{
|
||||
mX = x;
|
||||
mY = y;
|
||||
mWidth = w;
|
||||
mHeight = h;
|
||||
|
||||
if(mTex)
|
||||
{
|
||||
mTX0 = x/mTex->mTexWidth;
|
||||
mTY0 = y/mTex->mTexHeight;
|
||||
mTX1 = (x+w)/mTex->mTexWidth;
|
||||
mTY1 = (y+h)/mTex->mTexHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void JQuad::GetTextureRect(float *x, float *y, float *w, float *h)
|
||||
{
|
||||
*x=mX; *y=mY; *w=mWidth; *h=mHeight;
|
||||
}
|
||||
|
||||
|
||||
void JQuad::SetColor(PIXEL_TYPE color)
|
||||
{
|
||||
for (int i=0;i<4;i++)
|
||||
mColor[i].color = color;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JQuad::SetHotSpot(float x, float y)
|
||||
{
|
||||
mHotSpotX = x;
|
||||
mHotSpotY = y;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
JTexture::JTexture() : mBuffer(NULL)
|
||||
{
|
||||
mTexId = -1;
|
||||
}
|
||||
|
||||
JTexture::~JTexture()
|
||||
{
|
||||
if (mBuffer)
|
||||
{
|
||||
delete [] mBuffer;
|
||||
mBuffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void JTexture::UpdateBits(int x, int y, int width, int height, PIXEL_TYPE* bits)
|
||||
{
|
||||
JRenderer::GetInstance()->BindTexture(this);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
JRenderer* JRenderer::mInstance = NULL;
|
||||
bool JRenderer::m3DEnabled = false;
|
||||
|
||||
void JRenderer::Set3DFlag(bool flag) { m3DEnabled = flag; }
|
||||
|
||||
JRenderer* JRenderer::GetInstance()
|
||||
{
|
||||
if (mInstance == NULL)
|
||||
{
|
||||
mInstance = new JRenderer();
|
||||
|
||||
JASSERT(mInstance != NULL);
|
||||
|
||||
mInstance->InitRenderer();
|
||||
}
|
||||
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::Destroy()
|
||||
{
|
||||
if (mInstance)
|
||||
{
|
||||
mInstance->DestroyRenderer();
|
||||
delete mInstance;
|
||||
mInstance = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
JRenderer::JRenderer() : mActualWidth(SCREEN_WIDTH_F), mActualHeight(SCREEN_HEIGHT_F)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
JRenderer::~JRenderer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void JRenderer::InitRenderer()
|
||||
{
|
||||
mCurrentTextureFilter = TEX_FILTER_NONE;
|
||||
mImageFilter = NULL;
|
||||
|
||||
mCurrTexBlendSrc = BLEND_SRC_ALPHA;
|
||||
mCurrTexBlendDest = BLEND_ONE_MINUS_SRC_ALPHA;
|
||||
|
||||
// mLineWidth = 1.0f;
|
||||
mCurrentTex = -1;
|
||||
mFOV = 75.0f;
|
||||
|
||||
#ifdef USING_MATH_TABLE
|
||||
for (int i=0;i<360;i++)
|
||||
{
|
||||
mSinTable[i] = sinf(i*DEG2RAD);
|
||||
mCosTable[i] = cosf(i*DEG2RAD);
|
||||
}
|
||||
#endif
|
||||
|
||||
mCurrentRenderMode = MODE_UNKNOWN;
|
||||
}
|
||||
|
||||
void JRenderer::DestroyRenderer()
|
||||
{
|
||||
}
|
||||
|
||||
void JRenderer::BeginScene()
|
||||
{
|
||||
}
|
||||
|
||||
void JRenderer::EndScene()
|
||||
{
|
||||
}
|
||||
|
||||
void JRenderer::BindTexture(JTexture *tex)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::EnableTextureFilter(bool flag)
|
||||
{
|
||||
if (flag)
|
||||
mCurrentTextureFilter = TEX_FILTER_LINEAR;
|
||||
else
|
||||
mCurrentTextureFilter = TEX_FILTER_NEAREST;
|
||||
|
||||
mCurrentTex = -1;
|
||||
}
|
||||
|
||||
void Swap(float *a, float *b)
|
||||
{
|
||||
float n=*a;
|
||||
*a = *b;
|
||||
*b = n;
|
||||
}
|
||||
|
||||
void JRenderer::RenderQuad(JQuad* quad, float xo, float yo, float angle, float xScale, float yScale)
|
||||
{
|
||||
//yo = SCREEN_HEIGHT-yo-1;//-(quad->mHeight);
|
||||
float width = quad->mWidth;
|
||||
float height = quad->mHeight;
|
||||
float x = -quad->mHotSpotX;
|
||||
float y = quad->mHotSpotY;
|
||||
|
||||
Vector2D pt[4];
|
||||
pt[3] = Vector2D(x, y);
|
||||
pt[2] = Vector2D(x+width, y);
|
||||
pt[1] = Vector2D(x+width, y-height);
|
||||
pt[0] = Vector2D(x, y-height);
|
||||
|
||||
|
||||
Vector2D uv[4];
|
||||
uv[0] = Vector2D(quad->mTX0, quad->mTY1);
|
||||
uv[1] = Vector2D(quad->mTX1, quad->mTY1);
|
||||
uv[2] = Vector2D(quad->mTX1, quad->mTY0);
|
||||
uv[3] = Vector2D(quad->mTX0, quad->mTY0);
|
||||
|
||||
if (quad->mHFlipped)
|
||||
{
|
||||
Swap(&uv[0].x, &uv[1].x);
|
||||
Swap(&uv[2].x, &uv[3].x);
|
||||
}
|
||||
|
||||
if (quad->mVFlipped)
|
||||
{
|
||||
Swap(&uv[0].y, &uv[2].y);
|
||||
Swap(&uv[1].y, &uv[3].y);
|
||||
}
|
||||
|
||||
BindTexture(quad->mTex);
|
||||
|
||||
yo = SCREEN_HEIGHT_F - yo;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::RenderQuad(JQuad* quad, VertexColor* pt)
|
||||
{
|
||||
for (int i=0;i<4;i++)
|
||||
{
|
||||
pt[i].y = SCREEN_HEIGHT_F - pt[i].y;
|
||||
quad->mColor[i].color = pt[i].color;
|
||||
}
|
||||
|
||||
Vector2D uv[4];
|
||||
uv[0] = Vector2D(quad->mTX0, quad->mTY1);
|
||||
uv[1] = Vector2D(quad->mTX1, quad->mTY1);
|
||||
uv[2] = Vector2D(quad->mTX1, quad->mTY0);
|
||||
uv[3] = Vector2D(quad->mTX0, quad->mTY0);
|
||||
|
||||
BindTexture(quad->mTex);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::FillRect(float x, float y, float width, float height, PIXEL_TYPE color)
|
||||
{
|
||||
y = SCREEN_HEIGHT_F - y - height;
|
||||
|
||||
JColor col;
|
||||
col.color = color;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawRect(float x, float y, float width, float height, PIXEL_TYPE color)
|
||||
{
|
||||
y = SCREEN_HEIGHT_F - y - height;
|
||||
|
||||
JColor col;
|
||||
col.color = color;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::FillRect(float x, float y, float width, float height, PIXEL_TYPE* colors)
|
||||
{
|
||||
JColor col[4];
|
||||
for (int i=0;i<4;i++)
|
||||
col[i].color = colors[i];
|
||||
|
||||
FillRect(x, y, width, height, col);
|
||||
}
|
||||
|
||||
void JRenderer::FillRect(float x, float y, float width, float height, JColor* colors)
|
||||
{
|
||||
y = SCREEN_HEIGHT_F - y - height;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawLine(float x1, float y1, float x2, float y2, PIXEL_TYPE color)
|
||||
{
|
||||
// glLineWidth (mLineWidth);
|
||||
JColor col;
|
||||
col.color = color;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::Plot(float x, float y, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::PlotArray(float *x, float *y, int count, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JRenderer::ScreenShot(const char* filename __attribute__((unused)))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void JRenderer::TransferTextureToGLContext(JTexture& inTexture)
|
||||
{
|
||||
}
|
||||
|
||||
JTexture* JRenderer::CreateTexture(int width, int height, int mode __attribute__((unused)))
|
||||
{
|
||||
JTexture *tex = new JTexture();
|
||||
|
||||
return tex;
|
||||
}
|
||||
|
||||
JTexture* JRenderer::LoadTexture(const char* filename, int mode, int textureFormat)
|
||||
{
|
||||
JTexture *tex = new JTexture();
|
||||
|
||||
return tex;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JRenderer::EnableVSync(bool flag __attribute__((unused)))
|
||||
{
|
||||
// if (flag)
|
||||
// hge->System_SetState(HGE_FPS, 60); // HGEFPS_VSYNC
|
||||
// else
|
||||
// hge->System_SetState(HGE_FPS, HGEFPS_UNLIMITED);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::ClearScreen(PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetTexBlend(int src, int dest)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetTexBlendSrc(int src)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetTexBlendDest(int dest)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::Enable2D()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::Enable3D()
|
||||
{ /* NOT USED
|
||||
if (!m3DEnabled)
|
||||
return;
|
||||
|
||||
if (mCurrentRenderMode == MODE_3D)
|
||||
return;
|
||||
|
||||
mCurrentRenderMode = MODE_3D;
|
||||
|
||||
glViewport (0, 0, (GLsizei)SCREEN_WIDTH, (GLsizei)SCREEN_HEIGHT); // Reset The Current Viewport
|
||||
glMatrixMode (GL_PROJECTION); // Select The Projection Matrix
|
||||
glLoadIdentity (); // Reset The Projection Matrix
|
||||
gluPerspective (mFOV, (GLfloat)SCREEN_WIDTH/(GLfloat)SCREEN_HEIGHT, // Calculate The Aspect Ratio Of The Window
|
||||
0.5f, 1000.0f);
|
||||
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix
|
||||
glLoadIdentity (); // Reset The Modelview Matrix
|
||||
|
||||
glEnable (GL_DEPTH_TEST); */
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetClip(int, int, int, int)
|
||||
{// NOT USED
|
||||
//glScissor(x, y, width, height);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::LoadIdentity()
|
||||
{// NOT USED
|
||||
//glLoadIdentity();
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::Translate(float, float, float)
|
||||
{// NOT USED
|
||||
//glTranslatef(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::RotateX(float)
|
||||
{// NOT USED
|
||||
//glRotatef(angle*RAD2DEG, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::RotateY(float)
|
||||
{// NOT USED
|
||||
//glRotatef(angle*RAD2DEG, 0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::RotateZ(float)
|
||||
{// NOT USED
|
||||
//glRotatef(angle*RAD2DEG, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::PushMatrix()
|
||||
{// NOT USED
|
||||
//glPushMatrix();
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::PopMatrix()
|
||||
{// NOT USED
|
||||
//glPopMatrix();
|
||||
}
|
||||
|
||||
void JRenderer::RenderTriangles(JTexture* texture, Vertex3D *vertices, int start, int count)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetFOV(float fov)
|
||||
{
|
||||
mFOV = fov;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::FillPolygon(float* x, float* y, int count, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawPolygon(float* x, float* y, int count, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawLine(float x1, float y1, float x2, float y2, float lineWidth, PIXEL_TYPE color)
|
||||
{
|
||||
float dy=y2-y1;
|
||||
float dx=x2-x1;
|
||||
if(dy==0 && dx==0)
|
||||
return;
|
||||
|
||||
float l=(float)hypot(dx,dy);
|
||||
|
||||
float x[4];
|
||||
float y[4];
|
||||
|
||||
x[0]=x1+lineWidth*(y2-y1)/l;
|
||||
y[0]=y1-lineWidth*(x2-x1)/l;
|
||||
|
||||
x[1]=x1-lineWidth*(y2-y1)/l;
|
||||
y[1]=y1+lineWidth*(x2-x1)/l;
|
||||
|
||||
x[2]=x2-lineWidth*(y2-y1)/l;
|
||||
y[2]=y2+lineWidth*(x2-x1)/l;
|
||||
|
||||
x[3]=x2+lineWidth*(y2-y1)/l;
|
||||
y[3]=y2-lineWidth*(x2-x1)/l;
|
||||
|
||||
FillPolygon(x, y, 4, color);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawCircle(float x, float y, float radius, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
void JRenderer::FillCircle(float x, float y, float radius, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawPolygon(float x, float y, float size, int count, float startingAngle, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::FillPolygon(float x, float y, float size, int count, float startingAngle, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetImageFilter(JImageFilter* imageFilter)
|
||||
{
|
||||
mImageFilter = imageFilter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JRenderer::DrawRoundRect(float x, float y, float w, float h, float radius, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JRenderer::FillRoundRect(float x, float y, float w, float h, float radius, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
98
JGE/src/Qtconsole.cpp
Normal file
98
JGE/src/Qtconsole.cpp
Normal file
@@ -0,0 +1,98 @@
|
||||
#include "../include/JGE.h"
|
||||
#include "../include/JTypes.h"
|
||||
#include "../include/JApp.h"
|
||||
#include "../include/JFileSystem.h"
|
||||
#include "../include/JRenderer.h"
|
||||
#include "../include/JGameLauncher.h"
|
||||
|
||||
#include "TestSuiteAI.h"
|
||||
#include "GameOptions.h"
|
||||
#include "MTGDeck.h"
|
||||
#include "DebugRoutines.h"
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <QCoreApplication>
|
||||
|
||||
class WagicWrapper
|
||||
{
|
||||
public:
|
||||
WagicWrapper();
|
||||
virtual ~WagicWrapper();
|
||||
|
||||
private:
|
||||
JGE* m_engine;
|
||||
JApp* m_app;
|
||||
JGameLauncher* m_launcher;
|
||||
};
|
||||
|
||||
int JGEGetTime()
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
}
|
||||
|
||||
bool JGEToggleFullscreen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void JGECreateDefaultBindings()
|
||||
{
|
||||
}
|
||||
|
||||
WagicWrapper::WagicWrapper()
|
||||
{
|
||||
m_launcher = new JGameLauncher();
|
||||
u32 flags = m_launcher->GetInitFlags();
|
||||
if ((flags&JINIT_FLAG_ENABLE3D)!=0)
|
||||
{
|
||||
JRenderer::Set3DFlag(true);
|
||||
}
|
||||
|
||||
JGECreateDefaultBindings();
|
||||
|
||||
m_engine = JGE::GetInstance();
|
||||
m_app = m_launcher->GetGameApp();
|
||||
m_app->Create();
|
||||
m_engine->SetApp(m_app);
|
||||
JRenderer::GetInstance()->Enable2D();
|
||||
}
|
||||
|
||||
WagicWrapper::~WagicWrapper()
|
||||
{
|
||||
if(m_launcher)
|
||||
{
|
||||
delete m_launcher;
|
||||
m_launcher = NULL;
|
||||
}
|
||||
|
||||
if(m_engine)
|
||||
m_engine->SetApp(NULL);
|
||||
|
||||
if (m_app)
|
||||
{
|
||||
m_app->Destroy();
|
||||
delete m_app;
|
||||
m_app = NULL;
|
||||
}
|
||||
|
||||
JGE::Destroy();
|
||||
m_engine = NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
int result = 0;
|
||||
WagicWrapper* wagicCore = new WagicWrapper();
|
||||
MTGCollection()->loadFolder("sets/primitives/");
|
||||
MTGCollection()->loadFolder("sets/", "_cards.dat");
|
||||
options.reloadProfile();
|
||||
TestSuite testSuite("test/_tests.txt");
|
||||
result = testSuite.run();
|
||||
delete wagicCore;
|
||||
DebugTrace("TestSuite done: failed test: " << result);
|
||||
return result;
|
||||
}
|
||||
@@ -5781,7 +5781,6 @@ class GenericFlipACoin: public ActivatedAbility
|
||||
{
|
||||
public:
|
||||
string baseAbility;
|
||||
bool chooseColor;
|
||||
AASetCoin * setCoin;
|
||||
GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "", ManaCost * cost = NULL);
|
||||
int resolve();
|
||||
|
||||
@@ -973,7 +973,7 @@ AASetTypeChosen::~AASetTypeChosen()
|
||||
//
|
||||
//choosing a type or color
|
||||
GenericFlipACoin::GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable *,string _toAdd, ManaCost * cost) :
|
||||
ActivatedAbility(observer, id, source, cost, 0), baseAbility(_toAdd),chooseColor(chooseColor)
|
||||
ActivatedAbility(observer, id, source, cost, 0), baseAbility(_toAdd)
|
||||
{
|
||||
this->GetId();
|
||||
setCoin = NULL;
|
||||
|
||||
@@ -1,9 +1,28 @@
|
||||
# Add more folders to ship with the application, here
|
||||
folder_01.source = qml/QmlWagic
|
||||
folder_01.target = /usr/share
|
||||
DEPLOYMENTFOLDERS = folder_01
|
||||
addExclusiveBuilds(graphics, Graphics, console, Console)
|
||||
CONFIG(console, graphics|console){
|
||||
QT += core network
|
||||
QT -= gui
|
||||
|
||||
DEFINES += CONSOLE_CONFIG
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
DEFINES += TESTSUITE
|
||||
}
|
||||
else:CONFIG(graphics, graphics|console){
|
||||
folder_01.source = qml/QmlWagic
|
||||
folder_01.target = /usr/share
|
||||
DEPLOYMENTFOLDERS = folder_01
|
||||
QT += core gui opengl network
|
||||
#maemo5:DEFINES += QT_WIDGET
|
||||
DEFINES += QT_WIDGET
|
||||
unix:!symbian:INCLUDEPATH += /usr/include/GL
|
||||
|
||||
# Please do not modify the following two lines. Required for deployment.
|
||||
!maemo5:include(qml/qmlapplicationviewer/qmlapplicationviewer.pri)
|
||||
!maemo5:qtcAddDeployment()
|
||||
}
|
||||
|
||||
QT += core gui opengl network
|
||||
#!android:!symbian:QT += phonon
|
||||
maemo5:QT += dbus
|
||||
|
||||
@@ -15,24 +34,19 @@ unix|macx:QMAKE_CXXFLAGS += -Wno-unused-parameter
|
||||
unix|macx:QMAKE_CXXFLAGS += -Wno-unused-but-set-parameter
|
||||
unix|macx:QMAKE_CXXFLAGS += -Wno-unused-but-set-variable
|
||||
unix|macx:QMAKE_CXXFLAGS += -Wno-unused-value
|
||||
#unix|macx:!maemo5:!symbian:QMAKE_CXXFLAGS += -Werror
|
||||
unix|macx:QMAKE_CXXFLAGS += -Wno-unused-local-typedefs
|
||||
unix|macx:!maemo5:!symbian:QMAKE_CXXFLAGS += -Werror
|
||||
|
||||
windows:DEFINES += _CRT_SECURE_NO_WARNINGS
|
||||
unix|macx:DEFINES += LINUX
|
||||
CONFIG(debug, debug|release) {
|
||||
DEFINES += _DEBUG
|
||||
}
|
||||
|
||||
CONFIG(testsuite)
|
||||
{
|
||||
DEFINES += TESTSUITE
|
||||
}
|
||||
#CONFIG(debug, debug|release):DEFINES += _DEBUG
|
||||
DEFINES += QT_CONFIG
|
||||
#!android:!symbian:DEFINES += USE_PHONON
|
||||
android:INCLUDEPATH += $$ANDROID_NDK_ROOT/platforms/android-9/arch-arm/usr/include
|
||||
#DEFINES += QT_NO_DEBUG_OUTPUT
|
||||
#maemo5:DEFINES += QT_WIDGET
|
||||
DEFINES += QT_WIDGET
|
||||
DEFINES += NETWORK_SUPPORT
|
||||
|
||||
windows:INCLUDEPATH += ../../JGE/Dependencies/include
|
||||
@@ -45,7 +59,6 @@ windows{
|
||||
DEFINES += WIN32
|
||||
}
|
||||
}
|
||||
unix:!symbian:INCLUDEPATH += /usr/include/GL
|
||||
macx:INCLUDEPATH += /opt/include
|
||||
INCLUDEPATH += ../../JGE/include/qt
|
||||
INCLUDEPATH += ../../JGE/include
|
||||
@@ -170,7 +183,8 @@ SOURCES += \
|
||||
src/WGui.cpp\
|
||||
src/WResourceManager.cpp \
|
||||
src/AIPlayerBakaB.cpp \
|
||||
src/TestSuiteAI.cpp
|
||||
src/TestSuiteAI.cpp \
|
||||
../../JGE/src/Qtconsole.cpp
|
||||
|
||||
HEADERS += \
|
||||
include/CacheEngine.h\
|
||||
@@ -291,9 +305,6 @@ HEADERS += \
|
||||
|
||||
# JGE, could probably be moved outside
|
||||
SOURCES += \
|
||||
../../JGE/src/qt/filedownloader.cpp\
|
||||
../../JGE/src/qt/corewrapper.cpp\
|
||||
../../JGE/src/Qtmain.cpp\
|
||||
../../JGE/src/Encoding.cpp\
|
||||
../../JGE/src/JAnimator.cpp\
|
||||
../../JGE/src/JApp.cpp\
|
||||
@@ -304,7 +315,6 @@ SOURCES += \
|
||||
../../JGE/src/JGui.cpp\
|
||||
../../JGE/src/JLogger.cpp\
|
||||
../../JGE/src/JLBFont.cpp\
|
||||
../../JGE/src/JMD2Model.cpp\
|
||||
../../JGE/src/JOBJModel.cpp\
|
||||
../../JGE/src/JParticle.cpp\
|
||||
../../JGE/src/JParticleEffect.cpp\
|
||||
@@ -314,6 +324,7 @@ SOURCES += \
|
||||
../../JGE/src/JSpline.cpp\
|
||||
../../JGE/src/JNetwork.cpp\
|
||||
../../JGE/src/pc/JSocket.cpp\
|
||||
../../JGE/src/pc/JSfx.cpp\
|
||||
../../JGE/src/JSprite.cpp\
|
||||
../../JGE/src/Vector2D.cpp\
|
||||
../../JGE/src/tinyxml/tinystr.cpp\
|
||||
@@ -328,13 +339,27 @@ SOURCES += \
|
||||
../../JGE/src/hge/hgevector.cpp\
|
||||
../../JGE/src/zipFS/zfsystem.cpp\
|
||||
../../JGE/src/zipFS/ziphdr.cpp\
|
||||
../../JGE/src/zipFS/zstream.cpp\
|
||||
../../JGE/src/pc/JSfx.cpp\
|
||||
../../JGE/src/zipFS/zstream.cpp
|
||||
|
||||
CONFIG(graphics, graphics|console){
|
||||
SOURCES += \
|
||||
../../JGE/src/qt/filedownloader.cpp\
|
||||
../../JGE/src/qt/corewrapper.cpp\
|
||||
../../JGE/src/Qtmain.cpp\
|
||||
../../JGE/src/JMD2Model.cpp\
|
||||
../../JGE/src/pc/JGfx.cpp
|
||||
|
||||
HEADERS += \
|
||||
HEADERS += \
|
||||
../../JGE/include/qt/filedownloader.h\
|
||||
../../JGE/include/qt/corewrapper.h\
|
||||
../../JGE/include/qt/corewrapper.h
|
||||
}
|
||||
else:CONFIG(console, graphics|console){
|
||||
SOURCES += \
|
||||
../../JGE/src/JGfx-fake.cpp
|
||||
}
|
||||
|
||||
|
||||
HEADERS += \
|
||||
../../JGE/include/Threading.h\
|
||||
../../JGE/include/decoder_prx.h\
|
||||
../../JGE/include/DebugRoutines.h\
|
||||
@@ -387,10 +412,6 @@ HEADERS += \
|
||||
../../JGE/src/tinyxml/tinyxml.h\
|
||||
../../JGE/include/vram.h
|
||||
|
||||
# Please do not modify the following two lines. Required for deployment.
|
||||
!maemo5:include(qml/qmlapplicationviewer/qmlapplicationviewer.pri)
|
||||
!maemo5:qtcAddDeployment()
|
||||
|
||||
# maemo 5 packaging
|
||||
maemo5: {
|
||||
# Variables
|
||||
|
||||
Reference in New Issue
Block a user