iOS compilation fixes

This commit is contained in:
Xawotihs
2010-11-19 23:16:31 +00:00
parent 6d855e6cda
commit 8339cdd3b3
30 changed files with 327 additions and 220 deletions

View File

@@ -11,7 +11,7 @@
#ifndef _FILE_SYSTEM_H_ #ifndef _FILE_SYSTEM_H_
#define _FILE_SYSTEM_H_ #define _FILE_SYSTEM_H_
#define JGE_GET_RES(filename) JFileSystem::GetInstance()->GetResourceFile(filename) #define JGE_GET_RES(filename) JFileSystem::GetInstance()->GetResourceFile(filename)
#define JGE_GET_RESPATH() JFileSystem::GetInstance()->GetResourceRoot() #define JGE_GET_RESPATH() JFileSystem::GetInstance()->GetResourceRoot()
#include <stdio.h> #include <stdio.h>
@@ -19,7 +19,7 @@
#include <map> #include <map>
#include <string> #include <string>
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined(IOS)
#else #else
#include <pspiofilemgr.h> #include <pspiofilemgr.h>
@@ -130,7 +130,7 @@ private:
char *mPassword; char *mPassword;
bool mZipAvailable; bool mZipAvailable;
void preloadZip(string filename); void preloadZip(string filename);
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined(IOS)
FILE *mFile; FILE *mFile;
#else #else
SceUID mFile; SceUID mFile;

View File

@@ -51,7 +51,7 @@ u8 JGEGetAnalogX();
u8 JGEGetAnalogY(); u8 JGEGetAnalogY();
bool JGEToggleFullscreen(); bool JGEToggleFullscreen();
#if !defined(WIN32) && !defined(LINUX) #if !defined(WIN32) && !defined(LINUX) && !defined(IOS)
#include <pspgu.h> #include <pspgu.h>
#include <pspkernel.h> #include <pspkernel.h>

View File

@@ -1,124 +1,124 @@
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// //
// JGE++ is a hardware accelerated 2D game SDK for PSP/Windows. // JGE++ is a hardware accelerated 2D game SDK for PSP/Windows.
// //
// Licensed under the BSD license, see LICENSE in JGE root for details. // Licensed under the BSD license, see LICENSE in JGE root for details.
// //
// Copyright (c) 2007 James Hui (a.k.a. Dr.Watson) <jhkhui@gmail.com> // Copyright (c) 2007 James Hui (a.k.a. Dr.Watson) <jhkhui@gmail.com>
// //
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
#ifndef _JGUI_H #ifndef _JGUI_H
#define _JGUI_H #define _JGUI_H
#include <ostream> #include <ostream>
#include "JGE.h" #include "JGE.h"
#include "JSprite.h" #include "JSprite.h"
#define MAX_GUIOBJECT 64 #define MAX_GUIOBJECT 64
#define JGUI_STYLE_LEFTRIGHT 0x01 #define JGUI_STYLE_LEFTRIGHT 0x01
#define JGUI_STYLE_UPDOWN 0x02 #define JGUI_STYLE_UPDOWN 0x02
#define JGUI_STYLE_WRAPPING 0x04 #define JGUI_STYLE_WRAPPING 0x04
#define JGUI_INITIAL_DELAY 0.4 #define JGUI_INITIAL_DELAY 0.4
#define JGUI_REPEAT_DELAY 0.2 #define JGUI_REPEAT_DELAY 0.2
const int kCancelMenuID = -1; const int kCancelMenuID = -1;
const int kInfoMenuID = -200; const int kInfoMenuID = -200;
class JGuiListener class JGuiListener
{ {
public: public:
virtual ~JGuiListener() virtual ~JGuiListener()
{ {
} }
virtual void ButtonPressed(int controllerId, int controlId) = 0; virtual void ButtonPressed(int controllerId, int controlId) = 0;
}; };
class JGuiObject class JGuiObject
{ {
protected: protected:
static JGE* mEngine; static JGE* mEngine;
private: private:
int mId; int mId;
public: public:
JGuiObject(int id); JGuiObject(int id);
virtual ~JGuiObject(); virtual ~JGuiObject();
virtual void Render() = 0; virtual void Render() = 0;
virtual std::ostream& toString(std::ostream&) const = 0; virtual std::ostream& toString(std::ostream&) const = 0;
virtual void Update(float dt); virtual void Update(float dt);
virtual void Entering(); // when focus is transferring to this obj virtual void Entering(); // when focus is transferring to this obj
virtual bool Leaving(JButton key); // when focus is transferring away from this obj, true to go ahead virtual bool Leaving(JButton key); // when focus is transferring away from this obj, true to go ahead
virtual bool ButtonPressed(); // action button pressed, return false to ignore virtual bool ButtonPressed(); // action button pressed, return false to ignore
// Used for mouse support so that the GUI engine can found out which Object was selected // Used for mouse support so that the GUI engine can found out which Object was selected
virtual bool getTopLeft(int& top, int& left) virtual bool getTopLeft(int& top, int& left)
{ {
return false; return false;
} }
; ;
int GetId(); int GetId();
}; };
class JGuiController class JGuiController
{ {
protected: protected:
static JGE* mEngine; static JGE* mEngine;
int mId; int mId;
bool mActive; bool mActive;
JButton mActionButton; JButton mActionButton;
JButton mCancelButton; JButton mCancelButton;
int mCurr; int mCurr;
int mStyle; int mStyle;
JSprite* mCursor; JSprite* mCursor;
bool mShowCursor; bool mShowCursor;
int mCursorX; int mCursorX;
int mCursorY; int mCursorY;
int mBgX; int mBgX;
int mBgY; int mBgY;
const JTexture* mBg; const JTexture* mBg;
PIXEL_TYPE mShadingColor; PIXEL_TYPE mShadingColor;
Rect* mShadingBg; JgeRect* mShadingBg;
JGuiListener* mListener; JGuiListener* mListener;
//int mKeyHoldTime; //int mKeyHoldTime;
public: public:
vector<JGuiObject*> mObjects; vector<JGuiObject*> mObjects;
int mCount; int mCount;
JGuiController(int id, JGuiListener* listener); JGuiController(int id, JGuiListener* listener);
~JGuiController(); ~JGuiController();
virtual void Render(); virtual void Render();
virtual void Update(float dt); virtual void Update(float dt);
virtual bool CheckUserInput(JButton key); virtual bool CheckUserInput(JButton key);
void Add(JGuiObject* ctrl); void Add(JGuiObject* ctrl);
void RemoveAt(int i); void RemoveAt(int i);
void Remove(int id); void Remove(int id);
void Remove(JGuiObject* ctrl); void Remove(JGuiObject* ctrl);
void SetActionButton(JButton button); void SetActionButton(JButton button);
void SetStyle(int style); void SetStyle(int style);
void SetCursor(JSprite* cursor); void SetCursor(JSprite* cursor);
bool IsActive(); bool IsActive();
void SetActive(bool flag); void SetActive(bool flag);
}; };
ostream& operator<<(ostream &out, const JGuiObject &j); ostream& operator<<(ostream &out, const JGuiObject &j);
#endif #endif

