* Update for linux support.
This commit is contained in:
jean.chalard
2008-11-05 13:38:39 +00:00
parent 89dae65237
commit ddf04e14e8
39 changed files with 975 additions and 786 deletions
+114 -16
View File
@@ -1,20 +1,118 @@
all: ifeq ($(MAKECMDGOALS),debug)
$(MAKE) -f Makefile.1xx install DEBUG = true
$(MAKE) -f Makefile.hge install endif
$(MAKE) -f Makefile.input install
1xx:
$(MAKE) -f Makefile.1xx install
$(MAKE) -f Makefile.hge install
$(MAKE) -f Makefile.input install
3xx: GENERIC_OBJS = src/JApp.o src/JGBKFont.o \
$(MAKE) -f Makefile.3xx install src/JGE.o src/JGui.o src/JLBFont.o \
$(MAKE) -f Makefile.hge install src/JGameObject.o src/JSpline.o src/JAnimator.o \
$(MAKE) -f Makefile.input install src/JResourceManager.o src/JFileSystem.o \
src/JParticle.o src/JParticleEmitter.o src/JParticleEffect.o \
src/JParticleSystem.o \
src/unzip/ioapi.o src/unzip/mztools.o src/unzip/unzip.o \
src/JSprite.o src/Vector2D.o \
src/tinyxml/tinystr.o src/tinyxml/tinyxml.o \
src/tinyxml/tinyxmlparser.o src/tinyxml/tinyxmlerror.o \
src/Encoding.o src/JTTFont.o \
src/JMD2Model.o src/JOBJModel.o src/vram.o
PSP_OBJS = src/JGfx.o src/JSfx.o src/main.o
LINUX_OBJS = src/linux/JGfx.o src/linux/JSfx.o src/linuxmain.o
HGE_OBJS = src/hge/hgecolor.o src/hge/hgeparticle.o \
src/hge/hgerect.o src/hge/hgevector.o \
src/hge/hgedistort.o src/hge/hgefont.o
CXXFLAGS = -W -Wall -Werror
ifdef DEBUG
CXXFLAGS += -ggdb3
endif
# Determination of target.
# TARGET_ARCHITECTURE variable will then be set to either linux or psp.
RESULT = $(shell which psp-config)
ifeq ($(RESULT),)
DEFAULT_RULE = linux
TARGET_ARCHITECTURE = linux
else
DEFAULT_RULE = 3xx
TARGET_ARCHITECTURE = psp
TARGET_LIB = libjge300.a
endif
ifeq ($(MAKECMDGOALS),linux)
DEFAULT_RULE = linux
TARGET_ARCHITECTURE = linux
endif
ifeq ($(MAKECMDGOALS),3xx)
DEFAULT_RULE = 3xx
TARGET_ARCHITECTURE = psp
TARGET_LIB = libjge300.a
endif
ifeq ($(MAKECMDGOALS),1xx)
DEFAULT_RULE = 1xx
OBJS = $(GENERIC_OBJS) $(PSP_OBJS)
TARGET_LIB = libjge100.a
TARGET_ARCHITECTURE = psp
CXXFLAGS += -DDEVHOOK -DPSPFW3XX
endif
ifeq ($(TARGET_ARCHITECTURE),psp)
PSPSDK = $(shell psp-config --pspsdk-path)
PSPDIR = $(shell psp-config --psp-prefix)
OBJS = $(GENERIC_OBJS) $(PSP_OBJS)
TARGET_HGE = libhgetools.a
INCDIR = -I include/psp include/psp/freetype2
CXXFLAGS += -G0
LIBDIR = lib/psp
LIBS = -lgif -lfreetype -ljpeg -lpng -lz -lmikmod -lpsppower -lpspmpeg -lpspaudiocodec -lpspaudiolib -lpspaudio -lpspgum -lpspgu -lpsprtc -lm -lstdc++
endif
ifeq ($(TARGET_ARCHITECTURE),linux)
OBJS = $(GENERIC_OBJS) $(LINUX_OBJS)
TARGET_LIB = libjge.a
TARGET_HGE = libhgetools.a
INCDIR = $(shell freetype-config --cflags)
CXXFLAGS += -DLINUX
LIBDIR = lib/linux
endif
# Set definitive values for variables.
CXXFLAGS := $(INCDIR) $(CXXFLAGS)
LDFLAGS := $(LIBS)
TARGET_LIB := $(LIBDIR)/$(TARGET_LIB)
TARGET_HGE := $(LIBDIR)/$(TARGET_HGE)
ifeq ($(TARGET_ARCHITECTURE),psp)
include $(PSPSDK)/lib/build.mak
endif
all: $(DEFAULT_RULE) hge
debug: $(DEFAULT_RULE) hge
linux: $(TARGET_LIB)
@echo Making for Linux.
3xx: $(TARGET_LIB)
@echo Making for 3xx.
1xx: $(TARGET_LIB)
@echo Making for 1xx.
install: $(TARGET_LIB) hge
hge: $(TARGET_HGE)
clean: clean:
$(MAKE) -f Makefile.1xx clean rm -f $(OBJS) $(HGE_OBJS)
$(MAKE) -f Makefile.3xx clean
$(MAKE) -f Makefile.hge clean ifeq ($(TARGET_ARCHITECTURE),linux)
$(MAKE) -f Makefile.input clean $(TARGET_LIB): $(OBJS)
ar r $(TARGET_LIB) $(OBJS)
$(TARGET_HGE): $(HGE_OBJS)
ar r $(TARGET_HGE) $(HGE_OBJS)
endif
+1 -1
View File
@@ -25,7 +25,7 @@ CFLAGS = -O2 -G0 -Wall -DDEVHOOK -DPSPFW3XX
LIBS = -lgif -lfreetype -ljpeg -lpng -lz -lmikmod -lpsppower -lpspmpeg -lpspaudiocodec -lpspaudiolib -lpspaudio -lpspgum -lpspgu -lpsprtc -lm -lstdc++ LIBS = -lgif -lfreetype -ljpeg -lpng -lz -lmikmod -lpsppower -lpspmpeg -lpspaudiocodec -lpspaudiolib -lpspaudio -lpspgum -lpspgu -lpsprtc -lm -lstdc++
include $(PSPSDK)/lib/build.mak #include $(PSPSDK)/lib/build.mak
install: $(TARGET_LIB) install: $(TARGET_LIB)
@cp libjge300.a lib/psp @cp libjge300.a lib/psp
+34
View File
@@ -0,0 +1,34 @@
TARGET_LIB = libjge300.a
OBJS = src/JApp.o src/JGBKFont.o \
src/linux/JGfx.o \
src/JGui.o \
src/JGE.o \
src/JLBFont.o \
src/linux/JSfx.o \
src/JGameObject.o src/JSpline.o src/JAnimator.o \
src/JResourceManager.o \
src/JFileSystem.o \
src/JParticle.o src/JParticleEmitter.o src/JParticleEffect.o src/JParticleSystem.o \
src/unzip/ioapi.o src/unzip/mztools.o src/unzip/unzip.o \
src/JSprite.o src/Vector2D.o \
src/tinyxml/tinystr.o src/tinyxml/tinyxml.o \
src/tinyxml/tinyxmlparser.o src/tinyxml/tinyxmlerror.o \
src/linuxmain.o src/vram.o \
src/Encoding.o src/JTTFont.o \
src/JMD2Model.o src/JOBJModel.o
INCDIR = -I /usr/include/freetype2
LIBDIR = lib/psp
CXXFLAGS = $(INCDIR) -W -Wall -Werror -DDEVHOOK -DLINUX -ggdb3
LIBS = -lgif -lfreetype -ljpeg -lpng -lz -lmikmod -lpsppower -lpspmpeg -lpspaudiocodec -lpspaudiolib -lpspaudio -lpspgum -lpspgu -lpsprtc -lm -lstdc++
#include $(PSPSDK)/lib/build.mak
install: $(TARGET_LIB)
@cp libjge300.a lib/linux
@echo "Done"
$(TARGET_LIB): $(OBJS)
ar r $(TARGET_LIB) $(OBJS)
+2 -2
View File
@@ -16,7 +16,7 @@
#include <map> #include <map>
#include <string> #include <string>
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
#else #else
#include <pspiofilemgr.h> #include <pspiofilemgr.h>
@@ -113,7 +113,7 @@ private:
string mZipFileName; string mZipFileName;
char *mPassword; char *mPassword;
bool mZipAvailable; bool mZipAvailable;
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
FILE *mFile; FILE *mFile;
#else #else
SceUID mFile; SceUID mFile;
+9 -2
View File
@@ -32,6 +32,13 @@
bool JGEGetButtonState(u32 button); bool JGEGetButtonState(u32 button);
bool JGEGetButtonClick(u32 button); bool JGEGetButtonClick(u32 button);
#elif LINUX
void JGEControl();
BOOL JGEGetKeyState(int key);
bool JGEGetButtonState(uint32_t button);
bool JGEGetButtonClick(uint32_t button);
#else #else
#include <pspgu.h> #include <pspgu.h>
@@ -73,7 +80,7 @@ private:
// JMotionSystem* mMotionSystem; // JMotionSystem* mMotionSystem;
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
float mDeltaTime; float mDeltaTime;
JMusic *mCurrentMusic; JMusic *mCurrentMusic;
@@ -206,7 +213,7 @@ public:
void Assert(const char *filename, long lineNumber); void Assert(const char *filename, long lineNumber);
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
void SetDelta(int delta); void SetDelta(int delta);
#endif #endif
-2
View File
@@ -12,8 +12,6 @@
#ifndef _JGUI_H #ifndef _JGUI_H
#define _JGUI_H #define _JGUI_H
#include "JGE.h" #include "JGE.h"
#include "JSprite.h" #include "JSprite.h"
+2 -2
View File
@@ -11,7 +11,7 @@
#ifndef _MD2MODEL_H #ifndef _MD2MODEL_H
#define _MD2MODEL_H #define _MD2MODEL_H
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
#else #else
@@ -236,7 +236,7 @@ private:
void CheckNextState(); void CheckNextState();
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
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);
+1 -1
View File
@@ -15,7 +15,7 @@
using namespace std; using namespace std;
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
#else #else
+4 -2
View File
@@ -21,10 +21,12 @@
#include "JTypes.h" #include "JTypes.h"
#ifdef WIN32 #if defined (WIN32)
#include <windows.h> #include <windows.h>
#elif defined (LINUX)
#else #else
#include <pspgu.h> #include <pspgu.h>
@@ -533,7 +535,7 @@ private:
static JRenderer* mInstance; static JRenderer* mInstance;
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
GLuint mCurrentTex; GLuint mCurrentTex;
+3 -3
View File
@@ -22,7 +22,7 @@
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
#elif defined (LINUX)
#else #else
#include <pspgu.h> #include <pspgu.h>
@@ -48,7 +48,7 @@ public:
JMusic(); JMusic();
~JMusic(); ~JMusic();
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
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
JCooleyesMP3* mTrack; JCooleyesMP3* mTrack;
@@ -66,7 +66,7 @@ public:
int mVoice; int mVoice;
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
FSOUND_SAMPLE *mSample; FSOUND_SAMPLE *mSample;
#else #else
WAVDATA *mSample; WAVDATA *mSample;
+1 -1
View File
@@ -11,7 +11,7 @@
#ifndef _SPRITE_H_ #ifndef _SPRITE_H_
#define _SPRITE_H_ #define _SPRITE_H_
#ifdef WIN32 #if defined (WIN32) || defined(LINUX)
#include <math.h> #include <math.h>
#else #else
#include <fastmath.h> #include <fastmath.h>
+30 -15
View File
@@ -11,7 +11,9 @@
#ifndef _JTYPES_H #ifndef _JTYPES_H
#define _JTYPES_H #define _JTYPES_H
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
#include <sys/types.h>
#else #else
@@ -64,12 +66,19 @@
#define BLEND_OPTION_BLEND GU_TFX_BLEND #define BLEND_OPTION_BLEND GU_TFX_BLEND
#endif #endif
#ifdef WIN32
#if defined (WIN32)
#include <windows.h> #include <windows.h>
#include <gl/gl.h> #endif
#include <gl/glu.h> #ifdef LINUX
typedef unsigned char byte;
typedef unsigned long DWORD;
typedef unsigned char BYTE;
typedef bool BOOL;
#endif
#if defined (WIN32) || defined (LINUX)
#include <GL/gl.h>
#include <GL/glu.h>
#include "../Dependencies/include/fmod.h" #include "../Dependencies/include/fmod.h"
@@ -79,13 +88,20 @@
//#define u8 BYTE //#define u8 BYTE
//#define u16 WORD //#define u16 WORD
//#define u32 DWORD //#define u32 DWORD
/*
typedef signed char s8; typedef signed char s8;
typedef signed short s16; typedef signed short s16;
typedef signed long s32; typedef signed long s32;
typedef unsigned char u8; typedef unsigned char u8;
typedef unsigned short u16; typedef unsigned short u16;
//Long ? typedef unsigned long u32;
typedef unsigned int u32; */
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_ZERO GL_ZERO
@@ -103,7 +119,7 @@
#define ARGB(a, r, g, b) ((a << 24) | (r << 16) | (g << 8) | b) #define ARGB(a, r, g, b) ((a << 24) | (r << 16) | (g << 8) | b)
#define RGBA(r, g, b, a) ((a << 24) | (b << 16) | (g << 8) | r) #define RGBA(r, g, b, a) ((a << 24) | (b << 16) | (g << 8) | r)
enum PspCtrlButtons typedef enum PspCtrlButtons
{ {
PSP_CTRL_SELECT = 0x000001, PSP_CTRL_SELECT = 0x000001,
PSP_CTRL_START = 0x000008, PSP_CTRL_START = 0x000008,
@@ -119,8 +135,8 @@
PSP_CTRL_SQUARE = 0x008000, PSP_CTRL_SQUARE = 0x008000,
PSP_CTRL_HOME = 0x010000, PSP_CTRL_HOME = 0x010000,
PSP_CTRL_HOLD = 0x020000, PSP_CTRL_HOLD = 0x020000,
PSP_CTRL_NOTE = 0x800000, PSP_CTRL_NOTE = 0x800000
}; } PspCtrlButtons;
#define PIXEL_TYPE DWORD #define PIXEL_TYPE DWORD
@@ -191,8 +207,7 @@
#define FRAME_BUFFER_SIZE FRAME_BUFFER_WIDTH*SCREEN_HEIGHT*PIXEL_SIZE #define FRAME_BUFFER_SIZE FRAME_BUFFER_WIDTH*SCREEN_HEIGHT*PIXEL_SIZE
#define SLICE_SIZE_F 64.0f #define SLICE_SIZE_F 64.0f
//LONG ??? typedef unsigned long DWORD;
typedef unsigned int DWORD;
#define BLEND_ZERO 0x1000 #define BLEND_ZERO 0x1000
#define BLEND_ONE 0x1002 #define BLEND_ONE 0x1002
@@ -304,7 +319,7 @@ public:
int mFilter; int mFilter;
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
GLuint mTexId; GLuint mTexId;
#else #else
@@ -414,7 +429,7 @@ public:
JTexture* mTex; JTexture* mTex;
#ifdef WIN32 #if defined (WIN32) || defined(LINUX)
float mTX0; float mTX0;
float mTY0; float mTY0;
float mTX1; float mTX1;
+2
View File
@@ -13,6 +13,8 @@
#ifdef WIN32 #ifdef WIN32
#include <math.h> #include <math.h>
#elif defined LINUX
#include <math.h>
#else #else
#include <fastmath.h> #include <fastmath.h>
#endif #endif
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -3186,7 +3186,7 @@ static int _gbk_mbtowc(ucs4_t *pwc, const u8 *s, int n)
return RET_ILSEQ; return RET_ILSEQ;
} }
static int ascii_mbtowc ( ucs4_t *pwc, const u8 *s, int n) static int ascii_mbtowc ( ucs4_t *pwc, const u8 *s, int n __attribute__((unused)))
{ {
u8 c = *s; u8 c = *s;
if (c < 0x80) { if (c < 0x80) {
+3 -3
View File
@@ -67,7 +67,7 @@ bool JAnimator::Load(const char* scriptFile)
element = script->ToElement(); element = script->ToElement();
printf("---- Loading %s:%s\n", element->Value(), element->Attribute("name")); printf("---- Loading %s:%s\n", element->Value(), element->Attribute("name"));
char *type[] = const char *type[] =
{ {
"ANIMATION_TYPE_LOOPING", "ANIMATION_TYPE_LOOPING",
"ANIMATION_TYPE_ONCE_AND_STAY", "ANIMATION_TYPE_ONCE_AND_STAY",
@@ -317,7 +317,7 @@ void JAnimator::SetHotSpot(float x, float y)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
JAnimatorFrame::JAnimatorFrame(JAnimator* parent) JAnimatorFrame::JAnimatorFrame(JAnimator* parent __attribute__((unused)))
{ {
mTimer = 0.0f; mTimer = 0.0f;
mFrameTime = 100.0f; mFrameTime = 100.0f;
@@ -390,7 +390,7 @@ JAnimatorObject::~JAnimatorObject()
} }
void JAnimatorObject::Update(float dt) void JAnimatorObject::Update(float dt __attribute__((unused)))
{ {
} }
+7 -5
View File
@@ -8,7 +8,9 @@
// //
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
#pragma warning(disable : 4786) #ifndef LINUX
#pragma warning(disable : 4786)
#endif
#include "../include/JGE.h" #include "../include/JGE.h"
#include "../include/JFileSystem.h" #include "../include/JFileSystem.h"
@@ -47,7 +49,7 @@ void JFileSystem::Destroy()
JFileSystem::JFileSystem() JFileSystem::JFileSystem()
{ {
mZipAvailable = false; mZipAvailable = false;
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
mFile = NULL; mFile = NULL;
#else #else
mFile = -1; mFile = -1;
@@ -124,7 +126,7 @@ bool JFileSystem::OpenFile(const string &filename)
} }
else else
{ {
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
mFile = fopen(path.c_str(), "rb"); mFile = fopen(path.c_str(), "rb");
if (mFile != NULL) if (mFile != NULL)
{ {
@@ -156,7 +158,7 @@ void JFileSystem::CloseFile()
if (mZipAvailable && mZipFile != NULL) if (mZipAvailable && mZipFile != NULL)
return; return;
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
if (mFile != NULL) if (mFile != NULL)
fclose(mFile); fclose(mFile);
#else #else
@@ -174,7 +176,7 @@ int JFileSystem::ReadFile(void *buffer, int size)
} }
else else
{ {
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
return fread(buffer, 1, size, mFile); return fread(buffer, 1, size, mFile);
#else #else
return sceIoRead(mFile, buffer, size); return sceIoRead(mFile, buffer, size);
+10 -10
View File
@@ -89,7 +89,7 @@ bool JGBKFont::Init(const char* engFileName, const char* chnFileName, int fontsi
mSprites = new JQuad*[mCacheSize]; mSprites = new JQuad*[mCacheSize];
mGBCode = new int[mCacheSize]; mGBCode = new int[mCacheSize];
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
mCharBuffer = new DWORD[mFontSize*mFontSize]; mCharBuffer = new DWORD[mFontSize*mFontSize];
#endif #endif
@@ -136,7 +136,7 @@ bool JGBKFont::Init(const char* engFileName, const char* chnFileName, int fontsi
} }
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
#else #else
void SwizzlePlot(u8* out, PIXEL_TYPE color, int i, int j, unsigned int width, unsigned int height) void SwizzlePlot(u8* out, PIXEL_TYPE color, int i, int j, unsigned int width, unsigned int height)
{ {
@@ -188,7 +188,7 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
if (mCurr >= mCacheSize) if (mCurr >= mCacheSize)
mCurr = 0; mCurr = 0;
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
int x = 0; int x = 0;
int y = 0; int y = 0;
@@ -213,7 +213,7 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
bitCount = mFontSize; bitCount = mFontSize;
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
x = 0; x = 0;
#else #else
x = (int)mSprites[index]->mX; x = (int)mSprites[index]->mX;
@@ -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++)
{ {
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
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;)
{ {
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
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++)
{ {
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
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, mCacheImageHeight); SwizzlePlot(pTexture, ARGB(0,0,0,0), x*PIXEL_SIZE, y, mTexture->mTexWidth*PIXEL_SIZE, mCacheImageHeight);
@@ -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++)
{ {
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
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++)
{ {
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
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, mCacheImageHeight); SwizzlePlot(pTexture, ARGB(0,0,0,0), x*PIXEL_SIZE, y, mTexture->mTexWidth*PIXEL_SIZE, mCacheImageHeight);
@@ -324,7 +324,7 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
mGBCode[index] = code; mGBCode[index] = code;
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
x = (int)mSprites[index]->mX; x = (int)mSprites[index]->mX;
y = (int)mSprites[index]->mY; y = (int)mSprites[index]->mY;
+57 -25
View File
@@ -19,11 +19,66 @@
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#ifdef WIN32 #if defined (WIN32) // WIN32 specific code
#include "../../Dependencies/include/png.h" #include "../../Dependencies/include/png.h"
#include "../../Dependencies/include/fmod.h" #include "../../Dependencies/include/fmod.h"
int JGE::GetTime(void)
{
return (int)GetTickCount();
}
u8 JGE::GetAnalogX()
{
if (JGEGetKeyState(VK_LEFT)) return 0;
if (JGEGetKeyState(VK_RIGHT)) return 0xff;
return 0x80;
}
u8 JGE::GetAnalogY()
{
if (JGEGetKeyState(VK_UP)) return 0;
if (JGEGetKeyState(VK_DOWN)) return 0xff;
return 0x80;
}
#elif defined (LINUX) // Unix specific code
#include "png.h"
#include "../Dependencies/include/fmod.h"
int JGE::GetTime(void)
{
return (int)time(NULL);
}
u8 JGE::GetAnalogX()
{
/* FIXME
if (JGEGetKeyState(VK_LEFT)) return 0;
if (JGEGetKeyState(VK_RIGHT)) return 0xff;
*/
return 0x80;
}
u8 JGE::GetAnalogY()
{
/* FIXME
if (JGEGetKeyState(VK_UP)) return 0;
if (JGEGetKeyState(VK_DOWN)) return 0xff;
*/
return 0x80;
}
#endif
#if defined (WIN32) || defined (LINUX) // Non-PSP code
JGE::JGE() JGE::JGE()
{ {
@@ -91,12 +146,6 @@ void JGE::SetDelta(int delta)
mDeltaTime = (float)delta / 1000.0f; // change to second mDeltaTime = (float)delta / 1000.0f; // change to second
} }
int JGE::GetTime(void)
{
return (int)GetTickCount();
}
float JGE::GetDelta() float JGE::GetDelta()
{ {
return mDeltaTime; return mDeltaTime;
@@ -125,23 +174,6 @@ bool JGE::GetButtonClick(u32 button)
} }
u8 JGE::GetAnalogX()
{
if (JGEGetKeyState(VK_LEFT)) return 0;
if (JGEGetKeyState(VK_RIGHT)) return 0xff;
return 0x80;
}
u8 JGE::GetAnalogY()
{
if (JGEGetKeyState(VK_UP)) return 0;
if (JGEGetKeyState(VK_DOWN)) return 0xff;
return 0x80;
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#else ///// PSP specified code #else ///// PSP specified code
+3 -3
View File
@@ -25,10 +25,10 @@ JGuiObject::JGuiObject(int id): mId(id)
JGuiObject::~JGuiObject() JGuiObject::~JGuiObject()
{ {
// JGERelease(); // JGERelease();
}; }
bool JGuiObject::Leaving(u32 key) bool JGuiObject::Leaving(u32 key __attribute__((unused)))
{ {
return true; return true;
} }
@@ -52,7 +52,7 @@ int JGuiObject::GetId()
} }
void JGuiObject::Update(float dt) void JGuiObject::Update(float dt __attribute__((unused)))
{ {
} }
+4 -4
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
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
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]);
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
// normalize and specify the normal // normalize and specify the normal
glNormal3f(result[0]/length, result[1]/length, result[2]/length); glNormal3f(result[0]/length, result[1]/length, result[2]/length);
@@ -273,7 +273,7 @@ void JMD2Model::Render(int frameNum)
mRenderer->BindTexture(mModel->modelTex); mRenderer->BindTexture(mModel->modelTex);
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
// display the textured model with proper lighting normals // display the textured model with proper lighting normals
@@ -465,7 +465,7 @@ void JMD2Model::Render()
mRenderer->BindTexture(mModel->modelTex); mRenderer->BindTexture(mModel->modelTex);
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
glBegin(GL_TRIANGLES); glBegin(GL_TRIANGLES);
+1 -1
View File
@@ -34,7 +34,7 @@ int JOBJModel::ReadLine(char *output, const char *buffer, int start, int size)
while (start < size && buffer[start] != '\n' && buffer[start] != '\r') while (start < size && buffer[start] != '\n' && buffer[start] != '\r')
output[index++] = buffer[start++]; output[index++] = buffer[start++];
while (start < size && buffer[start] == '\n' || buffer[start] == '\r') while ((start < size && buffer[start] == '\n') || buffer[start] == '\r')
start++; start++;
output[index] = 0; output[index] = 0;
+5 -7
View File
@@ -90,7 +90,7 @@ bool JParticleEffect::Load(const char* filename)
// FIELD_COUNT // FIELD_COUNT
// }; // };
char* lifeValues[] = const char* lifeValues[] =
{ {
"speed", "speed",
"size", "size",
@@ -104,7 +104,7 @@ bool JParticleEffect::Load(const char* filename)
"gravity" "gravity"
}; };
char* typeNames[] = const char* typeNames[] =
{ {
"POINT", "POINT",
"AREA", "AREA",
@@ -113,7 +113,7 @@ bool JParticleEffect::Load(const char* filename)
"CIRCLE" "CIRCLE"
}; };
char* modeNames[] = const char* modeNames[] =
{ {
"REPEAT", "REPEAT",
"ONCE", "ONCE",
@@ -121,8 +121,6 @@ bool JParticleEffect::Load(const char* filename)
"CONTINUOUS" "CONTINUOUS"
}; };
int i;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// One effect per file only, well, we may extend it later to permit // One effect per file only, well, we may extend it later to permit
// multiple effect definitions: // multiple effect definitions:
@@ -159,7 +157,7 @@ bool JParticleEffect::Load(const char* filename)
else if (strcmp(element->Attribute("blend"), "ADDITIVE")==0) else if (strcmp(element->Attribute("blend"), "ADDITIVE")==0)
mParticleEmitters[mEmitterCount]->SetBlending(BLEND_SRC_ALPHA, BLEND_ONE); mParticleEmitters[mEmitterCount]->SetBlending(BLEND_SRC_ALPHA, BLEND_ONE);
for (i=0;i<sizeof(modeNames)/sizeof(char*);i++) for (unsigned int i=0;i<sizeof(modeNames)/sizeof(char*);i++)
{ {
if (strcmp(element->Attribute("mode"), modeNames[i])==0) if (strcmp(element->Attribute("mode"), modeNames[i])==0)
{ {
@@ -170,7 +168,7 @@ bool JParticleEffect::Load(const char* filename)
break; break;
} }
} }
for (i=0;i<sizeof(typeNames)/sizeof(char*);i++) for (unsigned i=0;i<sizeof(typeNames)/sizeof(char*);i++)
{ {
if (strcmp(element->Attribute("type"), typeNames[i])==0) if (strcmp(element->Attribute("type"), typeNames[i])==0)
{ {
+2 -2
View File
@@ -109,7 +109,7 @@ void JParticleEmitter::SetQuad(JQuad *quad)
void JParticleEmitter::Update(float dt) void JParticleEmitter::Update(float dt)
{ {
JParticleSystem* particleSys = mParent->GetParticleSystem(); // JParticleSystem* particleSys = mParent->GetParticleSystem();
mActiveParticleCount = 0; mActiveParticleCount = 0;
@@ -185,7 +185,7 @@ void JParticleEmitter::Update(float dt)
void JParticleEmitter::EmitParticles(int count) void JParticleEmitter::EmitParticles(int count)
{ {
JParticleSystem* particleSys = mParent->GetParticleSystem(); // JParticleSystem* particleSys = mParent->GetParticleSystem();
JParticleData *dataPtr; JParticleData *dataPtr;
JParticle* particle; JParticle* particle;
+4 -4
View File
@@ -144,7 +144,7 @@ void JSprite::Render()
// //mQuad->SetColor(ARGB(alpha,255,255,255)); // //mQuad->SetColor(ARGB(alpha,255,255,255));
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
mFrames[mCurrentFrame]->SetColor(alpha<<24 | mColor); mFrames[mCurrentFrame]->SetColor(alpha<<24 | mColor);
// mQuad->SetFlip(mFlipped[mCurrentFrame], false); // mQuad->SetFlip(mFlipped[mCurrentFrame], false);
#else #else
@@ -305,7 +305,7 @@ void JSprite::SetHotSpot(float x, float y, int index)
} }
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
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); }
@@ -344,7 +344,7 @@ void JSprite::SetCurrentFrameIndex(int frame)
JQuad* JSprite::GetCurrentFrame() JQuad* JSprite::GetCurrentFrame()
{ {
if (mCurrentFrame < mFrames.size()) if (mCurrentFrame < (signed int)mFrames.size())
return mFrames[mCurrentFrame]; return mFrames[mCurrentFrame];
else else
return NULL; return NULL;
@@ -358,7 +358,7 @@ int JSprite::GetFrameCount()
JQuad* JSprite::GetFrame(int index) JQuad* JSprite::GetFrame(int index)
{ {
if (index < mFrames.size()) if (index < (signed int)mFrames.size())
return mFrames[index]; return mFrames[index];
else else
return NULL; return NULL;
+9 -8
View File
@@ -19,8 +19,9 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H
#pragma comment( lib, "freetype.lib" ) #ifndef LINUX
#pragma comment( lib, "freetype.lib" )
#endif
#include "../include/JGE.h" #include "../include/JGE.h"
#include "../include/JRenderer.h" #include "../include/JRenderer.h"
@@ -257,7 +258,7 @@ int JTTFont::PreCacheChar(u16 ch, u16 cachedCode)
FT_GlyphSlot slot = mFace->glyph; FT_GlyphSlot slot = mFace->glyph;
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
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
@@ -277,7 +278,7 @@ int JTTFont::PreCacheChar(u16 ch, u16 cachedCode)
{ {
int top = mSize-slot->bitmap_top+1; int top = mSize-slot->bitmap_top+1;
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
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;
@@ -302,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];
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
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, mTexHeight); SwizzlePlot(pTexture, ARGB(grey,255,255,255), (xx+j)*PIXEL_SIZE, yy+i, mTexWidth*PIXEL_SIZE, mTexHeight);
@@ -325,7 +326,7 @@ int JTTFont::PreCacheChar(u16 ch, u16 cachedCode)
{ {
if (bits&mask) if (bits&mask)
{ {
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
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, mTexHeight); SwizzlePlot(pTexture, ARGB(255,255,255,255), (xx+j*8+k)*PIXEL_SIZE, yy+i, mTexWidth*PIXEL_SIZE, mTexHeight);
@@ -343,7 +344,7 @@ int JTTFont::PreCacheChar(u16 ch, u16 cachedCode)
mXAdvance[mCurr] = (u8)(slot->advance.x>>6); mXAdvance[mCurr] = (u8)(slot->advance.x>>6);
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
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();
@@ -357,7 +358,7 @@ int JTTFont::PreCacheChar(u16 ch, u16 cachedCode)
if (mCurr >= mMaxCharCount) if (mCurr >= mMaxCharCount)
mCurr = 0; mCurr = 0;
#ifdef WIN32 #if defined (WIN32) || defined (LINUX)
delete [] texBuffer; delete [] texBuffer;
#endif #endif
+1 -1
View File
@@ -133,7 +133,7 @@ void hgeDistortionMesh::SetTextureRect(float x, float y, float w, float h)
} }
} }
void hgeDistortionMesh::SetBlendMode(int blend) void hgeDistortionMesh::SetBlendMode(int blend __attribute__((unused)))
{ {
// quad.blend=blend; // quad.blend=blend;
} }
+1 -1
View File
@@ -24,7 +24,7 @@ const char FNTCHARTAG[] = "Char";
char hgeFont::buffer[256]; char hgeFont::buffer[256];
hgeFont::hgeFont(const char *szFont, bool bMipmap) hgeFont::hgeFont(const char *szFont, bool bMipmap __attribute__((unused)))
{ {
//void *data; //void *data;
DWORD size; DWORD size;
+1 -1
View File
@@ -35,7 +35,7 @@ distribution.
const TiXmlString::size_type TiXmlString::npos = static_cast< size_type >(-1); const TiXmlString::size_type TiXmlString::npos = static_cast< size_type >(-1);
// Null rep. // Null rep.
TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, '\0' }; TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } };
void TiXmlString::reserve (size_type cap) void TiXmlString::reserve (size_type cap)
+1 -1
View File
@@ -353,7 +353,7 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
} }
else else
{ {
while ( *p && IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' ) while ( ( *p && IsWhiteSpace( *p ) ) || *p == '\n' || *p =='\r' )
++p; ++p;
} }