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_
#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()
#include <stdio.h>
@@ -19,7 +19,7 @@
#include <map>
#include <string>
#if defined (WIN32) || defined (LINUX)
#if defined (WIN32) || defined (LINUX) || defined(IOS)
#else
#include <pspiofilemgr.h>
@@ -130,7 +130,7 @@ private:
char *mPassword;
bool mZipAvailable;
void preloadZip(string filename);
#if defined (WIN32) || defined (LINUX)
#if defined (WIN32) || defined (LINUX) || defined(IOS)
FILE *mFile;
#else
SceUID mFile;

View File

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

View File

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

View File

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

View File

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

View File

@@ -16,7 +16,9 @@
#include <string.h>
#include <stdarg.h>
#ifndef IOS
#include <gif_lib.h>
#endif //IOS
#include "JTypes.h"
@@ -25,7 +27,7 @@
#include <windows.h>
#elif defined (LINUX)
#elif defined (LINUX) || defined(IOS)
#else
@@ -78,7 +80,7 @@ protected:
public:
#if defined (WIN32) || defined (LINUX)
#if defined (WIN32) || defined (LINUX) || defined (IOS)
#else
int PixelSize(int textureMode);
#endif
@@ -560,16 +562,17 @@ private:
bool mVRAM;
};
#ifndef IOS
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);
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 //(IOS)
static JRenderer* mInstance;
#if defined (WIN32) || defined (LINUX)
#if defined (WIN32) || defined (LINUX) || defined (IOS)
GLuint mCurrentTex;
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) || (defined WIN32)
// MVP matrix

View File

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

View File

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

View File

@@ -11,7 +11,7 @@
#ifndef _JTYPES_H
#define _JTYPES_H
#if defined (WIN32) || defined (LINUX)
#if defined (WIN32) || defined (LINUX) || defined (IOS)
#include <stdint.h>
@@ -81,15 +81,24 @@ enum {
#ifdef WIN32
#include <windows.h>
#endif
#ifdef LINUX
#if defined(LINUX) || defined(IOS)
typedef uint8_t byte;
typedef uint32_t DWORD;
typedef uint8_t BYTE;
typedef bool BOOL;
#ifndef IOS
typedef bool BOOL;
#endif
#endif
#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/glu.h>
#endif
@@ -97,7 +106,7 @@ enum {
# include <QtOpenGL>
#endif
#if defined (WIN32) || defined (LINUX)
#if defined (WIN32) || defined (LINUX) || defined (IOS)
typedef int8_t s8;
typedef int16_t s16;
@@ -329,7 +338,7 @@ public:
int mFilter;
#if defined (WIN32) || defined (LINUX)
#if defined (WIN32) || defined (LINUX) || defined (IOS)
GLuint mTexId;
#else
int mTextureFormat;
@@ -439,7 +448,7 @@ public:
JTexture* mTex;
#if defined (WIN32) || defined(LINUX)
#if defined (WIN32) || defined(LINUX) || defined(IOS)
float mTX0;
float mTY0;
float mTX1;
@@ -499,7 +508,7 @@ public:
//------------------------------------------------------------------------------------------------
class Rect
class JgeRect
{
public:
int x;
@@ -508,7 +517,7 @@ public:
int height;
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
#include <math.h>
#elif defined LINUX
#elif (defined LINUX) || (defined IOS)
#include <math.h>
#else
#include <fastmath.h>