View File

@@ -11,7 +11,7 @@
#ifndef _MD2MODEL_H #ifndef _MD2MODEL_H
#define _MD2MODEL_H #define _MD2MODEL_H
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
#else #else
@@ -236,7 +236,7 @@ private:
void CheckNextState(); void CheckNextState();
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
void CalculateNormal(float *p1, float *p2, float *p3); void CalculateNormal(float *p1, float *p2, float *p3);
#else #else
void CalculateNormal(ScePspFVector3* normal, float *p1, float *p2, float *p3); void CalculateNormal(ScePspFVector3* normal, float *p1, float *p2, float *p3);

View File

@@ -15,7 +15,7 @@
using namespace std; using namespace std;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
#else #else

View File

@@ -16,7 +16,9 @@
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#ifndef IOS
#include <gif_lib.h> #include <gif_lib.h>
#endif //IOS
#include "JTypes.h" #include "JTypes.h"
@@ -25,7 +27,7 @@
#include <windows.h> #include <windows.h>
#elif defined (LINUX) #elif defined (LINUX) || defined(IOS)
#else #else
@@ -78,7 +80,7 @@ protected:
public: public:
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
#else #else
int PixelSize(int textureMode); int PixelSize(int textureMode);
#endif #endif
@@ -560,16 +562,17 @@ private:
bool mVRAM; bool mVRAM;
}; };
#ifndef IOS
void LoadJPG(TextureInfo &textureInfo, const char *filename, int mode = 0, int TextureFormat = TEXTURE_FORMAT); 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); int LoadPNG(TextureInfo &textureInfo, const char *filename, int mode = 0, int TextureFormat = TEXTURE_FORMAT);
void LoadGIF(TextureInfo &textureInfo, const char *filename, int mode = 0, int TextureFormat = TEXTURE_FORMAT); 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); int image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bgcolor, InputFunc readFunc,int mode = 0, int TextureFormat = TEXTURE_FORMAT);
#endif //(IOS)
static JRenderer* mInstance; static JRenderer* mInstance;
#if defined (WIN32) || defined (LINUX) || defined (IOS)
#if defined (WIN32) || defined (LINUX)
GLuint mCurrentTex; GLuint mCurrentTex;
#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)
// MVP matrix // MVP matrix

View File

@@ -27,7 +27,8 @@
#include <windows.h> #include <windows.h>
#define WITH_FMOD #define WITH_FMOD
#elif defined (LINUX) #elif defined (LINUX) || defined (IOS)
#else #else
#include <pspgu.h> #include <pspgu.h>
@@ -72,12 +73,12 @@ public:
#else #else
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
#ifdef WITH_FMOD #ifdef WITH_FMOD
FSOUND_SAMPLE* mTrack; // MP3 needed to be of "sample" type for FMOD, FMUSIC_MODULE is for MODs FSOUND_SAMPLE* mTrack; // MP3 needed to be of "sample" type for FMOD, FMUSIC_MODULE is for MODs
#else #else
void* mTrack; void* mTrack;
#endif #endif
#else #else
JMP3* mTrack; JMP3* mTrack;
#endif #endif
@@ -96,8 +97,8 @@ class JSample
int mVoice; int mVoice;
unsigned long fileSize(); unsigned long fileSize();
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
#ifdef WITH_FMOD #ifdef WITH_FMOD
FSOUND_SAMPLE *mSample; FSOUND_SAMPLE *mSample;
#else #else
#ifdef USE_PHONON #ifdef USE_PHONON

View File

@@ -11,7 +11,7 @@
#ifndef _SPRITE_H_ #ifndef _SPRITE_H_
#define _SPRITE_H_ #define _SPRITE_H_
#if defined (WIN32) || defined(LINUX) #if defined (WIN32) || defined(LINUX) || defined(IOS)
#include <math.h> #include <math.h>
#else #else
#include <fastmath.h> #include <fastmath.h>

View File

@@ -11,7 +11,7 @@
#ifndef _JTYPES_H #ifndef _JTYPES_H
#define _JTYPES_H #define _JTYPES_H
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
#include <stdint.h> #include <stdint.h>
@@ -81,15 +81,24 @@ enum {
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
#endif #endif
#ifdef LINUX #if defined(LINUX) || defined(IOS)
typedef uint8_t byte; typedef uint8_t byte;
typedef uint32_t DWORD; typedef uint32_t DWORD;
typedef uint8_t BYTE; typedef uint8_t BYTE;
typedef bool BOOL; #ifndef IOS
typedef bool BOOL;
#endif
#endif #endif
#ifndef QT_CONFIG #ifndef QT_CONFIG
#if defined (WIN32) || defined (LINUX) #if defined (IOS)
#import <OpenGLES/ES2/gl.h>
#import <OpenGLES/ES2/glext.h>
#import <OpenGLES/ES1/gl.h>
# import <OpenGLES/ES1/glext.h>
#elif defined (WIN32) || defined (LINUX)
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
#endif #endif
@@ -97,7 +106,7 @@ enum {
# include <QtOpenGL> # include <QtOpenGL>
#endif #endif
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
typedef int8_t s8; typedef int8_t s8;
typedef int16_t s16; typedef int16_t s16;
@@ -329,7 +338,7 @@ public:
int mFilter; int mFilter;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
GLuint mTexId; GLuint mTexId;
#else #else
int mTextureFormat; int mTextureFormat;
@@ -439,7 +448,7 @@ public:
JTexture* mTex; JTexture* mTex;
#if defined (WIN32) || defined(LINUX) #if defined (WIN32) || defined(LINUX) || defined(IOS)
float mTX0; float mTX0;
float mTY0; float mTY0;
float mTX1; float mTX1;
@@ -499,7 +508,7 @@ public:
//------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------
class Rect class JgeRect
{ {
public: public:
int x; int x;
@@ -508,7 +517,7 @@ public:
int height; int height;
public: public:
Rect(int _x, int _y, int _width, int _height): x(_x), y(_y), width(_width), height(_height) {} JgeRect(int _x, int _y, int _width, int _height): x(_x), y(_y), width(_width), height(_height) {}
}; };

View File

@@ -13,7 +13,7 @@
#ifdef WIN32 #ifdef WIN32
#include <math.h> #include <math.h>
#elif defined LINUX #elif (defined LINUX) || (defined IOS)
#include <math.h> #include <math.h>
#else #else
#include <fastmath.h> #include <fastmath.h>

View File

@@ -85,7 +85,7 @@ void JFileSystem::Destroy()
JFileSystem::JFileSystem() JFileSystem::JFileSystem()
{ {
mZipAvailable = false; mZipAvailable = false;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
mFile = NULL; mFile = NULL;
#else #else
mFile = -1; mFile = -1;
@@ -95,9 +95,9 @@ JFileSystem::JFileSystem()
mFileSize = 0; mFileSize = 0;
#ifdef RESPATH #ifdef RESPATH
mResourceRoot = RESPATH"/"; SetResourceRoot(RESPATH"/");
#else #else
mResourceRoot = "Res/"; // default root folder SetResourceRoot("Res/"); // default root folder
#endif #endif
} }
@@ -186,7 +186,7 @@ bool JFileSystem::OpenFile(const string &filename)
} }
else else
{ {
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)|| defined (IOS)
mFile = fopen(path.c_str(), "rb"); mFile = fopen(path.c_str(), "rb");
if (mFile != NULL) if (mFile != NULL)
{ {
@@ -220,7 +220,7 @@ void JFileSystem::CloseFile()
return; return;
} }
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
if (mFile != NULL) if (mFile != NULL)
fclose(mFile); fclose(mFile);
#else #else
@@ -238,7 +238,7 @@ int JFileSystem::ReadFile(void *buffer, int size)
} }
else else
{ {
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
return fread(buffer, 1, size, mFile); return fread(buffer, 1, size, mFile);
#else #else
return sceIoRead(mFile, buffer, size); return sceIoRead(mFile, buffer, size);
@@ -255,7 +255,14 @@ int JFileSystem::GetFileSize()
void JFileSystem::SetResourceRoot(const string& resourceRoot) void JFileSystem::SetResourceRoot(const string& resourceRoot)
{ {
#ifdef IOS
NSString *pathUTF8 = [NSString stringWithUTF8String: resourceRoot.c_str()];
NSString *fullpath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:pathUTF8];
mResourceRoot = [fullpath cStringUsingEncoding:1];
mResourceRoot += "/";
#else
mResourceRoot = resourceRoot; mResourceRoot = resourceRoot;
#endif
} }
string JFileSystem::GetResourceRoot() string JFileSystem::GetResourceRoot()

View File

@@ -188,7 +188,7 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
if (mCurr >= mCacheSize) if (mCurr >= mCacheSize)
mCurr = 0; mCurr = 0;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
int x = 0; int x = 0;
int y = 0; int y = 0;
@@ -225,7 +225,7 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
BYTE bitMask = 0x80; BYTE bitMask = 0x80;
for (int z=0;z<8&&bitCount;z++) for (int z=0;z<8&&bitCount;z++)
{ {
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
if ((bits & bitMask) != 0) if ((bits & bitMask) != 0)
mCharBuffer[y*mFontSize+x] = ARGB(255,255,255,255); mCharBuffer[y*mFontSize+x] = ARGB(255,255,255,255);
else else
@@ -257,7 +257,7 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
for (int i=0;i<size;) for (int i=0;i<size;)
{ {
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
x = 0; x = 0;
#else #else
x = (int)mSprites[index]->mX; x = (int)mSprites[index]->mX;
@@ -269,7 +269,7 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
for (n=0;n<(mFontSize-8)/2;n++) for (n=0;n<(mFontSize-8)/2;n++)
{ {
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
mCharBuffer[y*mFontSize+x] = ARGB(0,0,0,0); mCharBuffer[y*mFontSize+x] = ARGB(0,0,0,0);
#else #else
SwizzlePlot(pTexture, ARGB(0,0,0,0), x*PIXEL_SIZE, y, mTexture->mTexWidth*PIXEL_SIZE); SwizzlePlot(pTexture, ARGB(0,0,0,0), x*PIXEL_SIZE, y, mTexture->mTexWidth*PIXEL_SIZE);
@@ -286,7 +286,7 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
BYTE bitMask = 0x80; BYTE bitMask = 0x80;
for (int z=0;z<8&&bitCount;z++) for (int z=0;z<8&&bitCount;z++)
{ {
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
if ((bits & bitMask) != 0) if ((bits & bitMask) != 0)
mCharBuffer[y*mFontSize+x] = ARGB(255,255,255,255); mCharBuffer[y*mFontSize+x] = ARGB(255,255,255,255);
else else
@@ -308,7 +308,7 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
for (n=0;n<(mFontSize-8)/2;n++) for (n=0;n<(mFontSize-8)/2;n++)
{ {
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
mCharBuffer[y*mFontSize+x] = ARGB(0,0,0,0); mCharBuffer[y*mFontSize+x] = ARGB(0,0,0,0);
#else #else
SwizzlePlot(pTexture, ARGB(0,0,0,0), x*PIXEL_SIZE, y, mTexture->mTexWidth*PIXEL_SIZE); SwizzlePlot(pTexture, ARGB(0,0,0,0), x*PIXEL_SIZE, y, mTexture->mTexWidth*PIXEL_SIZE);
@@ -324,7 +324,7 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
mGBCode[index] = code; mGBCode[index] = code;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
x = (int)mSprites[index]->mX; x = (int)mSprites[index]->mX;
y = (int)mSprites[index]->mY; y = (int)mSprites[index]->mY;

View File

@@ -309,7 +309,8 @@ JGE::~JGE()
#if defined (WIN32) || defined (LINUX) // Non-PSP code #if defined (WIN32) || defined (LINUX) || defined (IOS)
// Non-PSP code
void JGE::Init() void JGE::Init()
{ {

View File

@@ -219,7 +219,7 @@ bool JMD2Model::Load(char *filename, char *textureName)
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------
// given 3 points, calculates the normal to the points // given 3 points, calculates the normal to the points
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
void JMD2Model::CalculateNormal(float *p1, float *p2, float *p3) void JMD2Model::CalculateNormal(float *p1, float *p2, float *p3)
#else #else
void JMD2Model::CalculateNormal(ScePspFVector3 *normal, float *p1, float *p2, float *p3) void JMD2Model::CalculateNormal(ScePspFVector3 *normal, float *p1, float *p2, float *p3)
@@ -243,7 +243,7 @@ void JMD2Model::CalculateNormal(ScePspFVector3 *normal, float *p1, float *p2, fl
// calculate the length of the normal // calculate the length of the normal
length = (float)sqrt(result[0]*result[0] + result[1]*result[1] + result[2]*result[2]); length = (float)sqrt(result[0]*result[0] + result[1]*result[1] + result[2]*result[2]);
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
// normalize and specify the normal // normalize and specify the normal
#if (!defined GL_ES_VERSION_2_0) && (!defined GL_VERSION_2_0) #if (!defined GL_ES_VERSION_2_0) && (!defined GL_VERSION_2_0)
glNormal3f(result[0]/length, result[1]/length, result[2]/length); glNormal3f(result[0]/length, result[1]/length, result[2]/length);
@@ -277,7 +277,7 @@ void JMD2Model::Render(int frameNum)
mRenderer->BindTexture(mModel->modelTex); mRenderer->BindTexture(mModel->modelTex);
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
// display the textured model with proper lighting normals // display the textured model with proper lighting normals
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) #if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0)
@@ -481,7 +481,7 @@ void JMD2Model::Render()
mRenderer->BindTexture(mModel->modelTex); mRenderer->BindTexture(mModel->modelTex);
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) #if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0)
// FIXME // FIXME

View File

@@ -145,7 +145,7 @@ void JSprite::Render()
// //mQuad->SetColor(ARGB(alpha,255,255,255)); // //mQuad->SetColor(ARGB(alpha,255,255,255));
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
mFrames[mCurrentFrame]->SetColor(alpha<<24 | mColor); mFrames[mCurrentFrame]->SetColor(alpha<<24 | mColor);
// mQuad->SetFlip(mFlipped[mCurrentFrame], false); // mQuad->SetFlip(mFlipped[mCurrentFrame], false);
#else #else
@@ -306,7 +306,7 @@ void JSprite::SetHotSpot(float x, float y, int index)
} }
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
void JSprite::SetColor(PIXEL_TYPE color) { mColor = (color&0x00ffffff); } void JSprite::SetColor(PIXEL_TYPE color) { mColor = (color&0x00ffffff); }
#else #else
void JSprite::SetColor(PIXEL_TYPE color) { mColor = (color&~MASK_ALPHA); } void JSprite::SetColor(PIXEL_TYPE color) { mColor = (color&~MASK_ALPHA); }

View File

@@ -258,7 +258,7 @@ int JTTFont::PreCacheChar(u16 ch, u16 cachedCode)
FT_GlyphSlot slot = mFace->glyph; FT_GlyphSlot slot = mFace->glyph;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
DWORD *texBuffer = new DWORD[mMaxCharWidth*mMaxCharHeight]; DWORD *texBuffer = new DWORD[mMaxCharWidth*mMaxCharHeight];
memset(texBuffer, 0, mMaxCharWidth*mMaxCharHeight*sizeof(DWORD)); memset(texBuffer, 0, mMaxCharWidth*mMaxCharHeight*sizeof(DWORD));
#else #else
@@ -278,7 +278,7 @@ int JTTFont::PreCacheChar(u16 ch, u16 cachedCode)
{ {
int top = mSize-slot->bitmap_top+1; int top = mSize-slot->bitmap_top+1;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
int offset = top*mMaxCharWidth + slot->bitmap_left + 2; int offset = top*mMaxCharWidth + slot->bitmap_left + 2;
#else #else
int xx = x + slot->bitmap_left + 2; int xx = x + slot->bitmap_left + 2;
@@ -303,7 +303,7 @@ int JTTFont::PreCacheChar(u16 ch, u16 cachedCode)
{ {
grey = slot->bitmap.buffer[i * slot->bitmap.width + j]; grey = slot->bitmap.buffer[i * slot->bitmap.width + j];
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
texBuffer[i*mMaxCharWidth+j+offset] = RGBA(255, 255, 255, grey); texBuffer[i*mMaxCharWidth+j+offset] = RGBA(255, 255, 255, grey);
#else #else
SwizzlePlot(pTexture, ARGB(grey,255,255,255), (xx+j)*PIXEL_SIZE, yy+i, mTexWidth*PIXEL_SIZE); SwizzlePlot(pTexture, ARGB(grey,255,255,255), (xx+j)*PIXEL_SIZE, yy+i, mTexWidth*PIXEL_SIZE);
@@ -326,7 +326,7 @@ int JTTFont::PreCacheChar(u16 ch, u16 cachedCode)
{ {
if (bits&mask) if (bits&mask)
{ {
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
texBuffer[i*mMaxCharWidth+j*8+k+offset] = RGBA(255, 255, 255, 255); texBuffer[i*mMaxCharWidth+j*8+k+offset] = RGBA(255, 255, 255, 255);
#else #else
SwizzlePlot(pTexture, ARGB(255,255,255,255), (xx+j*8+k)*PIXEL_SIZE, yy+i, mTexWidth*PIXEL_SIZE); SwizzlePlot(pTexture, ARGB(255,255,255,255), (xx+j*8+k)*PIXEL_SIZE, yy+i, mTexWidth*PIXEL_SIZE);
@@ -344,7 +344,7 @@ int JTTFont::PreCacheChar(u16 ch, u16 cachedCode)
mXAdvance[mCurr] = (u8)(slot->advance.x>>6); mXAdvance[mCurr] = (u8)(slot->advance.x>>6);
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, mMaxCharWidth, mMaxCharHeight, GL_RGBA, GL_UNSIGNED_BYTE, texBuffer); glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, mMaxCharWidth, mMaxCharHeight, GL_RGBA, GL_UNSIGNED_BYTE, texBuffer);
#else #else
sceKernelDcacheWritebackAll(); sceKernelDcacheWritebackAll();

View File

@@ -7,7 +7,7 @@
*/ */
#include "..\..\include\hge\hgeparticle.h" #include "../../include/hge/hgeparticle.h"
hgeParticleManager::hgeParticleManager() hgeParticleManager::hgeParticleManager()

View File

@@ -9,6 +9,7 @@
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
#define GL_GLEXT_PROTOTYPES #define GL_GLEXT_PROTOTYPES
#ifndef IOS
#ifdef WIN32 #ifdef WIN32
#pragma warning(disable : 4786) #pragma warning(disable : 4786)
#pragma comment( lib, "giflib.lib" ) #pragma comment( lib, "giflib.lib" )
@@ -26,7 +27,7 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif //IOS
#include "../../include/JGE.h" #include "../../include/JGE.h"
#include "../../include/JRenderer.h" #include "../../include/JRenderer.h"
@@ -1469,7 +1470,7 @@ static int getNextPower2(int width)
} }
#ifndef IOS
static void jpg_null(j_decompress_ptr cinfo __attribute__((unused))) static void jpg_null(j_decompress_ptr cinfo __attribute__((unused)))
{ {
} }
@@ -1649,7 +1650,6 @@ static void PNGCustomReadDataFn(png_structp png_ptr, png_bytep data, png_size_t
} }
} }
JTexture* JRenderer::LoadTexture(const char* filename, int mode, int TextureFormat __attribute__((unused))) JTexture* JRenderer::LoadTexture(const char* filename, int mode, int TextureFormat __attribute__((unused)))
{ {
TextureInfo textureInfo; TextureInfo textureInfo;
@@ -1663,10 +1663,10 @@ JTexture* JRenderer::LoadTexture(const char* filename, int mode, int TextureForm
else if(strstr(filename, ".png")!=NULL || strstr(filename, ".PNG")!=NULL) else if(strstr(filename, ".png")!=NULL || strstr(filename, ".PNG")!=NULL)
LoadPNG(textureInfo, filename); LoadPNG(textureInfo, filename);
if (textureInfo.mBits == NULL) { if (textureInfo.mBits == NULL) {
printf("Texture %s failed to load\n", filename); printf("Texture %s failed to load\n", filename);
return NULL; return NULL;
} }
bool ret = false; bool ret = false;
@@ -1720,10 +1720,10 @@ JTexture* JRenderer::LoadTexture(const char* filename, int mode, int TextureForm
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, textureInfo.mTexWidth, textureInfo.mTexHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, textureInfo.mBits); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, textureInfo.mTexWidth, textureInfo.mTexHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, textureInfo.mBits);
} }
ret = TRUE; ret = true;
} }
else else
@@ -2038,7 +2038,92 @@ void JRenderer::LoadGIF(TextureInfo &textureInfo, const char *filename, int mode
return ;//*/ return ;//*/
} }
#else //IOS
#include <UIKit/UIImage.h>
JTexture* JRenderer::LoadTexture(const char* filename, int mode, int TextureFormat __attribute__((unused)))
{
TextureInfo textureInfo;
textureInfo.mBits = NULL;
NSString *path = [NSString stringWithUTF8String: JGE_GET_RES(filename).c_str()];
// NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:newString2];
NSData *texData = [[NSData alloc] initWithContentsOfFile:path];
UIImage *image = [[UIImage alloc] initWithData:texData];
if (image == nil)
NSLog(@"Do real error checking here");
textureInfo.mWidth = CGImageGetWidth(image.CGImage);
textureInfo.mHeight = CGImageGetHeight(image.CGImage);
textureInfo.mTexWidth = textureInfo.mWidth;
textureInfo.mTexHeight = textureInfo.mHeight;
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
textureInfo.mBits = new u8 [ textureInfo.mHeight * textureInfo.mWidth * 4 ];
CGContextRef context = CGBitmapContextCreate( textureInfo.mBits, textureInfo.mWidth, textureInfo.mHeight, 8, 4 * textureInfo.mWidth, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big );
CGColorSpaceRelease( colorSpace );
CGContextClearRect( context, CGRectMake( 0, 0, textureInfo.mWidth, textureInfo.mHeight ) );
CGContextTranslateCTM( context, 0, textureInfo.mHeight - textureInfo.mHeight );
CGContextDrawImage( context, CGRectMake( 0, 0, textureInfo.mWidth, textureInfo.mHeight ), image.CGImage );
if (textureInfo.mBits == NULL) {
printf("Texture %s failed to load\n", filename);
return NULL;
}
bool ret = false;
JTexture *tex = new JTexture();
if (tex)
{
if (mImageFilter != NULL)
mImageFilter->ProcessImage((PIXEL_TYPE*)textureInfo.mBits, textureInfo.mWidth, textureInfo.mHeight);
tex->mFilter = TEX_FILTER_LINEAR;
tex->mWidth = textureInfo.mWidth;
tex->mHeight = textureInfo.mHeight;
tex->mTexWidth = textureInfo.mTexWidth;
tex->mTexHeight = textureInfo.mTexHeight;
GLuint texid;
checkGlError();
glGenTextures(1, &texid);
tex->mTexId = texid;
// glError = glGetError();
glBindTexture(GL_TEXTURE_2D, texid); // Bind To The Texture ID
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, textureInfo.mTexWidth, textureInfo.mTexHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, textureInfo.mBits);
ret = true;
}
CGContextRelease(context);
delete [] textureInfo.mBits;
//delete textureInfo;
[image release];
[texData release];
if (!ret)
{
if (tex)
delete tex;
tex = NULL;
}
checkGlError();
return tex;
}
#endif //IOS
JTexture* JRenderer::CreateTexture(int width, int height, int mode __attribute__((unused))) JTexture* JRenderer::CreateTexture(int width, int height, int mode __attribute__((unused)))
{ {

View File

@@ -60,7 +60,7 @@ class Interruptible: public PlayGuiObject, public Targetable{
virtual const string getDisplayName() const; virtual const string getDisplayName() const;
void Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad = false); void Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad = false);
virtual int receiveEvent(WEvent * event) {return 0;}; virtual int receiveEvent(WEvent * event) {return 0;};
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
virtual void Dump(); virtual void Dump();
#endif #endif
}; };
@@ -181,8 +181,8 @@ class ActionStack :public GuiLayer{
int has(Interruptible * action); int has(Interruptible * action);
int has(MTGAbility * ability); int has(MTGAbility * ability);
int receiveEventPlus(WEvent * event); int receiveEventPlus(WEvent * event);
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
void Dump(); void Dump();
#endif #endif
}; };

View File

@@ -51,7 +51,7 @@ public:
Task(char _type = ' '); Task(char _type = ' ');
static Task* createFromStr(string params, bool rand = FALSE); static Task* createFromStr(string params, bool rand = false);
virtual string toString(); virtual string toString();
string getDesc(); string getDesc();
virtual string createDesc() = 0; virtual string createDesc() = 0;
@@ -89,7 +89,7 @@ public:
int load(string _fileName = ""); int load(string _fileName = "");
int save(string _fileName = ""); int save(string _fileName = "");
int getState() {return mState;}; int getState() {return mState;};
void addTask(string params, bool rand = FALSE); void addTask(string params, bool rand = false);
void addTask(Task *task); void addTask(Task *task);
void addRandomTask(int diff = 100); void addRandomTask(int diff = 100);
void removeTask(Task *task); void removeTask(Task *task);

View File

@@ -3,7 +3,7 @@
#include <JGE.h> #include <JGE.h>
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
#else #else
#include <pspkernel.h> #include <pspkernel.h>

View File

@@ -1091,7 +1091,7 @@ void ActionStack::Render()
} }
} }
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
void Interruptible::Dump() void Interruptible::Dump()
{ {

View File

@@ -3,7 +3,7 @@
#include <JGE.h> #include <JGE.h>
#include <JLogger.h> #include <JLogger.h>
#include <JRenderer.h> #include <JRenderer.h>
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
#include <time.h> #include <time.h>
#else #else
#include <pspfpu.h> #include <pspfpu.h>
@@ -78,7 +78,7 @@ GameApp::~GameApp()
void GameApp::Create() void GameApp::Create()
{ {
srand((unsigned int) time(0)); // initialize random srand((unsigned int) time(0)); // initialize random
#ifndef QT_CONFIG #if not defined(QT_CONFIG) && not defined(IOS)
#if defined (WIN32) #if defined (WIN32)
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#elif not defined (LINUX) #elif not defined (LINUX)

View File

@@ -278,7 +278,7 @@ int GameStateMenu::nextDirectory(const char * root, const char * file)
int found = 0; int found = 0;
if (!mDip) if (!mDip)
{ {
mDip = opendir(root); mDip = opendir(JGE_GET_RES(root).c_str());
} }
while (!found && (mDit = readdir(mDip))) while (!found && (mDit = readdir(mDip)))

View File

@@ -55,7 +55,7 @@ Task::Task(char _type)
{ {
reward = 0; reward = 0;
expiresIn = 1; expiresIn = 1;
accepted = FALSE; accepted = false;
if (_type == ' ') if (_type == ' ')
{ {
type = TASK_BASIC; type = TASK_BASIC;
@@ -603,7 +603,7 @@ void TaskList::addRandomTask(int diff)
string s(TASKS_ALL); string s(TASKS_ALL);
char taskType[2]; char taskType[2];
sprintf(taskType, "%c", s[rand() % s.length()]); sprintf(taskType, "%c", s[rand() % s.length()]);
addTask(string(taskType), TRUE); addTask(string(taskType), true);
} }
TaskList::~TaskList() TaskList::~TaskList()
@@ -742,7 +742,7 @@ TaskDelay::TaskDelay(int _opponent, int _turn) :
{ {
type = TASK_DELAY; type = TASK_DELAY;
turn = _turn; turn = _turn;
afterTurn = TRUE; afterTurn = true;
} }
int TaskDelay::computeReward() int TaskDelay::computeReward()

View File

@@ -10,7 +10,7 @@ using std::map;
static map<const LocalKeySym, KeyRep> fattable; static map<const LocalKeySym, KeyRep> fattable;
static map<const JButton, KeyRep> slimtable; static map<const JButton, KeyRep> slimtable;
#ifdef LINUX #if defined(LINUX) || defined (IOS)
const KeyRep& translateKey(LocalKeySym key) const KeyRep& translateKey(LocalKeySym key)
{ {
{ {
@@ -20,7 +20,7 @@ const KeyRep& translateKey(LocalKeySym key)
} }
char* str = NULL; char* str = NULL;
#ifndef QT_CONFIG #if not defined(QT_CONFIG) && not defined(IOS)
str = XKeysymToString(key); str = XKeysymToString(key);
#endif // QT_CONFIG #endif // QT_CONFIG
if (!str) if (!str)

View File

@@ -233,7 +233,7 @@ unsigned long WCachedTexture::size()
if (!texture) return 0; if (!texture) return 0;
unsigned int pixel_size = 4; unsigned int pixel_size = 4;
#if defined WIN32 || defined LINUX #if defined WIN32 || defined LINUX || defined IOS
#else #else
pixel_size = JRenderer::GetInstance()->PixelSize(texture->mTextureFormat); pixel_size = JRenderer::GetInstance()->PixelSize(texture->mTextureFormat);
#endif #endif

View File

@@ -249,7 +249,7 @@ int WFBFont::PreCacheChar(const u8 *ch)
int index = mCurr++; int index = mCurr++;
if (mCurr >= mCacheSize) mCurr = 0; if (mCurr >= mCacheSize) mCurr = 0;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
int x = 0; int x = 0;
int y = 0; int y = 0;
memset(mCharBuffer, 0, sizeof(u32) * mFontSize * mFontSize); memset(mCharBuffer, 0, sizeof(u32) * mFontSize * mFontSize);
@@ -285,7 +285,7 @@ int WFBFont::PreCacheChar(const u8 *ch)
#if 1 #if 1
for (; j < offset; j++) for (; j < offset; j++)
{ {
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
mCharBuffer[y * mFontSize + x] = ARGB(0, 0, 0, 0); mCharBuffer[y * mFontSize + x] = ARGB(0, 0, 0, 0);
#else #else
SwizzlePlot(pTexture, ARGB(0, 0, 0, 0), x * PIXEL_SIZE, y, mTexture->mTexWidth * PIXEL_SIZE); SwizzlePlot(pTexture, ARGB(0, 0, 0, 0), x * PIXEL_SIZE, y, mTexture->mTexWidth * PIXEL_SIZE);
@@ -300,7 +300,7 @@ int WFBFont::PreCacheChar(const u8 *ch)
gray = src[(i * size + j - offset) / 2]; gray = src[(i * size + j - offset) / 2];
gray = ((j - offset) & 1) ? (gray & 0xF0) : ((gray & 0x0F) << 4); gray = ((j - offset) & 1) ? (gray & 0xF0) : ((gray & 0x0F) << 4);
if (gray) gray |= 0x0F; if (gray) gray |= 0x0F;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
mCharBuffer[y * mFontSize + x] = ARGB(gray, 255, 255, 255); mCharBuffer[y * mFontSize + x] = ARGB(gray, 255, 255, 255);
#else #else
SwizzlePlot(pTexture, ARGB(gray, 255, 255, 255), x * PIXEL_SIZE, y, mTexture->mTexWidth * PIXEL_SIZE); SwizzlePlot(pTexture, ARGB(gray, 255, 255, 255), x * PIXEL_SIZE, y, mTexture->mTexWidth * PIXEL_SIZE);
@@ -309,7 +309,7 @@ int WFBFont::PreCacheChar(const u8 *ch)
} }
for (; j < mFontSize; j++) for (; j < mFontSize; j++)
{ {
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
mCharBuffer[y * mFontSize + x] = ARGB(0, 0, 0, 0); mCharBuffer[y * mFontSize + x] = ARGB(0, 0, 0, 0);
#else #else
SwizzlePlot(pTexture, ARGB(0, 0, 0, 0), x * PIXEL_SIZE, y, mTexture->mTexWidth * PIXEL_SIZE); SwizzlePlot(pTexture, ARGB(0, 0, 0, 0), x * PIXEL_SIZE, y, mTexture->mTexWidth * PIXEL_SIZE);
@@ -321,7 +321,7 @@ int WFBFont::PreCacheChar(const u8 *ch)
mGBCode[index] = code; mGBCode[index] = code;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
x = (int)mSprites[index]->mX; x = (int)mSprites[index]->mX;
y = (int)mSprites[index]->mY; y = (int)mSprites[index]->mY;
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, mFontSize, mFontSize, GL_RGBA, GL_UNSIGNED_BYTE, mCharBuffer); glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, mFontSize, mFontSize, GL_RGBA, GL_UNSIGNED_BYTE, mCharBuffer);
@@ -601,7 +601,7 @@ WGBKFont::WGBKFont(int inFontID, const char *fontname, int lineheight, bool useV
mSprites = NEW JQuad*[mCacheSize]; mSprites = NEW JQuad*[mCacheSize];
mGBCode = NEW int[mCacheSize]; mGBCode = NEW int[mCacheSize];
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
mCharBuffer = NEW u32[mFontSize*mFontSize]; mCharBuffer = NEW u32[mFontSize*mFontSize];
#endif #endif
@@ -657,7 +657,7 @@ int WGBKFont::PreCacheChar(const u8 *ch)
int index = mCurr++; int index = mCurr++;
if (mCurr >= mCacheSize) mCurr = 0; if (mCurr >= mCacheSize) mCurr = 0;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
int x = 0; int x = 0;
int y = 0; int y = 0;
memset(mCharBuffer, 0, sizeof(u32) * mFontSize * mFontSize); memset(mCharBuffer, 0, sizeof(u32) * mFontSize * mFontSize);
@@ -685,7 +685,7 @@ int WGBKFont::PreCacheChar(const u8 *ch)
// set up the font texture buffer // set up the font texture buffer
for (unsigned int i = 0; i < mFontSize; i++) for (unsigned int i = 0; i < mFontSize; i++)
{ {
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
x = 0; x = 0;
#else #else
x = (int) mSprites[index]->mX; x = (int) mSprites[index]->mX;
@@ -694,7 +694,7 @@ int WGBKFont::PreCacheChar(const u8 *ch)
#if 1 #if 1
for (; j < offset; j++) for (; j < offset; j++)
{ {
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
mCharBuffer[y * mFontSize + x] = ARGB(0, 0, 0, 0); mCharBuffer[y * mFontSize + x] = ARGB(0, 0, 0, 0);
#else #else
SwizzlePlot(pTexture, ARGB(0, 0, 0, 0), x * PIXEL_SIZE, y, mTexture->mTexWidth * PIXEL_SIZE); SwizzlePlot(pTexture, ARGB(0, 0, 0, 0), x * PIXEL_SIZE, y, mTexture->mTexWidth * PIXEL_SIZE);
@@ -709,7 +709,7 @@ int WGBKFont::PreCacheChar(const u8 *ch)
gray = src[(i * size + j - offset) / 2]; gray = src[(i * size + j - offset) / 2];
gray = ((j - offset) & 1) ? (gray & 0xF0) : ((gray & 0x0F) << 4); gray = ((j - offset) & 1) ? (gray & 0xF0) : ((gray & 0x0F) << 4);
if (gray) gray |= 0x0F; if (gray) gray |= 0x0F;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
mCharBuffer[y * mFontSize + x] = ARGB(gray, 255, 255, 255); mCharBuffer[y * mFontSize + x] = ARGB(gray, 255, 255, 255);
#else #else
SwizzlePlot(pTexture, ARGB(gray, 255, 255, 255), x * PIXEL_SIZE, y, mTexture->mTexWidth * PIXEL_SIZE); SwizzlePlot(pTexture, ARGB(gray, 255, 255, 255), x * PIXEL_SIZE, y, mTexture->mTexWidth * PIXEL_SIZE);
@@ -718,7 +718,7 @@ int WGBKFont::PreCacheChar(const u8 *ch)
} }
for (; j < mFontSize; j++) for (; j < mFontSize; j++)
{ {
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
mCharBuffer[y * mFontSize + x] = ARGB(0, 0, 0, 0); mCharBuffer[y * mFontSize + x] = ARGB(0, 0, 0, 0);
#else #else
SwizzlePlot(pTexture, ARGB(0, 0, 0, 0), x * PIXEL_SIZE, y, mTexture->mTexWidth * PIXEL_SIZE); SwizzlePlot(pTexture, ARGB(0, 0, 0, 0), x * PIXEL_SIZE, y, mTexture->mTexWidth * PIXEL_SIZE);
@@ -730,7 +730,7 @@ int WGBKFont::PreCacheChar(const u8 *ch)
mGBCode[index] = code; mGBCode[index] = code;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
x = (int)mSprites[index]->mX; x = (int)mSprites[index]->mX;
y = (int)mSprites[index]->mY; y = (int)mSprites[index]->mY;
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, mFontSize, mFontSize, GL_RGBA, GL_UNSIGNED_BYTE, mCharBuffer); glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, mFontSize, mFontSize, GL_RGBA, GL_UNSIGNED_BYTE, mCharBuffer);

View File

@@ -43,7 +43,7 @@ int WRand()
int filesize(const char * filename) int filesize(const char * filename)
{ {
int file_size = 0; int file_size = 0;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX) || defined (IOS)
FILE * file = fopen(filename, "rb"); FILE * file = fopen(filename, "rb");
if (file != NULL) if (file != NULL)
{ {

View File

@@ -84,7 +84,6 @@ SOURCES += \
src/GuiPhaseBar.cpp\ src/GuiPhaseBar.cpp\
src/GuiPlay.cpp\ src/GuiPlay.cpp\
src/GuiStatic.cpp\ src/GuiStatic.cpp\
src/Logger.cpp\
src/ManaCost.cpp\ src/ManaCost.cpp\
src/ManaCostHybrid.cpp\ src/ManaCostHybrid.cpp\
src/MenuItem.cpp\ src/MenuItem.cpp\
@@ -110,6 +109,7 @@ SOURCES += \
src/SimpleMenu.cpp\ src/SimpleMenu.cpp\
src/SimpleMenuItem.cpp\ src/SimpleMenuItem.cpp\
src/SimplePad.cpp\ src/SimplePad.cpp\
src/SimplePopup.cpp\
src/StoryFlow.cpp\ src/StoryFlow.cpp\
src/Subtypes.cpp\ src/Subtypes.cpp\
src/StyleManager.cpp\ src/StyleManager.cpp\
@@ -234,6 +234,7 @@ HEADERS += \
include/StyleManager.h\ include/StyleManager.h\
include/WFont.h\ include/WFont.h\
include/DeckManager.h\ include/DeckManager.h\
include/SimplePopup.h\
include/SimpleMenu.h include/SimpleMenu.h
# JGE, could probably be moved outside # JGE, could probably be moved outside