J :
* Update for linux support.
This commit is contained in:
138
JGE/Makefile
138
JGE/Makefile
@@ -1,20 +1,118 @@
|
||||
all:
|
||||
$(MAKE) -f Makefile.1xx install
|
||||
$(MAKE) -f Makefile.hge install
|
||||
$(MAKE) -f Makefile.input install
|
||||
|
||||
1xx:
|
||||
$(MAKE) -f Makefile.1xx install
|
||||
$(MAKE) -f Makefile.hge install
|
||||
$(MAKE) -f Makefile.input install
|
||||
|
||||
3xx:
|
||||
$(MAKE) -f Makefile.3xx install
|
||||
$(MAKE) -f Makefile.hge install
|
||||
$(MAKE) -f Makefile.input install
|
||||
|
||||
clean:
|
||||
$(MAKE) -f Makefile.1xx clean
|
||||
$(MAKE) -f Makefile.3xx clean
|
||||
$(MAKE) -f Makefile.hge clean
|
||||
$(MAKE) -f Makefile.input clean
|
||||
ifeq ($(MAKECMDGOALS),debug)
|
||||
DEBUG = true
|
||||
endif
|
||||
|
||||
|
||||
GENERIC_OBJS = src/JApp.o src/JGBKFont.o \
|
||||
src/JGE.o src/JGui.o src/JLBFont.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/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:
|
||||
rm -f $(OBJS) $(HGE_OBJS)
|
||||
|
||||
ifeq ($(TARGET_ARCHITECTURE),linux)
|
||||
$(TARGET_LIB): $(OBJS)
|
||||
ar r $(TARGET_LIB) $(OBJS)
|
||||
|
||||
$(TARGET_HGE): $(HGE_OBJS)
|
||||
ar r $(TARGET_HGE) $(HGE_OBJS)
|
||||
endif
|
||||
|
||||
@@ -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++
|
||||
|
||||
include $(PSPSDK)/lib/build.mak
|
||||
#include $(PSPSDK)/lib/build.mak
|
||||
|
||||
install: $(TARGET_LIB)
|
||||
@cp libjge300.a lib/psp
|
||||
|
||||
34
JGE/Makefile.linux
Normal file
34
JGE/Makefile.linux
Normal 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)
|
||||
@@ -3,9 +3,9 @@
|
||||
// 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 _FILE_SYSTEM_H_
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
|
||||
#else
|
||||
#include <pspiofilemgr.h>
|
||||
@@ -47,58 +47,58 @@ public:
|
||||
|
||||
static void Destroy();
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Attach ZIP archive to the file system.
|
||||
///
|
||||
/// @param zipfile - Name of ZIP archive.
|
||||
/// @param password - Password for the ZIP archive. Default is NULL.
|
||||
///
|
||||
///
|
||||
/// @return Status of the attach operation.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AttachZipFile(const string &zipfile, char *password = NULL);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Release the attached ZIP archive.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void DetachZipFile();
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Open file for reading.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool OpenFile(const string &filename);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Read data from file.
|
||||
///
|
||||
///
|
||||
/// @param buffer - Buffer for reading.
|
||||
/// @param size - Number of bytes to read.
|
||||
///
|
||||
///
|
||||
/// @return Number of bytes read.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int ReadFile(void *buffer, int size);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get size of file.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int GetFileSize();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Close file.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CloseFile();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set root for all the following file operations
|
||||
///
|
||||
///
|
||||
/// @resourceRoot - New root.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetResourceRoot(const string& resourceRoot);
|
||||
|
||||
@@ -113,7 +113,7 @@ private:
|
||||
string mZipFileName;
|
||||
char *mPassword;
|
||||
bool mZipAvailable;
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
FILE *mFile;
|
||||
#else
|
||||
SceUID mFile;
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
// 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 _JGE_H_
|
||||
@@ -32,12 +32,19 @@
|
||||
bool JGEGetButtonState(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
|
||||
|
||||
#include <pspgu.h>
|
||||
#include <pspkernel.h>
|
||||
#include <pspdisplay.h>
|
||||
#include <pspdebug.h>
|
||||
#include <pspdebug.h>
|
||||
#include <pspctrl.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
@@ -73,11 +80,11 @@ private:
|
||||
// JMotionSystem* mMotionSystem;
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
float mDeltaTime;
|
||||
|
||||
JMusic *mCurrentMusic;
|
||||
|
||||
|
||||
#else
|
||||
SceCtrlData mCtrlPad;
|
||||
u32 mOldButtons;
|
||||
@@ -92,7 +99,7 @@ private:
|
||||
float mDelta;
|
||||
|
||||
bool mDebug;
|
||||
|
||||
|
||||
bool mPaused;
|
||||
|
||||
char mDebuggingMsg[256];
|
||||
@@ -103,7 +110,7 @@ private:
|
||||
|
||||
|
||||
static JGE* mInstance;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@@ -187,7 +194,7 @@ public:
|
||||
/// @return Status of the system.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool IsDone() { return mDone; }
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set the user's core application class.
|
||||
@@ -195,7 +202,7 @@ public:
|
||||
/// @param app - User defined application class.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetApp(JApp *app);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Print debug message.
|
||||
@@ -206,7 +213,7 @@ public:
|
||||
|
||||
void Assert(const char *filename, long lineNumber);
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
void SetDelta(int delta);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#ifndef _JGUI_H
|
||||
#define _JGUI_H
|
||||
|
||||
|
||||
|
||||
#include "JGE.h"
|
||||
#include "JSprite.h"
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
// 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>
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Bitmap font class for LMNOpc's Bitmap Font Builder:
|
||||
/// http://www.lmnopc.com/bitmapfontbuilder/
|
||||
///
|
||||
///
|
||||
/// Two files are used for each font:
|
||||
/// 1: xxx.png, font bitmap.
|
||||
/// 2: xxx.dat, widths for each character
|
||||
@@ -34,11 +34,11 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Constructor.
|
||||
///
|
||||
///
|
||||
/// @param fontname - Name of the font WITHOUT extensions.
|
||||
/// @param lineheight - Font height.
|
||||
/// @param useVideoRAM - Indicate to use video RAM to store the font image or not (PSP only).
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
JLBFont(const char *fontname, int lineheight, bool useVideoRAM=false);
|
||||
|
||||
@@ -46,104 +46,104 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Rendering text to screen.
|
||||
///
|
||||
///
|
||||
/// @param string - text for rendering.
|
||||
/// @param x - X position of text.
|
||||
/// @param y - Y position of text.
|
||||
/// @align - Text aligment.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void DrawString(const char *string, float x, float y, int align=JGETEXT_LEFT);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Rendering text to screen with syntax similar to printf of C/C++.
|
||||
///
|
||||
///
|
||||
/// @param x - X position of text.
|
||||
/// @param y - Y position of text.
|
||||
/// @param format - String formatting.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void printf(float x, float y, const char *format, ...);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set font color.
|
||||
///
|
||||
///
|
||||
/// @param color - color of font.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetColor(PIXEL_TYPE color);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set scale for rendering.
|
||||
///
|
||||
///
|
||||
/// @param scale - Scale for rendering characters.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetScale(float scale);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set angle for rendering.
|
||||
///
|
||||
///
|
||||
/// @param rot - Rotation angle in radian.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetRotation(float rot);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set font tracking.
|
||||
///
|
||||
///
|
||||
/// @param tracking - Font tracking.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetTracking(float tracking);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get font color.
|
||||
///
|
||||
///
|
||||
/// @return Font color.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
PIXEL_TYPE GetColor() const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get rendering scale.
|
||||
///
|
||||
///
|
||||
/// @return Rendering scale.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float GetScale() const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get rendering angle.
|
||||
///
|
||||
///
|
||||
/// @return Rendering angle.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float GetRotation() const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get font tracking.
|
||||
///
|
||||
///
|
||||
/// @return Font tracking.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float GetTracking() const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get height of font.
|
||||
///
|
||||
///
|
||||
/// @return Height of font.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float GetHeight() const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get width of rendering string on screen.
|
||||
///
|
||||
///
|
||||
/// @param string - NULL terminated string.
|
||||
///
|
||||
///
|
||||
/// @return - Width in pixels
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float GetStringWidth(const char *string) const;
|
||||
|
||||
@@ -152,9 +152,9 @@ public:
|
||||
/// is from index 0-127 and the second from 128-255. You should use this
|
||||
/// function to select which set of characters you want to use. The index
|
||||
/// base should be either 0 or 128.
|
||||
///
|
||||
///
|
||||
/// @param base - Base for the character set to use.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetBase(int base);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#ifndef _MD2MODEL_H
|
||||
#define _MD2MODEL_H
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
|
||||
#else
|
||||
|
||||
@@ -236,7 +236,7 @@ private:
|
||||
|
||||
void CheckNextState();
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
void CalculateNormal(float *p1, float *p2, float *p3);
|
||||
#else
|
||||
void CalculateNormal(ScePspFVector3* normal, float *p1, float *p2, float *p3);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
|
||||
#else
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
// 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 _JRENDERER_H_
|
||||
@@ -21,16 +21,18 @@
|
||||
#include "JTypes.h"
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32)
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#elif defined (LINUX)
|
||||
|
||||
#else
|
||||
|
||||
#include <pspgu.h>
|
||||
#include <pspkernel.h>
|
||||
#include <pspdisplay.h>
|
||||
#include <pspdebug.h>
|
||||
#include <pspdebug.h>
|
||||
#include <pspctrl.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
@@ -54,7 +56,7 @@
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// A collection of core rendering functions.
|
||||
/// A collection of core rendering functions.
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class JRenderer
|
||||
@@ -108,81 +110,81 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Taking a screen shot.
|
||||
///
|
||||
/// @note This function works on PSP only. A PNG file will be saved in
|
||||
///
|
||||
/// @note This function works on PSP only. A PNG file will be saved in
|
||||
/// the current folder of the game applicaton.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void ScreenShot(const char* filename);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Load a texture from file.
|
||||
///
|
||||
///
|
||||
/// @param filename - Name of file.
|
||||
/// @param mode - Choose to put texture in VRAM (PSP only).
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
JTexture* LoadTexture(const char* filename, int mode = 0);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Create texture from memory on the fly.
|
||||
///
|
||||
///
|
||||
/// @param width - Width of texture.
|
||||
/// @param height - Height of texture.
|
||||
/// @param mode - Choose to put texture in VRAM (PSP only)
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
JTexture* CreateTexture(int width, int height, int mode = 0);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Clear entire screen to a particular color.
|
||||
///
|
||||
///
|
||||
/// @param color - Color to fill the screen.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void ClearScreen(PIXEL_TYPE color);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Enable VSync for the smoothness of moving objects. (PSP only)
|
||||
///
|
||||
///
|
||||
/// @param flag - true to enable, false to disable.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void EnableVSync(bool flag);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Enable bi-linear filtering for better looking on-screen images.
|
||||
///
|
||||
///
|
||||
/// @param flag - true to enable, false to disable.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void EnableTextureFilter(bool flag);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Remove all textures from VRAM (PSP only)
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void ResetPrivateVRAM();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Enable/disable swizzle optimization. (PSP only)
|
||||
///
|
||||
///
|
||||
/// @param s - 1 to enable, 0 to disable.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetSwizzle(int s) { mSwizzle = s; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Bind texture to be used for the rendering followed.
|
||||
///
|
||||
///
|
||||
/// @param tex - Texture to use.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void BindTexture(JTexture *tex);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set texture blending options.
|
||||
///
|
||||
///
|
||||
/// @par Blending options:
|
||||
///
|
||||
/// @code
|
||||
@@ -193,9 +195,9 @@ public:
|
||||
/// BLEND_ONE_MINUS_SRC_COLOR
|
||||
/// BLEND_SRC_ALPHA
|
||||
/// BLEND_ONE_MINUS_SRC_ALPHA
|
||||
/// BLEND_DST_ALPHA
|
||||
/// BLEND_DST_ALPHA
|
||||
/// BLEND_ONE_MINUS_DST_ALPHA
|
||||
/// BLEND_DST_COLOR
|
||||
/// BLEND_DST_COLOR
|
||||
/// BLEND_ONE_MINUS_DST_COLOR
|
||||
/// BLEND_SRC_ALPHA_SATURATE
|
||||
///
|
||||
@@ -203,29 +205,29 @@ public:
|
||||
///
|
||||
/// @param src - Blending option for source image.
|
||||
/// @param dest - Blending option for destination image.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetTexBlend(int src, int dest);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set texture blending option for source image.
|
||||
///
|
||||
///
|
||||
/// @param src - Blending option for source image.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetTexBlendSrc(int src);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set texture blending option for destination image.
|
||||
///
|
||||
///
|
||||
/// @param dest - Blending option for destination image.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetTexBlendDest(int dest);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Enable rendering in 2D mode.
|
||||
///
|
||||
///
|
||||
/// @note To be implemented.
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -236,7 +238,7 @@ public:
|
||||
/// Enable rendering in 3D mode.
|
||||
///
|
||||
/// @note To be implemented.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Enable3D();
|
||||
|
||||
@@ -244,12 +246,12 @@ public:
|
||||
/// Restrict all rendering to a rectangular area.
|
||||
///
|
||||
/// @note This is just the glScissor() function of OpenGL.
|
||||
///
|
||||
///
|
||||
/// @param x - Left of the clipping area.
|
||||
/// @param y - Top of the clipping area.
|
||||
/// @param width - Width of the clipping area.
|
||||
/// @param height - Height of the clipping area.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetClip(int x, int y, int width, int height);
|
||||
|
||||
@@ -271,52 +273,52 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Rotate along X axis.
|
||||
///
|
||||
///
|
||||
/// @param angle - Angle to rotate ( in radians).
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void RotateX(float angle);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Rotate along Y axis.
|
||||
///
|
||||
///
|
||||
/// @param angle - Angle to rotate ( in radians).
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void RotateY(float angle);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Rotate along Z axis.
|
||||
///
|
||||
///
|
||||
/// @param angle - Angle to rotate ( in radians).
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void RotateZ(float angle);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Push matrix.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void PushMatrix();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Pop matrix.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void PopMatrix();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set the field of view angle (in degrees), effective at the next
|
||||
/// Enable3D() call.
|
||||
///
|
||||
///
|
||||
/// @param fov - The field of view angle (in degrees).
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetFOV(float fov);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Render triangles.
|
||||
///
|
||||
///
|
||||
/// @param texture - Texture for the triangles.
|
||||
/// @param tris - List of triangles.
|
||||
/// @param start - starting index (Note: Index of triangles, NOT vertices).
|
||||
@@ -370,7 +372,7 @@ public:
|
||||
/// @param x2 - Ending vertex, x.
|
||||
/// @param y2 - Ending vertex, y.
|
||||
/// @param color - Filling color.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void DrawLine(float x1, float y1, float x2, float y2, PIXEL_TYPE color);
|
||||
|
||||
@@ -383,23 +385,23 @@ public:
|
||||
/// @param y2 - Ending vertex, y.
|
||||
/// @param lineWidth - Line width.
|
||||
/// @param color - Filling color.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void DrawLine(float x1, float y1, float x2, float y2, float lineWidth, PIXEL_TYPE color);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Plot a pixel on screen.
|
||||
///
|
||||
///
|
||||
/// @param x - X position of the pixel.
|
||||
/// @param y - Y position of the pixel.
|
||||
/// @param color - Draw colour.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Plot(float x, float y, PIXEL_TYPE color);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Plot an array of pixels.
|
||||
///
|
||||
///
|
||||
/// @param x - Array of X positions.
|
||||
/// @param y - Array of Y positions.
|
||||
/// @param count - Number of pixels to plot.
|
||||
@@ -410,7 +412,7 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Draw polygon with filled colour.
|
||||
///
|
||||
///
|
||||
/// @param x - Array of X positions.
|
||||
/// @param y - Array of Y positions.
|
||||
/// @param count - Side count of the polygon.
|
||||
@@ -421,7 +423,7 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Draw polygon.
|
||||
///
|
||||
///
|
||||
/// @param x - Array of X positions.
|
||||
/// @param y - Array of Y positions.
|
||||
/// @param count - Side count of the polygon.
|
||||
@@ -429,10 +431,10 @@ public:
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void DrawPolygon(float* x, float* y, int count, PIXEL_TYPE color);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Draw symmetric polygon with certain number of sides.
|
||||
///
|
||||
///
|
||||
/// @param x - X positions of center of the polygon.
|
||||
/// @param y - Y positions of center of the polygon.
|
||||
/// @param size - Size of polygon.
|
||||
@@ -445,7 +447,7 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Draw solid symmetric polygon with certain number of sides.
|
||||
///
|
||||
///
|
||||
/// @param x - X positions of center of the polygon.
|
||||
/// @param y - Y positions of center of the polygon.
|
||||
/// @param size - Size of polygon.
|
||||
@@ -455,10 +457,10 @@ public:
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void FillPolygon(float x, float y, float size, int count, float startingAngle, PIXEL_TYPE color);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Draw circle with filled colour.
|
||||
///
|
||||
///
|
||||
/// @param x - X positions of center of the circle.
|
||||
/// @param y - Y positions of center of the circle.
|
||||
/// @param radius - Radius of circle.
|
||||
@@ -469,7 +471,7 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Draw circle.
|
||||
///
|
||||
///
|
||||
/// @param x - X positions of center of the circle.
|
||||
/// @param y - Y positions of center of the circle.
|
||||
/// @param radius - Radius of circle.
|
||||
@@ -533,11 +535,11 @@ private:
|
||||
static JRenderer* mInstance;
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
|
||||
GLuint mCurrentTex;
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
u32 mVideoBufferStart;
|
||||
@@ -545,7 +547,7 @@ private:
|
||||
PIXEL_TYPE* mVRAM;
|
||||
int mCurrentTex;
|
||||
int mCurrentBlend;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
bool mVsync;
|
||||
@@ -563,7 +565,7 @@ private:
|
||||
JImageFilter* mImageFilter;
|
||||
|
||||
int mCurrentRenderMode;
|
||||
|
||||
|
||||
float mFOV;
|
||||
|
||||
#ifdef USING_MATH_TABLE
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
// 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 _JSOUNDSYSTEM_H_
|
||||
@@ -22,13 +22,13 @@
|
||||
#ifdef WIN32
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#elif defined (LINUX)
|
||||
#else
|
||||
|
||||
#include <pspgu.h>
|
||||
#include <pspkernel.h>
|
||||
#include <pspdisplay.h>
|
||||
#include <pspdebug.h>
|
||||
#include <pspdebug.h>
|
||||
#include <pspctrl.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
@@ -48,12 +48,12 @@ public:
|
||||
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
|
||||
#else
|
||||
JCooleyesMP3* mTrack;
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -65,8 +65,8 @@ public:
|
||||
~JSample();
|
||||
|
||||
int mVoice;
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
FSOUND_SAMPLE *mSample;
|
||||
#else
|
||||
WAVDATA *mSample;
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Sound engine for playing sound effects (WAV) and background
|
||||
/// Sound engine for playing sound effects (WAV) and background
|
||||
/// music (MP3).
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -96,91 +96,91 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Load music.
|
||||
///
|
||||
///
|
||||
/// @note MP3 is the only supported format for the moment.
|
||||
///
|
||||
///
|
||||
/// @param filename - Name of the music file.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
JMusic *LoadMusic(const char *fileName);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Delete music from memory.
|
||||
///
|
||||
///
|
||||
/// @param music - Music to be deleted.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//void FreeMusic(JMusic *music);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Play music.
|
||||
///
|
||||
///
|
||||
/// @param music - Music to be played.
|
||||
/// @param looping - Play the music in a loop.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void PlayMusic(JMusic *music, bool looping = false);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Stop playing.
|
||||
///
|
||||
///
|
||||
/// @param music - Music to be stopped.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void StopMusic(JMusic *music);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Resume playing.
|
||||
///
|
||||
///
|
||||
/// @param music - Music to be resumed.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void ResumeMusic(JMusic *music);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Load sound effect.
|
||||
///
|
||||
///
|
||||
/// @note WAV sound effect only.
|
||||
///
|
||||
///
|
||||
/// @param fileName - Sound effect for loading.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
JSample *LoadSample(const char *fileName);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Delete sound effect from memory.
|
||||
///
|
||||
///
|
||||
/// @param sample - Sound to be deleted.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//void FreeSample(JSample *sample);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Play sound effect.
|
||||
///
|
||||
///
|
||||
/// @param sample - Sound for playing.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void PlaySample(JSample *sample);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set volume for audio playback.
|
||||
///
|
||||
///
|
||||
/// @param volume - New volume.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetVolume(int volume);
|
||||
|
||||
protected:
|
||||
JSoundSystem();
|
||||
~JSoundSystem();
|
||||
|
||||
|
||||
void InitSoundSystem();
|
||||
void DestroySoundSystem();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
JMusic *mCurrentMusic;
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
// 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 _SPRITE_H_
|
||||
#define _SPRITE_H_
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined(LINUX)
|
||||
#include <math.h>
|
||||
#else
|
||||
#include <fastmath.h>
|
||||
@@ -36,15 +36,15 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Constructor.
|
||||
///
|
||||
/// @param tex - Texture for the first frame and the following frames.
|
||||
///
|
||||
/// @param tex - Texture for the first frame and the following frames.
|
||||
/// NULL to indicate no starting frame.
|
||||
/// @param x - X of the frame in texture.
|
||||
/// @param y - Y of the frame in texture.
|
||||
/// @param width - Width of the frame.
|
||||
/// @param height - Height of the frame.
|
||||
/// @param flipped - Indicate if the frame is horizontally flipped.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
JSprite(JTexture *tex=NULL, float x=0.0f, float y=0.0f, float width=0.0f, float height=0.0f, bool flipped = false);
|
||||
|
||||
@@ -52,128 +52,128 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Update animation.
|
||||
///
|
||||
///
|
||||
/// @param dt - Delta time since last update (in second).
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void Update(float dt);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Render current frame.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void Render();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set animation type.
|
||||
///
|
||||
///
|
||||
/// @param type - Animation type.
|
||||
///
|
||||
///
|
||||
/// @code
|
||||
/// ANIMATION_TYPE_LOOPING - Repeat playing (Default).
|
||||
/// ANIMATION_TYPE_ONCE_AND_GONE - Play animation once only.
|
||||
/// ANIMATION_TYPE_ONCE_AND_BACK - Play to end and then stay at first frame.
|
||||
/// ANIMATION_TYPE_PINGPONG - Play forward then backward and repeat.
|
||||
/// @endcode
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetAnimationType(int type);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Enable/Disable sprite.
|
||||
///
|
||||
///
|
||||
/// @param f - True to enable, false to disable.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetActive(bool f);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get current active status.
|
||||
///
|
||||
///
|
||||
/// @return Active status.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool IsActive();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Give sprite an id.
|
||||
///
|
||||
///
|
||||
/// @param id - Id.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetId(int id);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get sprite id.
|
||||
///
|
||||
///
|
||||
/// @return Sprite id.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int GetId();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Flip a frame or all frames horizontally when rendering.
|
||||
///
|
||||
///
|
||||
/// @param flip - True to flip.
|
||||
/// @param index - Frame index, -1 to flip all frames.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetFlip(bool flip, int index = -1);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Add new animation frame.
|
||||
///
|
||||
///
|
||||
/// @param x - X of the frame in texture.
|
||||
/// @param y - Y of the frame in texture.
|
||||
/// @param width - Width of the frame.
|
||||
/// @param height - Height of the frame.
|
||||
/// @param flipped - Indicate if the frame is horizontally flipped.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void AddFrame(float x, float y, float width, float height, bool flipped = false);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Add new animation frame.
|
||||
///
|
||||
/// @param tex - Texture for this frame and the following frames.
|
||||
///
|
||||
/// @param tex - Texture for this frame and the following frames.
|
||||
/// @param x - X of the frame in texture.
|
||||
/// @param y - Y of the frame in texture.
|
||||
/// @param width - Width of the frame.
|
||||
/// @param height - Height of the frame.
|
||||
/// @param flipped - Indicate if the frame is horizontally flipped.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void AddFrame(JTexture *tex, float x, float y, float width, float height, bool flipped = false);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set playback duration for each frame.
|
||||
///
|
||||
///
|
||||
/// @param duration - Playback duration (in second) for each frame.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetDuration(float duration);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get index of current frame.
|
||||
///
|
||||
///
|
||||
/// @return Index of current frame.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int GetCurrentFrameIndex();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set current frame to a particular index.
|
||||
///
|
||||
///
|
||||
/// @param frame - The new index of current frame.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetCurrentFrameIndex(int frame);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get current frame image (quad).
|
||||
///
|
||||
///
|
||||
/// @return Quad object.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
JQuad* GetCurrentFrame();
|
||||
|
||||
@@ -181,39 +181,39 @@ public:
|
||||
/// Get numer of animation frames.
|
||||
///
|
||||
/// @return Numer of animation frames.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int GetFrameCount();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get frame image (quad).
|
||||
///
|
||||
///
|
||||
/// @return Quad object.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
JQuad* GetFrame(int index);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Restart animation.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void RestartAnimation();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Start animation.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void StartAnimation();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Stop animation.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void StopAnimation();
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get animation status.
|
||||
///
|
||||
///
|
||||
/// @return animation status
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -221,184 +221,184 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Move some distance from the current position.
|
||||
///
|
||||
///
|
||||
/// @param x - X distance to move.
|
||||
/// @param y - Y distance to move.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Move(float x, float y);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set position of the sprite.
|
||||
///
|
||||
///
|
||||
/// @param x - X position.
|
||||
/// @param y - Y position.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetPosition(float x, float y);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set X position of the sprite.
|
||||
///
|
||||
///
|
||||
/// @param x - X position.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetX(float x);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set Y position of the sprite.
|
||||
///
|
||||
///
|
||||
/// @param y - Y position.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetY(float y);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get X position of the sprite.
|
||||
///
|
||||
///
|
||||
/// @return X position.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float GetX();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get Y position of the sprite.
|
||||
///
|
||||
///
|
||||
/// @return Y position.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float GetY();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get X velocity.
|
||||
///
|
||||
///
|
||||
/// @return X velocity.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float GetXVelocity();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get Y velocity.
|
||||
///
|
||||
///
|
||||
/// @return Y velocity.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float GetYVelocity();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set alpha value for rendering.
|
||||
///
|
||||
///
|
||||
/// @param alpha - Alpha value.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetAlpha(float alpha);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get alpha value.
|
||||
///
|
||||
///
|
||||
/// @return Alpha value.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float GetAlpha();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set scale of the sprite.
|
||||
///
|
||||
///
|
||||
/// @param hscale - Horizontal scale.
|
||||
/// @param vscale - Vertical scale.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetScale(float hscale, float vscale);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set scale of the sprite.
|
||||
///
|
||||
///
|
||||
/// @param scale - Scale for both horizontal and vertical dimension.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetScale(float scale);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get scale of the sprite.
|
||||
///
|
||||
///
|
||||
/// @return Scale of horizontal (assume same as the vertical).
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float GetScale();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set rotation factor of the sprite.
|
||||
///
|
||||
///
|
||||
/// @param rot - Rotation angle in radian.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetRotation(float rot);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get rotation factor of the sprite.
|
||||
///
|
||||
///
|
||||
/// @return Rotation angle in radian.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float GetRotation();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set moving speed of the sprite.
|
||||
///
|
||||
///
|
||||
/// @param speed - Moving speed.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetSpeed(float speed);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get moving speed of the sprite.
|
||||
///
|
||||
///
|
||||
/// @return Moving speed.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float GetSpeed();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set moving direction of the sprite.
|
||||
///
|
||||
///
|
||||
/// @param angle - Moving angle in radian.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetDirection(float angle);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set moving direction of the sprite based on a targeting position.
|
||||
///
|
||||
///
|
||||
/// @param x - X position of the target.
|
||||
/// @param y - Y position of the target.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetDirection(float x, float y);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get moving direction of the sprite.
|
||||
///
|
||||
///
|
||||
/// @return Moving angle in radian.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float GetDirection();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set anchor point of a frame or all frames of the sprite. All rotation
|
||||
/// Set anchor point of a frame or all frames of the sprite. All rotation
|
||||
/// and collision operations are based on this anchor point.
|
||||
///
|
||||
///
|
||||
/// @param x - X position of the anchor point.
|
||||
/// @param y - Y position of the anchor point.
|
||||
/// @param index - Frame index, -1 for all frames.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetHotSpot(float x, float y, int index=-1);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set color of the sprite for rendering.
|
||||
///
|
||||
///
|
||||
/// @param color - Color.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetColor(PIXEL_TYPE color);
|
||||
|
||||
@@ -406,9 +406,9 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// \enum ANIMATION_TYPE
|
||||
///
|
||||
///
|
||||
/// Type of animation.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
enum ANIMATION_TYPE
|
||||
{
|
||||
@@ -419,12 +419,12 @@ public:
|
||||
ANIMATION_TYPE_PINGPONG ///< Play forward then backward and repeat.
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
static JRenderer* mRenderer;
|
||||
|
||||
|
||||
JTexture* mTex;
|
||||
vector<JQuad*> mFrames;
|
||||
float mDuration;
|
||||
@@ -434,24 +434,24 @@ protected:
|
||||
int mAnimationType;
|
||||
int mDelta;
|
||||
bool mAnimating;
|
||||
|
||||
|
||||
float mAlpha;
|
||||
PIXEL_TYPE mColor;
|
||||
|
||||
|
||||
float mVScale;
|
||||
float mHScale;
|
||||
|
||||
|
||||
float mRotation;
|
||||
float mDirection;
|
||||
float mSpeed;
|
||||
|
||||
|
||||
int mId;
|
||||
bool mActive;
|
||||
|
||||
|
||||
float mX;
|
||||
float mY;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -459,12 +459,12 @@ protected:
|
||||
class JSpriteList
|
||||
{
|
||||
protected:
|
||||
|
||||
|
||||
int mCount;
|
||||
JSprite** mList;
|
||||
//JSpriteList** mVictims;
|
||||
//JCollisionListener* mCollisionListener;
|
||||
|
||||
|
||||
public:
|
||||
JSpriteList(int count);
|
||||
~JSpriteList();
|
||||
|
||||
@@ -3,15 +3,17 @@
|
||||
// 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 _JTYPES_H
|
||||
#define _JTYPES_H
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#else
|
||||
|
||||
@@ -19,7 +21,7 @@
|
||||
#include <pspgum.h>
|
||||
#include <pspkernel.h>
|
||||
#include <pspdisplay.h>
|
||||
#include <pspdebug.h>
|
||||
#include <pspdebug.h>
|
||||
#include <pspctrl.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
@@ -64,12 +66,19 @@
|
||||
#define BLEND_OPTION_BLEND GU_TFX_BLEND
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (WIN32)
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#include <gl/gl.h>
|
||||
#include <gl/glu.h>
|
||||
#endif
|
||||
#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"
|
||||
|
||||
@@ -79,13 +88,20 @@
|
||||
//#define u8 BYTE
|
||||
//#define u16 WORD
|
||||
//#define u32 DWORD
|
||||
/*
|
||||
typedef signed char s8;
|
||||
typedef signed short s16;
|
||||
typedef signed long s32;
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
//Long ?
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned long 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
|
||||
@@ -103,7 +119,7 @@
|
||||
#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)
|
||||
|
||||
enum PspCtrlButtons
|
||||
typedef enum PspCtrlButtons
|
||||
{
|
||||
PSP_CTRL_SELECT = 0x000001,
|
||||
PSP_CTRL_START = 0x000008,
|
||||
@@ -119,8 +135,8 @@
|
||||
PSP_CTRL_SQUARE = 0x008000,
|
||||
PSP_CTRL_HOME = 0x010000,
|
||||
PSP_CTRL_HOLD = 0x020000,
|
||||
PSP_CTRL_NOTE = 0x800000,
|
||||
};
|
||||
PSP_CTRL_NOTE = 0x800000
|
||||
} PspCtrlButtons;
|
||||
|
||||
|
||||
#define PIXEL_TYPE DWORD
|
||||
@@ -191,11 +207,10 @@
|
||||
#define FRAME_BUFFER_SIZE FRAME_BUFFER_WIDTH*SCREEN_HEIGHT*PIXEL_SIZE
|
||||
|
||||
#define SLICE_SIZE_F 64.0f
|
||||
//LONG ???
|
||||
typedef unsigned int DWORD;
|
||||
typedef unsigned long DWORD;
|
||||
|
||||
#define BLEND_ZERO 0x1000
|
||||
#define BLEND_ONE 0x1002
|
||||
#define BLEND_ONE 0x1002
|
||||
#define BLEND_SRC_COLOR GU_SRC_COLOR
|
||||
#define BLEND_ONE_MINUS_SRC_COLOR GU_ONE_MINUS_SRC_COLOR
|
||||
#define BLEND_SRC_ALPHA GU_SRC_ALPHA
|
||||
@@ -212,7 +227,7 @@
|
||||
//PIXEL_TYPE color;
|
||||
//ScePspFVector3 normal;
|
||||
ScePspFVector3 pos;
|
||||
} PSPVertex3D;
|
||||
} PSPVertex3D;
|
||||
|
||||
|
||||
#endif
|
||||
@@ -304,7 +319,7 @@ public:
|
||||
|
||||
int mFilter;
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
GLuint mTexId;
|
||||
#else
|
||||
|
||||
@@ -316,10 +331,10 @@ public:
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Custom filter for processing the texture image while loading. You
|
||||
/// Custom filter for processing the texture image while loading. You
|
||||
/// can change the pixels by using a custom filter before the image is
|
||||
/// created as a texture.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class JImageFilter
|
||||
{
|
||||
@@ -339,7 +354,7 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Image quad.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class JQuad
|
||||
{
|
||||
@@ -347,74 +362,74 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Constructor.
|
||||
///
|
||||
///
|
||||
/// @param tex - Texture of the quad.
|
||||
/// @param x - X position of the quad in texture.
|
||||
/// @param y - Y position of the quad in texture.
|
||||
/// @param width - Width of the quad.
|
||||
/// @param height - Height of the quad.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
JQuad(JTexture *tex, float x, float y, float width, float height);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set blending color of the quad.
|
||||
///
|
||||
///
|
||||
/// @param color - Color.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetColor(PIXEL_TYPE color);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set anchor point of the quad.
|
||||
///
|
||||
///
|
||||
/// @param x - X position of the anchor point.
|
||||
/// @param y - Y position of the anchor point.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetHotSpot(float x, float y);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set UV positions of the quad.
|
||||
///
|
||||
///
|
||||
/// @param x - X position of the quad in texture.
|
||||
/// @param y - Y position of the quad in texture.
|
||||
/// @param w - Width of the quad.
|
||||
/// @param h - Height of the quad.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetTextureRect(float x, float y, float w, float h);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get UV positions of the quad.
|
||||
///
|
||||
///
|
||||
/// @return x - X position of the quad in texture.
|
||||
/// @return y - Y position of the quad in texture.
|
||||
/// @return w - Width of the quad.
|
||||
/// @return h - Height of the quad.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void GetTextureRect(float *x, float *y, float *w, float *h);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set horizontal flipping.
|
||||
///
|
||||
///
|
||||
/// @param hflip - flipping flag;
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetHFlip(bool hflip) { mHFlipped = hflip; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Set vetical flipping.
|
||||
///
|
||||
///
|
||||
/// @param hflip - flipping flag;
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetVFlip(bool vflip) { mVFlipped = vflip; }
|
||||
|
||||
JTexture* mTex;
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#if defined (WIN32) || defined(LINUX)
|
||||
float mTX0;
|
||||
float mTY0;
|
||||
float mTX1;
|
||||
@@ -441,9 +456,9 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// \enum JFONT_TEXT_ALIGNMENT
|
||||
///
|
||||
///
|
||||
/// Font alignment.
|
||||
///
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
enum JFONT_TEXT_ALIGNMENT
|
||||
{
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
// 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 _VECTOR2D_H
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
#ifdef WIN32
|
||||
#include <math.h>
|
||||
#elif defined LINUX
|
||||
#include <math.h>
|
||||
#else
|
||||
#include <fastmath.h>
|
||||
#endif
|
||||
@@ -31,7 +33,7 @@ struct Vector2D
|
||||
inline Vector2D &operator /=(const float scalar) { x /= scalar; y /= scalar; return *this; }
|
||||
|
||||
inline Vector2D &operator *=(const float scalar) { x *= scalar; y *= scalar; return *this; }
|
||||
|
||||
|
||||
inline Vector2D &operator +=(const Vector2D &v) { x += v.x; y += v.y; return *this; }
|
||||
|
||||
inline Vector2D &operator -=(const Vector2D &v) { x -= v.x; y -= v.y; return *this; }
|
||||
@@ -41,14 +43,14 @@ struct Vector2D
|
||||
|
||||
|
||||
// cross product
|
||||
inline float operator ^ (const Vector2D &v) const { return (x * v.y) - (y * v.x); }
|
||||
inline float operator ^ (const Vector2D &v) const { return (x * v.y) - (y * v.x); }
|
||||
|
||||
// dot product
|
||||
inline float operator * (const Vector2D &v) const { return (x*v.x) + (y*v.y); }
|
||||
inline float operator * (const Vector2D &v) const { return (x*v.x) + (y*v.y); }
|
||||
|
||||
inline float Dot(const Vector2D &v) const { return (x * v.x) + (y * v.y); }
|
||||
inline float Cross(const Vector2D &v) const { return (x * v.y) - (y * v.x); }
|
||||
|
||||
inline float Dot(const Vector2D &v) const { return (x * v.x) + (y * v.y); }
|
||||
inline float Cross(const Vector2D &v) const { return (x * v.y) - (y * v.x); }
|
||||
|
||||
|
||||
inline Vector2D operator * (float s) const { return Vector2D(x*s, y*s); }
|
||||
inline Vector2D operator / (float s) const { return Vector2D(x/s, y/s); }
|
||||
@@ -68,4 +70,4 @@ struct Vector2D
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
JGE/libjinput.a
BIN
JGE/libjinput.a
Binary file not shown.
@@ -3186,7 +3186,7 @@ static int _gbk_mbtowc(ucs4_t *pwc, const u8 *s, int n)
|
||||
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;
|
||||
if (c < 0x80) {
|
||||
|
||||
@@ -67,7 +67,7 @@ bool JAnimator::Load(const char* scriptFile)
|
||||
element = script->ToElement();
|
||||
printf("---- Loading %s:%s\n", element->Value(), element->Attribute("name"));
|
||||
|
||||
char *type[] =
|
||||
const char *type[] =
|
||||
{
|
||||
"ANIMATION_TYPE_LOOPING",
|
||||
"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;
|
||||
mFrameTime = 100.0f;
|
||||
@@ -390,7 +390,7 @@ JAnimatorObject::~JAnimatorObject()
|
||||
|
||||
}
|
||||
|
||||
void JAnimatorObject::Update(float dt)
|
||||
void JAnimatorObject::Update(float dt __attribute__((unused)))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
// 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>
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
#pragma warning(disable : 4786)
|
||||
#ifndef LINUX
|
||||
#pragma warning(disable : 4786)
|
||||
#endif
|
||||
|
||||
#include "../include/JGE.h"
|
||||
#include "../include/JFileSystem.h"
|
||||
@@ -47,7 +49,7 @@ void JFileSystem::Destroy()
|
||||
JFileSystem::JFileSystem()
|
||||
{
|
||||
mZipAvailable = false;
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
mFile = NULL;
|
||||
#else
|
||||
mFile = -1;
|
||||
@@ -56,7 +58,7 @@ JFileSystem::JFileSystem()
|
||||
mZipFile = NULL;
|
||||
mFileSize = 0;
|
||||
|
||||
mResourceRoot = "Res/"; // default root folder
|
||||
mResourceRoot = "Res/"; // default root folder
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +76,7 @@ bool JFileSystem::AttachZipFile(const string &zipfile, char *password /* = NULL
|
||||
if (mZipFileName != zipfile)
|
||||
unzCloseCurrentFile(mZipFile); // close the previous zip file
|
||||
}
|
||||
|
||||
|
||||
mZipFileName = zipfile;
|
||||
mPassword = password;
|
||||
|
||||
@@ -96,7 +98,7 @@ void JFileSystem::DetachZipFile()
|
||||
{
|
||||
unzCloseCurrentFile(mZipFile);
|
||||
}
|
||||
|
||||
|
||||
mZipFile = NULL;
|
||||
mZipAvailable = false;
|
||||
}
|
||||
@@ -119,12 +121,12 @@ bool JFileSystem::OpenFile(const string &filename)
|
||||
mFileSize = fileInfo.uncompressed_size;
|
||||
else
|
||||
mFileSize = 0;
|
||||
|
||||
|
||||
return (unzOpenCurrentFilePassword(mZipFile, mPassword) == UNZ_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
mFile = fopen(path.c_str(), "rb");
|
||||
if (mFile != NULL)
|
||||
{
|
||||
@@ -141,13 +143,13 @@ bool JFileSystem::OpenFile(const string &filename)
|
||||
sceIoLseek(mFile, 0, PSP_SEEK_SET);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +158,7 @@ void JFileSystem::CloseFile()
|
||||
if (mZipAvailable && mZipFile != NULL)
|
||||
return;
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
if (mFile != NULL)
|
||||
fclose(mFile);
|
||||
#else
|
||||
@@ -174,7 +176,7 @@ int JFileSystem::ReadFile(void *buffer, int size)
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
return fread(buffer, 1, size, mFile);
|
||||
#else
|
||||
return sceIoRead(mFile, buffer, size);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// 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>
|
||||
// Copyright (c) 2007 Sijiu Duan (a.k.a. Chi80) <sijiu49@gmail.com>
|
||||
//
|
||||
@@ -89,7 +89,7 @@ bool JGBKFont::Init(const char* engFileName, const char* chnFileName, int fontsi
|
||||
mSprites = new JQuad*[mCacheSize];
|
||||
mGBCode = new int[mCacheSize];
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
mCharBuffer = new DWORD[mFontSize*mFontSize];
|
||||
#endif
|
||||
|
||||
@@ -104,7 +104,7 @@ bool JGBKFont::Init(const char* engFileName, const char* chnFileName, int fontsi
|
||||
|
||||
mSprites[index] = new JQuad(mTexture, x*mFontSize, y*mFontSize, mFontSize, mFontSize);
|
||||
mSprites[index]->SetHotSpot(mFontSize/2, mFontSize/2);
|
||||
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ bool JGBKFont::Init(const char* engFileName, const char* chnFileName, int fontsi
|
||||
}
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
#else
|
||||
void SwizzlePlot(u8* out, PIXEL_TYPE color, int i, int j, unsigned int width, unsigned int height)
|
||||
{
|
||||
@@ -171,24 +171,24 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
|
||||
code = ((DWORD)*ch)|0x10000;
|
||||
isChinese = false;
|
||||
}
|
||||
|
||||
|
||||
if (mGBCode[mCurr] != -1)
|
||||
{
|
||||
|
||||
|
||||
for (int i=0;i<mCacheSize;i++)
|
||||
{
|
||||
if (mGBCode[i] == code)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mCount++;
|
||||
|
||||
int index = mCurr++;
|
||||
if (mCurr >= mCacheSize)
|
||||
mCurr = 0;
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
@@ -206,14 +206,14 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
|
||||
|
||||
if (isChinese)
|
||||
{
|
||||
|
||||
|
||||
src = mChnFont + code * mBytesPerChar;
|
||||
for (int i=0;i<mBytesPerChar;)
|
||||
{
|
||||
|
||||
bitCount = mFontSize;
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
x = 0;
|
||||
#else
|
||||
x = (int)mSprites[index]->mX;
|
||||
@@ -225,7 +225,7 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
|
||||
BYTE bitMask = 0x80;
|
||||
for (int z=0;z<8&&bitCount;z++)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
if ((bits & bitMask) != 0)
|
||||
mCharBuffer[y*mFontSize+x] = ARGB(255,255,255,255);
|
||||
else
|
||||
@@ -240,9 +240,9 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
|
||||
x++;
|
||||
|
||||
bitCount--;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
y++;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
|
||||
for (int i=0;i<size;)
|
||||
{
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
x = 0;
|
||||
#else
|
||||
x = (int)mSprites[index]->mX;
|
||||
@@ -266,10 +266,10 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
|
||||
// put char in the middle
|
||||
if (mFontSize <= 16)
|
||||
{
|
||||
|
||||
|
||||
for (n=0;n<(mFontSize-8)/2;n++)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
mCharBuffer[y*mFontSize+x] = ARGB(0,0,0,0);
|
||||
#else
|
||||
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;
|
||||
for (int z=0;z<8&&bitCount;z++)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
if ((bits & bitMask) != 0)
|
||||
mCharBuffer[y*mFontSize+x] = ARGB(255,255,255,255);
|
||||
else
|
||||
@@ -296,7 +296,7 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
|
||||
SwizzlePlot(pTexture, ARGB(255,255,255,255), x*PIXEL_SIZE, y, mTexture->mTexWidth*PIXEL_SIZE, mCacheImageHeight);
|
||||
else
|
||||
SwizzlePlot(pTexture, ARGB(0,0,0,0), x*PIXEL_SIZE, y, mTexture->mTexWidth*PIXEL_SIZE, mCacheImageHeight);
|
||||
#endif
|
||||
#endif
|
||||
x++;
|
||||
bitMask >>= 1;
|
||||
bitCount--;
|
||||
@@ -305,10 +305,10 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
|
||||
|
||||
if (mFontSize <= 16)
|
||||
{
|
||||
|
||||
|
||||
for (n=0;n<(mFontSize-8)/2;n++)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
mCharBuffer[y*mFontSize+x] = ARGB(0,0,0,0);
|
||||
#else
|
||||
SwizzlePlot(pTexture, ARGB(0,0,0,0), x*PIXEL_SIZE, y, mTexture->mTexWidth*PIXEL_SIZE, mCacheImageHeight);
|
||||
@@ -321,15 +321,15 @@ int JGBKFont::PreCacheChar(const BYTE *ch)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mGBCode[index] = code;
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
x = (int)mSprites[index]->mX;
|
||||
y = (int)mSprites[index]->mY;
|
||||
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, mFontSize, mFontSize, GL_RGBA, GL_UNSIGNED_BYTE, mCharBuffer);
|
||||
|
||||
|
||||
#else
|
||||
sceKernelDcacheWritebackAll();
|
||||
//sceKernelDcacheWritebackInvalidateAll();
|
||||
@@ -383,7 +383,7 @@ void JGBKFont::RenderEncodedString(const int* text, int count, float x, float y)
|
||||
}
|
||||
else if (text[n] == 0x8000d)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -441,7 +441,7 @@ void JGBKFont::GetStringArea( BYTE* str, int *w, int *h)
|
||||
}
|
||||
src += 1;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (*src > 0x80)
|
||||
{
|
||||
@@ -467,7 +467,7 @@ void JGBKFont::GetStringArea( BYTE* str, int *w, int *h)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
|
||||
if (*src < ' ') // control characters
|
||||
@@ -481,7 +481,7 @@ void JGBKFont::GetStringArea( BYTE* str, int *w, int *h)
|
||||
}
|
||||
src += 1;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (*src > 0x80)
|
||||
{
|
||||
@@ -512,8 +512,8 @@ void JGBKFont::GetStringArea( BYTE* str, int *w, int *h)
|
||||
yy += (mFontSize*mScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (xx>len)
|
||||
{
|
||||
@@ -528,7 +528,7 @@ void JGBKFont::RenderString(BYTE* str, float x, float y, int alignment)
|
||||
{
|
||||
int w=0;
|
||||
int h=0;
|
||||
|
||||
|
||||
switch(alignment)
|
||||
{
|
||||
case JGETEXT_RIGHT:
|
||||
@@ -551,9 +551,9 @@ void JGBKFont::RenderString(BYTE* str, float x, float y, int alignment)
|
||||
float xx = x;
|
||||
float yy = y;
|
||||
int index;
|
||||
|
||||
|
||||
bool isChinese=true;
|
||||
|
||||
|
||||
while (*src != 0)
|
||||
{
|
||||
if (yy + mFontSize < 0.0f) // don't render when outside viewport
|
||||
@@ -567,7 +567,7 @@ void JGBKFont::RenderString(BYTE* str, float x, float y, int alignment)
|
||||
}
|
||||
src += 1;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (*src > 0x80)
|
||||
{
|
||||
@@ -591,7 +591,7 @@ void JGBKFont::RenderString(BYTE* str, float x, float y, int alignment)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
|
||||
if (*src < ' ') // control characters
|
||||
@@ -603,7 +603,7 @@ void JGBKFont::RenderString(BYTE* str, float x, float y, int alignment)
|
||||
}
|
||||
src += 1;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (*src > 0x80)
|
||||
{
|
||||
@@ -621,7 +621,7 @@ void JGBKFont::RenderString(BYTE* str, float x, float y, int alignment)
|
||||
xx-=3*(mFontSize*mScale)/16;
|
||||
isChinese = false;
|
||||
}
|
||||
|
||||
|
||||
mSprites[index]->SetColor(mColor);
|
||||
mRenderer->RenderQuad(mSprites[index], xx, yy, mRotation, mScale, mScale);
|
||||
if (mSmallEnglishFont && !isChinese)
|
||||
|
||||
158
JGE/src/JGE.cpp
158
JGE/src/JGE.cpp
@@ -3,9 +3,9 @@
|
||||
// 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>
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
#include "../include/JGE.h"
|
||||
@@ -19,16 +19,71 @@
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#ifdef WIN32
|
||||
|
||||
#if defined (WIN32) // WIN32 specific code
|
||||
#include "../../Dependencies/include/png.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()
|
||||
{
|
||||
mApp = NULL;
|
||||
|
||||
|
||||
strcpy(mDebuggingMsg, "");
|
||||
mCurrentMusic = NULL;
|
||||
Init();
|
||||
@@ -54,25 +109,25 @@ JGE::~JGE()
|
||||
|
||||
// if (mResourceManager != NULL)
|
||||
// delete mResourceManager;
|
||||
//
|
||||
//
|
||||
// if (mFileSystem != NULL)
|
||||
// delete mFileSystem;
|
||||
//
|
||||
//
|
||||
// if (mParticleSystem != NULL)
|
||||
// delete mParticleSystem;
|
||||
//
|
||||
//
|
||||
// if (mMotionSystem != NULL)
|
||||
// delete mMotionSystem;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void JGE::Init()
|
||||
{
|
||||
mDone = false;
|
||||
mPaused = false;
|
||||
mCriticalAssert = false;
|
||||
|
||||
|
||||
JRenderer::GetInstance();
|
||||
JFileSystem::GetInstance();
|
||||
JSoundSystem::GetInstance();
|
||||
@@ -83,7 +138,7 @@ void JGE::Init()
|
||||
|
||||
void JGE::Run()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void JGE::SetDelta(int delta)
|
||||
@@ -91,12 +146,6 @@ void JGE::SetDelta(int delta)
|
||||
mDeltaTime = (float)delta / 1000.0f; // change to second
|
||||
}
|
||||
|
||||
int JGE::GetTime(void)
|
||||
{
|
||||
return (int)GetTickCount();
|
||||
}
|
||||
|
||||
|
||||
float JGE::GetDelta()
|
||||
{
|
||||
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
|
||||
@@ -149,7 +181,7 @@ u8 JGE::GetAnalogY()
|
||||
|
||||
|
||||
// include all the following so we only have one .o file
|
||||
//#include "../src/JGfx.cpp"
|
||||
//#include "../src/JGfx.cpp"
|
||||
//#include "../src/JSfx.cpp"
|
||||
|
||||
|
||||
@@ -193,7 +225,7 @@ JGE::~JGE()
|
||||
void JGE::Init()
|
||||
{
|
||||
|
||||
#ifdef DEBUG_PRINT
|
||||
#ifdef DEBUG_PRINT
|
||||
mDebug = true;
|
||||
#else
|
||||
mDebug = false;
|
||||
@@ -201,12 +233,12 @@ void JGE::Init()
|
||||
|
||||
if (mDebug)
|
||||
pspDebugScreenInit(); // do this so that we can use pspDebugScreenPrintf
|
||||
|
||||
|
||||
strcpy(mDebuggingMsg, "");
|
||||
|
||||
sceCtrlSetSamplingCycle(0);
|
||||
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
|
||||
|
||||
|
||||
JRenderer::GetInstance();
|
||||
JFileSystem::GetInstance();
|
||||
JSoundSystem::GetInstance();
|
||||
@@ -218,7 +250,7 @@ void JGE::Init()
|
||||
//InitSfx();
|
||||
|
||||
//Create();
|
||||
|
||||
|
||||
// mCurrMS = 1.0f;
|
||||
// mFPSSlice = 0;
|
||||
|
||||
@@ -228,9 +260,9 @@ void JGE::Init()
|
||||
|
||||
//mLastTime = GetTime();
|
||||
|
||||
|
||||
|
||||
mTickFrequency = sceRtcGetTickResolution();
|
||||
sceRtcGetCurrentTick(&mLastTime);
|
||||
sceRtcGetCurrentTick(&mLastTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -240,7 +272,7 @@ int JGE::GetTime(void)
|
||||
|
||||
u64 curr;
|
||||
sceRtcGetCurrentTick(&curr);
|
||||
|
||||
|
||||
return (int)(curr / mTickFrequency);
|
||||
}
|
||||
|
||||
@@ -257,28 +289,28 @@ float JGE::GetFPS()
|
||||
}
|
||||
|
||||
|
||||
bool JGE::GetButtonState(u32 button)
|
||||
{
|
||||
return (mCtrlPad.Buttons&button)==button;
|
||||
bool JGE::GetButtonState(u32 button)
|
||||
{
|
||||
return (mCtrlPad.Buttons&button)==button;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool JGE::GetButtonClick(u32 button)
|
||||
{
|
||||
return (mCtrlPad.Buttons&button)==button && (mOldButtons&button)!=button;
|
||||
bool JGE::GetButtonClick(u32 button)
|
||||
{
|
||||
return (mCtrlPad.Buttons&button)==button && (mOldButtons&button)!=button;
|
||||
}
|
||||
|
||||
|
||||
u8 JGE::GetAnalogX()
|
||||
{
|
||||
return mCtrlPad.Lx;
|
||||
u8 JGE::GetAnalogX()
|
||||
{
|
||||
return mCtrlPad.Lx;
|
||||
}
|
||||
|
||||
|
||||
u8 JGE::GetAnalogY()
|
||||
{
|
||||
return mCtrlPad.Ly;
|
||||
u8 JGE::GetAnalogY()
|
||||
{
|
||||
return mCtrlPad.Ly;
|
||||
}
|
||||
|
||||
|
||||
@@ -292,14 +324,14 @@ void JGE::Run()
|
||||
if (!mPaused)
|
||||
{
|
||||
sceRtcGetCurrentTick(&curr);
|
||||
|
||||
|
||||
mDelta = (curr-mLastTime) / (float)mTickFrequency;// * 1000.0f;
|
||||
|
||||
|
||||
mDelta = (curr-mLastTime) / (float)mTickFrequency;// * 1000.0f;
|
||||
mLastTime = curr;
|
||||
|
||||
|
||||
sceCtrlPeekBufferPositive(&mCtrlPad, 1); // using sceCtrlPeekBufferPositive is faster than sceCtrlReadBufferPositive
|
||||
// because sceCtrlReadBufferPositive waits for vsync internally
|
||||
|
||||
|
||||
Update();
|
||||
|
||||
Render();
|
||||
@@ -314,13 +346,13 @@ void JGE::Run()
|
||||
}
|
||||
|
||||
mOldButtons = mCtrlPad.Buttons;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif ///// PSP specified code
|
||||
@@ -336,7 +368,7 @@ JGE* JGE::GetInstance()
|
||||
{
|
||||
mInstance = new JGE();
|
||||
}
|
||||
|
||||
|
||||
//gCount++;
|
||||
return mInstance;
|
||||
}
|
||||
@@ -388,7 +420,7 @@ void JGE::End()
|
||||
void JGE::printf(const char *format, ...)
|
||||
{
|
||||
va_list list;
|
||||
|
||||
|
||||
va_start(list, format);
|
||||
vsprintf(mDebuggingMsg, format, list);
|
||||
va_end(list);
|
||||
|
||||
280
JGE/src/JGfx.cpp
280
JGE/src/JGfx.cpp
@@ -3,9 +3,9 @@
|
||||
// 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>
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
#include <malloc.h>
|
||||
@@ -64,15 +64,15 @@ JQuad::JQuad(JTexture *tex, float x, float y, float width, float height)
|
||||
}
|
||||
|
||||
|
||||
void JQuad::GetTextureRect(float *x, float *y, float *w, float *h)
|
||||
{
|
||||
*x=mX; *y=mY; *w=mWidth; *h=mHeight;
|
||||
void JQuad::GetTextureRect(float *x, float *y, float *w, float *h)
|
||||
{
|
||||
*x=mX; *y=mY; *w=mWidth; *h=mHeight;
|
||||
}
|
||||
|
||||
|
||||
void JQuad::SetTextureRect(float x, float y, float w, float h)
|
||||
{
|
||||
mX = x; mY = y; mWidth = w; mHeight = h;
|
||||
void JQuad::SetTextureRect(float x, float y, float w, float h)
|
||||
{
|
||||
mX = x; mY = y; mWidth = w; mHeight = h;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ JRenderer* JRenderer::GetInstance()
|
||||
mInstance = new JRenderer();
|
||||
mInstance->InitRenderer();
|
||||
}
|
||||
|
||||
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
@@ -169,13 +169,13 @@ JRenderer::JRenderer()
|
||||
|
||||
JRenderer::~JRenderer()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::ResetPrivateVRAM()
|
||||
{
|
||||
//mCurrentPointer = mVideoBufferStart;
|
||||
void JRenderer::ResetPrivateVRAM()
|
||||
{
|
||||
//mCurrentPointer = mVideoBufferStart;
|
||||
}
|
||||
|
||||
|
||||
@@ -195,11 +195,11 @@ void JRenderer::InitRenderer()
|
||||
|
||||
mSwizzle = 1;
|
||||
mVsync = false;
|
||||
|
||||
|
||||
mTexCounter = 0;
|
||||
mCurrentTex = -1;
|
||||
mCurrentBlend = -1;
|
||||
|
||||
|
||||
mFOV = 75.0f;
|
||||
|
||||
mImageFilter = NULL;
|
||||
@@ -227,7 +227,7 @@ void JRenderer::InitRenderer()
|
||||
}
|
||||
|
||||
//mCurrentPointer = mVideoBufferStart;
|
||||
|
||||
|
||||
sceGuOffset(2048 - (SCREEN_WIDTH/2), 2048 - (SCREEN_HEIGHT/2));
|
||||
sceGuViewport(2048, 2048, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
sceGuScissor(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
@@ -235,15 +235,15 @@ void JRenderer::InitRenderer()
|
||||
//sceGuFrontFace(GU_CW);
|
||||
sceGuFrontFace(GU_CCW);
|
||||
sceGuEnable(GU_TEXTURE_2D);
|
||||
|
||||
|
||||
sceGuShadeModel(GU_SMOOTH);
|
||||
|
||||
|
||||
sceGuTexWrap(GU_REPEAT, GU_REPEAT);
|
||||
|
||||
// enable alpha channel
|
||||
sceGuEnable(GU_BLEND);
|
||||
sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
|
||||
|
||||
|
||||
sceGuTexFilter(GU_LINEAR,GU_LINEAR);
|
||||
|
||||
if (m3DEnabled)
|
||||
@@ -260,7 +260,7 @@ void JRenderer::InitRenderer()
|
||||
sceGuClearDepth(0);
|
||||
|
||||
sceGuTexEnvColor(0xffffffff);
|
||||
|
||||
|
||||
sceGuTexScale(1.0f,1.0f);
|
||||
sceGuTexOffset(0.0f,0.0f);
|
||||
sceGuAmbientColor(0xffffffff);
|
||||
@@ -288,7 +288,7 @@ void JRenderer::SetTexBlend(int src, int dest)
|
||||
{
|
||||
mCurrTexBlendSrc = src;
|
||||
mCurrTexBlendDest = dest;
|
||||
|
||||
|
||||
int fixSrc = 0;
|
||||
int fixDest = 0;
|
||||
if (src == BLEND_ZERO)
|
||||
@@ -305,7 +305,7 @@ void JRenderer::SetTexBlend(int src, int dest)
|
||||
dest = GU_FIX;
|
||||
fixDest = 0x00FFFFFF;
|
||||
}
|
||||
|
||||
|
||||
//glBlendFunc(src, dest);
|
||||
sceGuBlendFunc(GU_ADD, src, dest, fixSrc, fixDest);
|
||||
}
|
||||
@@ -343,9 +343,9 @@ void JRenderer::BeginScene()
|
||||
//if (mMode3D)
|
||||
sceGuClear(GU_DEPTH_BUFFER_BIT|GU_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
|
||||
sceGuTexMode(TEXTURE_FORMAT, 0, 0, mSwizzle);
|
||||
|
||||
sceGuTexMode(TEXTURE_FORMAT, 0, 0, mSwizzle);
|
||||
|
||||
if (mCurrentTextureFilter == TEX_FILTER_NEAREST)
|
||||
sceGuTexFilter(GU_NEAREST, GU_NEAREST); // GU_NEAREST good for tile-map
|
||||
@@ -362,7 +362,7 @@ void JRenderer::EndScene()
|
||||
|
||||
if (mVsync)
|
||||
sceDisplayWaitVblankStart();
|
||||
|
||||
|
||||
sceGuSwapBuffers();
|
||||
|
||||
mCurrentTex = -1;
|
||||
@@ -371,8 +371,8 @@ void JRenderer::EndScene()
|
||||
|
||||
|
||||
void JRenderer::EnableVSync(bool flag)
|
||||
{
|
||||
mVsync = flag;
|
||||
{
|
||||
mVsync = flag;
|
||||
}
|
||||
|
||||
|
||||
@@ -390,13 +390,13 @@ void JRenderer::FillRect(float x, float y, float width, float height, PIXEL_TYPE
|
||||
struct VertexColor* vertices = (struct VertexColor*)sceGuGetMemory(2 * sizeof(struct VertexColor));
|
||||
|
||||
vertices[0].color = color;
|
||||
vertices[0].x = x;
|
||||
vertices[0].y = y;
|
||||
vertices[0].x = x;
|
||||
vertices[0].y = y;
|
||||
vertices[0].z = 0.0f;
|
||||
|
||||
vertices[1].color = color;
|
||||
vertices[1].x = x + width;
|
||||
vertices[1].y = y + height;
|
||||
vertices[1].x = x + width;
|
||||
vertices[1].y = y + height;
|
||||
vertices[1].z = 0.0f;
|
||||
|
||||
sceGuDisable(GU_TEXTURE_2D);
|
||||
@@ -414,44 +414,44 @@ void JRenderer::FillRect(float x, float y, float width, float height, PIXEL_TYPE
|
||||
|
||||
|
||||
vertices[0].color = colors[0];
|
||||
vertices[0].x = x;
|
||||
vertices[0].y = y;
|
||||
vertices[0].x = x;
|
||||
vertices[0].y = y;
|
||||
vertices[0].z = 0.0f;
|
||||
|
||||
vertices[1].color = colors[1];
|
||||
vertices[1].x = x + width;
|
||||
vertices[1].y = y;
|
||||
vertices[1].x = x + width;
|
||||
vertices[1].y = y;
|
||||
vertices[1].z = 0.0f;
|
||||
|
||||
vertices[2].color = colors[2];
|
||||
vertices[2].x = x;
|
||||
vertices[2].y = y + height;
|
||||
vertices[2].x = x;
|
||||
vertices[2].y = y + height;
|
||||
vertices[2].z = 0.0f;
|
||||
|
||||
vertices[3].color = colors[3];
|
||||
vertices[3].x = x + width;
|
||||
vertices[3].y = y + height;
|
||||
vertices[3].x = x + width;
|
||||
vertices[3].y = y + height;
|
||||
vertices[3].z = 0.0f;
|
||||
/*
|
||||
|
||||
vertices[0].color = colors[0];
|
||||
vertices[0].x = x;
|
||||
vertices[0].y = y;
|
||||
vertices[0].x = x;
|
||||
vertices[0].y = y;
|
||||
vertices[0].z = 0.0f;
|
||||
|
||||
vertices[1].color = colors[1];
|
||||
vertices[1].x = x;
|
||||
vertices[1].y = y + height;
|
||||
vertices[1].x = x;
|
||||
vertices[1].y = y + height;
|
||||
vertices[1].z = 0.0f;
|
||||
|
||||
vertices[2].color = colors[2];
|
||||
vertices[2].x = x + width;
|
||||
vertices[2].y = y + height;
|
||||
vertices[2].x = x + width;
|
||||
vertices[2].y = y + height;
|
||||
vertices[2].z = 0.0f;
|
||||
|
||||
vertices[3].color = colors[3];
|
||||
vertices[3].x = x + width;
|
||||
vertices[3].y = y;
|
||||
vertices[3].x = x + width;
|
||||
vertices[3].y = y;
|
||||
vertices[3].z = 0.0f;
|
||||
*/
|
||||
sceGuDisable(GU_TEXTURE_2D);
|
||||
@@ -468,28 +468,28 @@ void JRenderer::DrawRect(float x, float y, float width, float height, PIXEL_TYPE
|
||||
struct VertexColor* vertices = (struct VertexColor*)sceGuGetMemory(5 * sizeof(struct VertexColor));
|
||||
|
||||
vertices[0].color = color;
|
||||
vertices[0].x = x;
|
||||
vertices[0].y = y;
|
||||
vertices[0].x = x;
|
||||
vertices[0].y = y;
|
||||
vertices[0].z = 0.0f;
|
||||
|
||||
vertices[1].color = color;
|
||||
vertices[1].x = x;
|
||||
vertices[1].y = y + height;
|
||||
vertices[1].x = x;
|
||||
vertices[1].y = y + height;
|
||||
vertices[1].z = 0.0f;
|
||||
|
||||
vertices[2].color = color;
|
||||
vertices[2].x = x + width;
|
||||
vertices[2].y = y + height;
|
||||
vertices[2].x = x + width;
|
||||
vertices[2].y = y + height;
|
||||
vertices[2].z = 0.0f;
|
||||
|
||||
vertices[3].color = color;
|
||||
vertices[3].x = x + width;
|
||||
vertices[3].y = y;
|
||||
vertices[3].x = x + width;
|
||||
vertices[3].y = y;
|
||||
vertices[3].z = 0.0f;
|
||||
|
||||
vertices[4].color = color;
|
||||
vertices[4].x = x;
|
||||
vertices[4].y = y;
|
||||
vertices[4].x = x;
|
||||
vertices[4].y = y;
|
||||
vertices[4].z = 0.0f;
|
||||
|
||||
sceGuDisable(GU_TEXTURE_2D);
|
||||
@@ -506,13 +506,13 @@ void JRenderer::DrawLine(float x1, float y1, float x2, float y2, PIXEL_TYPE colo
|
||||
struct VertexColor* vertices = (struct VertexColor*)sceGuGetMemory(2 * sizeof(struct VertexColor));
|
||||
|
||||
vertices[0].color = color;
|
||||
vertices[0].x = x1;
|
||||
vertices[0].y = y1;
|
||||
vertices[0].x = x1;
|
||||
vertices[0].y = y1;
|
||||
vertices[0].z = 0.0f;
|
||||
|
||||
vertices[1].color = color;
|
||||
vertices[1].x = x2;
|
||||
vertices[1].y = y2;
|
||||
vertices[1].x = x2;
|
||||
vertices[1].y = y2;
|
||||
vertices[1].z = 0.0f;
|
||||
|
||||
sceGuDisable(GU_TEXTURE_2D);
|
||||
@@ -529,8 +529,8 @@ void JRenderer::Plot(float x, float y, PIXEL_TYPE color)
|
||||
struct VertexColor* vertices = (struct VertexColor*)sceGuGetMemory(1 * sizeof(struct VertexColor));
|
||||
|
||||
vertices[0].color = color;
|
||||
vertices[0].x = x;
|
||||
vertices[0].y = y;
|
||||
vertices[0].x = x;
|
||||
vertices[0].y = y;
|
||||
vertices[0].z = 0.0f;
|
||||
|
||||
sceGuDisable(GU_TEXTURE_2D);
|
||||
@@ -549,8 +549,8 @@ void JRenderer::PlotArray(float *x, float *y, int count, PIXEL_TYPE color)
|
||||
for (int i=0;i<count;i++)
|
||||
{
|
||||
vertices[i].color = color;
|
||||
vertices[i].x = x[i];
|
||||
vertices[i].y = y[i];
|
||||
vertices[i].x = x[i];
|
||||
vertices[i].y = y[i];
|
||||
vertices[i].z = 0.0f;
|
||||
}
|
||||
|
||||
@@ -579,7 +579,7 @@ void JRenderer::RenderQuad(JQuad* quad, float xo, float yo, float angle, float x
|
||||
|
||||
if (mCurrentBlend != quad->mBlend)
|
||||
{
|
||||
sceGuTexFunc(quad->mBlend, GU_TCC_RGBA);
|
||||
sceGuTexFunc(quad->mBlend, GU_TCC_RGBA);
|
||||
mCurrentBlend = quad->mBlend;
|
||||
}
|
||||
|
||||
@@ -599,7 +599,7 @@ void JRenderer::RenderQuad(JQuad* quad, float xo, float yo, float angle, float x
|
||||
|
||||
if (quad->mHFlipped)// || quad->mVFlipped)
|
||||
{
|
||||
|
||||
|
||||
for (end = quad->mX, start = quad->mX+quad->mWidth; start > end; start -= SLICE_SIZE_F)
|
||||
{
|
||||
// allocate memory on the current display list for temporary storage
|
||||
@@ -616,32 +616,32 @@ void JRenderer::RenderQuad(JQuad* quad, float xo, float yo, float angle, float x
|
||||
destWidth = width*xScale;
|
||||
}
|
||||
|
||||
vertices[0].u = start;
|
||||
vertices[0].u = start;
|
||||
vertices[0].v = quad->mY;
|
||||
vertices[0].color = quad->mColor[0];//.color;
|
||||
vertices[0].x = x;
|
||||
vertices[0].y = y;
|
||||
vertices[0].x = x;
|
||||
vertices[0].y = y;
|
||||
vertices[0].z = 0.0f;
|
||||
|
||||
vertices[2].u = start - width;
|
||||
vertices[2].u = start - width;
|
||||
vertices[2].v = quad->mY;
|
||||
vertices[2].color = quad->mColor[2];//.color;
|
||||
vertices[2].x = x + destWidth;
|
||||
vertices[2].y = y;
|
||||
vertices[2].x = x + destWidth;
|
||||
vertices[2].y = y;
|
||||
vertices[2].z = 0.0f;
|
||||
|
||||
vertices[1].u = start;
|
||||
vertices[1].u = start;
|
||||
vertices[1].v = quad->mY + quad->mHeight;
|
||||
vertices[1].color = quad->mColor[1];//.color;
|
||||
vertices[1].x = x;
|
||||
vertices[1].y = y + destHeight;
|
||||
vertices[1].x = x;
|
||||
vertices[1].y = y + destHeight;
|
||||
vertices[1].z = 0.0f;
|
||||
|
||||
vertices[3].u = start - width;
|
||||
vertices[3].u = start - width;
|
||||
vertices[3].v = quad->mY + quad->mHeight;
|
||||
vertices[3].color = quad->mColor[3];//.color;
|
||||
vertices[3].x = x + destWidth;
|
||||
vertices[3].y = y + destHeight;
|
||||
vertices[3].x = x + destWidth;
|
||||
vertices[3].y = y + destHeight;
|
||||
vertices[3].z = 0.0f;
|
||||
|
||||
if (quad->mVFlipped)
|
||||
@@ -655,7 +655,7 @@ void JRenderer::RenderQuad(JQuad* quad, float xo, float yo, float angle, float x
|
||||
for (int i=0;i<4;i++)
|
||||
{
|
||||
xx = (cosAngle*(vertices[i].x-xo) - sinAngle*(vertices[i].y-yo) + xo);
|
||||
yy = (sinAngle*(vertices[i].x-xo) + cosAngle*(vertices[i].y-yo) + yo);
|
||||
yy = (sinAngle*(vertices[i].x-xo) + cosAngle*(vertices[i].y-yo) + yo);
|
||||
vertices[i].x = xx;
|
||||
vertices[i].y = yy;
|
||||
}
|
||||
@@ -684,32 +684,32 @@ void JRenderer::RenderQuad(JQuad* quad, float xo, float yo, float angle, float x
|
||||
destWidth = width*xScale;
|
||||
}
|
||||
|
||||
vertices[0].u = start;
|
||||
vertices[0].u = start;
|
||||
vertices[0].v = quad->mY;
|
||||
vertices[0].color = quad->mColor[0];//.color;
|
||||
vertices[0].x = x;
|
||||
vertices[0].y = y;
|
||||
vertices[0].x = x;
|
||||
vertices[0].y = y;
|
||||
vertices[0].z = 0.0f;
|
||||
|
||||
vertices[2].u = start + width;
|
||||
vertices[2].u = start + width;
|
||||
vertices[2].v = quad->mY;
|
||||
vertices[2].color = quad->mColor[2];//.color;
|
||||
vertices[2].x = x + destWidth;
|
||||
vertices[2].y = y;
|
||||
vertices[2].x = x + destWidth;
|
||||
vertices[2].y = y;
|
||||
vertices[2].z = 0.0f;
|
||||
|
||||
vertices[1].u = start;
|
||||
vertices[1].u = start;
|
||||
vertices[1].v = quad->mY + quad->mHeight;
|
||||
vertices[1].color = quad->mColor[1];//.color;
|
||||
vertices[1].x = x;
|
||||
vertices[1].y = y + destHeight;
|
||||
vertices[1].x = x;
|
||||
vertices[1].y = y + destHeight;
|
||||
vertices[1].z = 0.0f;
|
||||
|
||||
vertices[3].u = start + width;
|
||||
vertices[3].u = start + width;
|
||||
vertices[3].v = quad->mY + quad->mHeight;
|
||||
vertices[3].color = quad->mColor[3];//.color;
|
||||
vertices[3].x = x + destWidth;
|
||||
vertices[3].y = y + destHeight;
|
||||
vertices[3].x = x + destWidth;
|
||||
vertices[3].y = y + destHeight;
|
||||
vertices[3].z = 0.0f;
|
||||
|
||||
if (quad->mVFlipped)
|
||||
@@ -717,13 +717,13 @@ void JRenderer::RenderQuad(JQuad* quad, float xo, float yo, float angle, float x
|
||||
Swap(&vertices[0].v, &vertices[2].v);
|
||||
Swap(&vertices[1].v, &vertices[3].v);
|
||||
}
|
||||
|
||||
|
||||
if (angle != 0.0f)
|
||||
{
|
||||
for (int i=0;i<4;i++)
|
||||
{
|
||||
xx = (cosAngle*(vertices[i].x-xo) - sinAngle*(vertices[i].y-yo) + xo);
|
||||
yy = (sinAngle*(vertices[i].x-xo) + cosAngle*(vertices[i].y-yo) + yo);
|
||||
yy = (sinAngle*(vertices[i].x-xo) + cosAngle*(vertices[i].y-yo) + yo);
|
||||
vertices[i].x = xx;
|
||||
vertices[i].y = yy;
|
||||
}
|
||||
@@ -747,7 +747,7 @@ void JRenderer::RenderQuad(JQuad* quad, VertexColor* points)
|
||||
|
||||
if (mCurrentBlend != quad->mBlend)
|
||||
{
|
||||
sceGuTexFunc(quad->mBlend, GU_TCC_RGBA);
|
||||
sceGuTexFunc(quad->mBlend, GU_TCC_RGBA);
|
||||
mCurrentBlend = quad->mBlend;
|
||||
}
|
||||
|
||||
@@ -755,49 +755,49 @@ void JRenderer::RenderQuad(JQuad* quad, VertexColor* points)
|
||||
// in order to rotate, we use 4 vertices this time
|
||||
struct Vertex* vertices = (struct Vertex*)sceGuGetMemory(4 * sizeof(struct Vertex));
|
||||
|
||||
vertices[0].u = quad->mX;
|
||||
vertices[0].u = quad->mX;
|
||||
vertices[0].v = quad->mY;
|
||||
|
||||
vertices[1].u = quad->mX;
|
||||
vertices[1].u = quad->mX;
|
||||
vertices[1].v = quad->mY + quad->mHeight;
|
||||
|
||||
vertices[2].u = quad->mX + quad->mWidth;
|
||||
vertices[2].u = quad->mX + quad->mWidth;
|
||||
vertices[2].v = quad->mY;
|
||||
|
||||
vertices[3].u = quad->mX + quad->mWidth;
|
||||
vertices[3].u = quad->mX + quad->mWidth;
|
||||
vertices[3].v = quad->mY + quad->mHeight;
|
||||
|
||||
// for (int i=0;i<4;i++)
|
||||
// {
|
||||
// vertices[i].color = points[i].color;
|
||||
// vertices[i].x = points[i].x;
|
||||
// vertices[i].y = points[i].y;
|
||||
// vertices[i].x = points[i].x;
|
||||
// vertices[i].y = points[i].y;
|
||||
// vertices[i].z = points[i].z;
|
||||
// }
|
||||
|
||||
vertices[0].color = points[3].color;
|
||||
vertices[0].x = points[3].x;
|
||||
vertices[0].y = points[3].y;
|
||||
vertices[0].x = points[3].x;
|
||||
vertices[0].y = points[3].y;
|
||||
vertices[0].z = points[3].z;
|
||||
|
||||
vertices[1].color = points[0].color;
|
||||
vertices[1].x = points[0].x;
|
||||
vertices[1].y = points[0].y;
|
||||
vertices[1].x = points[0].x;
|
||||
vertices[1].y = points[0].y;
|
||||
vertices[1].z = points[0].z;
|
||||
|
||||
vertices[2].color = points[2].color;
|
||||
vertices[2].x = points[2].x;
|
||||
vertices[2].y = points[2].y;
|
||||
vertices[2].x = points[2].x;
|
||||
vertices[2].y = points[2].y;
|
||||
vertices[2].z = points[2].z;
|
||||
|
||||
vertices[3].color = points[1].color;
|
||||
vertices[3].x = points[1].x;
|
||||
vertices[3].y = points[1].y;
|
||||
vertices[3].x = points[1].x;
|
||||
vertices[3].y = points[1].y;
|
||||
vertices[3].z = points[1].z;
|
||||
|
||||
|
||||
|
||||
sceGuDrawArray(GU_TRIANGLE_STRIP,GU_TEXTURE_32BITF|TEXTURE_COLOR_FORMAT|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 4, 0, vertices);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -820,7 +820,7 @@ void JRenderer::ScreenShot(const char* filename)
|
||||
png_infop info_ptr;
|
||||
FILE* fp;
|
||||
u8* line;
|
||||
|
||||
|
||||
fp = fopen(filename, "wb");
|
||||
if (!fp) return;
|
||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
@@ -849,25 +849,25 @@ void JRenderer::ScreenShot(const char* filename)
|
||||
switch (pixelformat) {
|
||||
case PSP_DISPLAY_PIXEL_FORMAT_565:
|
||||
color = vram16[x + y * bufferwidth];
|
||||
r = (color & 0x1f) << 3;
|
||||
r = (color & 0x1f) << 3;
|
||||
g = ((color >> 5) & 0x3f) << 2 ;
|
||||
b = ((color >> 11) & 0x1f) << 3 ;
|
||||
break;
|
||||
case PSP_DISPLAY_PIXEL_FORMAT_5551:
|
||||
color = vram16[x + y * bufferwidth];
|
||||
r = (color & 0x1f) << 3;
|
||||
r = (color & 0x1f) << 3;
|
||||
g = ((color >> 5) & 0x1f) << 3 ;
|
||||
b = ((color >> 10) & 0x1f) << 3 ;
|
||||
break;
|
||||
case PSP_DISPLAY_PIXEL_FORMAT_4444:
|
||||
color = vram16[x + y * bufferwidth];
|
||||
r = (color & 0xf) << 4;
|
||||
r = (color & 0xf) << 4;
|
||||
g = ((color >> 4) & 0xf) << 4 ;
|
||||
b = ((color >> 8) & 0xf) << 4 ;
|
||||
break;
|
||||
case PSP_DISPLAY_PIXEL_FORMAT_8888:
|
||||
color = vram32[x + y * bufferwidth];
|
||||
r = color & 0xff;
|
||||
r = color & 0xff;
|
||||
g = (color >> 8) & 0xff;
|
||||
b = (color >> 16) & 0xff;
|
||||
break;
|
||||
@@ -921,16 +921,16 @@ static void swizzle_fast(u8* out, const u8* in, unsigned int width, unsigned int
|
||||
{
|
||||
unsigned int blockx, blocky;
|
||||
unsigned int j;
|
||||
|
||||
|
||||
unsigned int width_blocks = (width / 16);
|
||||
unsigned int height_blocks = (height / 8);
|
||||
|
||||
|
||||
unsigned int src_pitch = (width-16)/4;
|
||||
unsigned int src_row = width * 8;
|
||||
|
||||
|
||||
const u8* ysrc = in;
|
||||
u32* dst = (u32*)out;
|
||||
|
||||
|
||||
for (blocky = 0; blocky < height_blocks; ++blocky)
|
||||
{
|
||||
const u8* xsrc = ysrc;
|
||||
@@ -1110,7 +1110,7 @@ void JRenderer::LoadJPG(TextureInfo &textureInfo, const char *filename, int mode
|
||||
|
||||
|
||||
textureInfo.mBits = (u8 *)bits;
|
||||
textureInfo.mWidth = cinfo.output_width;
|
||||
textureInfo.mWidth = cinfo.output_width;
|
||||
textureInfo.mHeight = cinfo.output_height;
|
||||
textureInfo.mTexWidth = tw;
|
||||
textureInfo.mTexHeight = th;
|
||||
@@ -1126,7 +1126,7 @@ JTexture* JRenderer::LoadTexture(const char* filename, int mode)
|
||||
TextureInfo textureInfo;
|
||||
textureInfo.mVRAM = false;
|
||||
textureInfo.mBits = NULL;
|
||||
|
||||
|
||||
if (strstr(filename, ".jpg")!=NULL || strstr(filename, ".JPG")!=NULL)
|
||||
LoadJPG(textureInfo, filename, mode);
|
||||
else if(strstr(filename, ".gif")!=NULL || strstr(filename, ".GIF")!=NULL)
|
||||
@@ -1134,7 +1134,7 @@ JTexture* JRenderer::LoadTexture(const char* filename, int mode)
|
||||
else
|
||||
LoadPNG(textureInfo, filename, mode);
|
||||
|
||||
if (textureInfo.mBits == NULL)
|
||||
if (textureInfo.mBits == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -1192,7 +1192,7 @@ void JRenderer::LoadPNG(TextureInfo &textureInfo, const char* filename, int mode
|
||||
|
||||
JFileSystem* fileSystem = JFileSystem::GetInstance();
|
||||
if (!fileSystem->OpenFile(filename)) return;
|
||||
|
||||
|
||||
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
if (png_ptr == NULL) {
|
||||
//fclose(fp);
|
||||
@@ -1226,7 +1226,7 @@ void JRenderer::LoadPNG(TextureInfo &textureInfo, const char* filename, int mode
|
||||
png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int texWidth = getNextPower2(width);
|
||||
int texHeight = getNextPower2(height);
|
||||
|
||||
@@ -1236,7 +1236,7 @@ void JRenderer::LoadPNG(TextureInfo &textureInfo, const char* filename, int mode
|
||||
int size = texWidth * texHeight * sizeof(PIXEL_TYPE);
|
||||
|
||||
{
|
||||
|
||||
|
||||
if (useVideoRAM)// && (mCurrentPointer+size)<0x200000)
|
||||
{
|
||||
//bits = (PIXEL_TYPE*) (0x04000000+0x40000000+mCurrentPointer);
|
||||
@@ -1251,7 +1251,7 @@ void JRenderer::LoadPNG(TextureInfo &textureInfo, const char* filename, int mode
|
||||
videoRAMUsed = false;
|
||||
bits = (PIXEL_TYPE*) memalign(16, size);
|
||||
}
|
||||
|
||||
|
||||
PIXEL_TYPE* buffer = bits;
|
||||
|
||||
if (mSwizzle)
|
||||
@@ -1262,10 +1262,10 @@ void JRenderer::LoadPNG(TextureInfo &textureInfo, const char* filename, int mode
|
||||
p32 = (u32*) buffer;
|
||||
p16 = (u16*) p32;
|
||||
|
||||
for (y = 0; y < (int)height; y++)
|
||||
for (y = 0; y < (int)height; y++)
|
||||
{
|
||||
png_read_row(png_ptr, (u8*) line, png_bytep_NULL);
|
||||
for (x = 0; x < (int)width; x++)
|
||||
for (x = 0; x < (int)width; x++)
|
||||
{
|
||||
u32 color32 = line[x];
|
||||
u16 color16;
|
||||
@@ -1309,9 +1309,9 @@ void JRenderer::LoadPNG(TextureInfo &textureInfo, const char* filename, int mode
|
||||
free (line);
|
||||
png_read_end(png_ptr, info_ptr);
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
|
||||
|
||||
|
||||
fileSystem->CloseFile();
|
||||
|
||||
|
||||
if (done)
|
||||
{
|
||||
textureInfo.mBits = (u8 *)bits;
|
||||
@@ -1321,7 +1321,7 @@ void JRenderer::LoadPNG(TextureInfo &textureInfo, const char* filename, int mode
|
||||
textureInfo.mTexHeight = texHeight;
|
||||
textureInfo.mVRAM = videoRAMUsed;
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1375,7 +1375,7 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
|
||||
|
||||
switch (RecordType) {
|
||||
case IMAGE_DESC_RECORD_TYPE:
|
||||
{
|
||||
{
|
||||
if (DGifGetImageDesc(GifFileIn) == GIF_ERROR)
|
||||
{
|
||||
DGifCloseFile(GifFileIn);
|
||||
@@ -1401,7 +1401,7 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
|
||||
|
||||
bool done = false;
|
||||
PIXEL_TYPE* bits = NULL;
|
||||
|
||||
|
||||
size = textureInfo.mTexWidth * textureInfo.mTexHeight * sizeof(PIXEL_TYPE);
|
||||
|
||||
if (useVideoRAM)// && (mCurrentPointer+size)<0x200000)
|
||||
@@ -1440,7 +1440,7 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
|
||||
|
||||
DWORD * curr = p32;
|
||||
DWORD * imgdata = p32;
|
||||
for (i = 0; i < GifFileIn->Image.Height; i ++)
|
||||
for (i = 0; i < GifFileIn->Image.Height; i ++)
|
||||
{
|
||||
imgdata = curr;
|
||||
if (DGifGetLine(GifFileIn, LineIn, GifFileIn->Image.Width) == GIF_ERROR)
|
||||
@@ -1554,7 +1554,7 @@ void JRenderer::LoadGIF(TextureInfo &textureInfo, const char *filename, int mode
|
||||
//FILE * fp = fopen(filename, "rb");
|
||||
//if(fp == NULL)
|
||||
// return;
|
||||
|
||||
|
||||
JFileSystem *fileSys = JFileSystem::GetInstance();
|
||||
if (!fileSys->OpenFile(filename))
|
||||
return;
|
||||
@@ -1592,7 +1592,7 @@ JTexture* JRenderer::CreateTexture(int width, int height, int mode)
|
||||
|
||||
tex->mTexWidth = getNextPower2(width);
|
||||
tex->mTexHeight = getNextPower2(height);
|
||||
|
||||
|
||||
int size = tex->mTexWidth * tex->mTexHeight * sizeof(PIXEL_TYPE);
|
||||
if (useVideoRAM)// && (mCurrentPointer+size)<0x200000)
|
||||
{
|
||||
@@ -1623,7 +1623,7 @@ JTexture* JRenderer::CreateTexture(int width, int height, int mode)
|
||||
// {
|
||||
// if (tex->mBits && !tex->mInVideoRAM)
|
||||
// free(tex->mBits);
|
||||
//
|
||||
//
|
||||
// delete tex;
|
||||
// tex = NULL;
|
||||
// }
|
||||
@@ -2036,7 +2036,7 @@ void JRenderer::DrawRoundRect( float x1,float y1, float w,float h,float radius,P
|
||||
JRenderer::GetInstance()->DrawLine(x1+(radius-q),y1+i+radius,x1+(radius-nextq),y1+i+radius,color);
|
||||
JRenderer::GetInstance()->DrawLine(x2+radius+q,y1+i+radius,x2+radius+nextq,y1+i+radius,color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2077,7 +2077,7 @@ void JRenderer::FillRoundRect(float x, float y, float w, float h, float radius,
|
||||
angle = 0;
|
||||
}
|
||||
|
||||
y+=h;
|
||||
y+=h;
|
||||
for(int i=90; i<135; i++)
|
||||
{
|
||||
vertices[i+1].color = color;
|
||||
|
||||
@@ -25,10 +25,10 @@ JGuiObject::JGuiObject(int id): mId(id)
|
||||
JGuiObject::~JGuiObject()
|
||||
{
|
||||
// JGERelease();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
bool JGuiObject::Leaving(u32 key)
|
||||
bool JGuiObject::Leaving(u32 key __attribute__((unused)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ int JGuiObject::GetId()
|
||||
}
|
||||
|
||||
|
||||
void JGuiObject::Update(float dt)
|
||||
void JGuiObject::Update(float dt __attribute__((unused)))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
// 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>
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ JRenderer* JLBFont::mRenderer = NULL;
|
||||
JLBFont::JLBFont(const char *fontname, int lineheight, bool useVideoRAM)
|
||||
{
|
||||
mRenderer = JRenderer::GetInstance();
|
||||
|
||||
|
||||
mHeight = 0;
|
||||
mScale = 1.0f;
|
||||
mRotation = mSpacing = 0.0f;
|
||||
@@ -33,27 +33,27 @@ JLBFont::JLBFont(const char *fontname, int lineheight, bool useVideoRAM)
|
||||
mTexture = NULL;
|
||||
mQuad = NULL;
|
||||
mBase = 0;
|
||||
|
||||
|
||||
char filename[256];
|
||||
short buffer[1024];
|
||||
|
||||
|
||||
|
||||
|
||||
sprintf(filename, "%s.dat", fontname);
|
||||
|
||||
|
||||
//FILE *file;
|
||||
JFileSystem *fileSys = JFileSystem::GetInstance();
|
||||
if (!fileSys->OpenFile(filename)) return;
|
||||
|
||||
fileSys->ReadFile((u8 *)buffer, 2048);
|
||||
fileSys->CloseFile();
|
||||
|
||||
|
||||
sprintf(filename, "%s.png", fontname);
|
||||
mTexture = mRenderer->LoadTexture(filename, useVideoRAM);
|
||||
|
||||
if (mTexture == NULL) return;
|
||||
|
||||
|
||||
mHeight = (float) lineheight;
|
||||
|
||||
|
||||
mQuad = new JQuad(mTexture, 0.0f, 0.0f, 16.0f, mHeight);
|
||||
|
||||
float a, b, c;
|
||||
@@ -63,7 +63,7 @@ JLBFont::JLBFont(const char *fontname, int lineheight, bool useVideoRAM)
|
||||
|
||||
// there are 16x16 characters in the texture map.
|
||||
float cellHeight = mTexture->mHeight/16.0f;
|
||||
|
||||
|
||||
int n = 0;
|
||||
for (int i=0;i<16;i++)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ JLBFont::JLBFont(const char *fontname, int lineheight, bool useVideoRAM)
|
||||
a = (float)buffer[n*4+1]; // character width
|
||||
b = (float)buffer[n*4+2];
|
||||
c = (float)buffer[n*4+3];
|
||||
|
||||
|
||||
mXPos[n] = x;
|
||||
mYPos[n] = y;
|
||||
mCharWidth[n] = a+b+c;
|
||||
@@ -83,18 +83,18 @@ JLBFont::JLBFont(const char *fontname, int lineheight, bool useVideoRAM)
|
||||
|
||||
y += cellHeight;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
JLBFont::~JLBFont()
|
||||
{
|
||||
if (mQuad)
|
||||
delete mQuad;
|
||||
|
||||
if (mTexture)
|
||||
if (mTexture)
|
||||
delete mTexture;
|
||||
|
||||
|
||||
// JGERelease();
|
||||
}
|
||||
|
||||
@@ -105,9 +105,9 @@ void JLBFont::DrawString(const char *string, float x, float y, int align)
|
||||
float dx = x, dy = y;
|
||||
|
||||
if (mQuad == NULL) return;
|
||||
|
||||
|
||||
float width = GetStringWidth(string);
|
||||
|
||||
|
||||
if (align == JGETEXT_RIGHT)
|
||||
dx -= width;
|
||||
else if (align == JGETEXT_CENTER)
|
||||
@@ -123,7 +123,7 @@ void JLBFont::DrawString(const char *string, float x, float y, int align)
|
||||
p++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -131,11 +131,11 @@ void JLBFont::printf(float x, float y, const char *format, ...)
|
||||
{
|
||||
char buffer[PRINTF_BUFFER_SIZE];
|
||||
va_list list;
|
||||
|
||||
|
||||
va_start(list, format);
|
||||
vsprintf(buffer, format, list);
|
||||
va_end(list);
|
||||
|
||||
|
||||
DrawString(buffer, x, y);
|
||||
}
|
||||
|
||||
@@ -151,10 +151,10 @@ void JLBFont::SetColor(PIXEL_TYPE color)
|
||||
float JLBFont::GetStringWidth(const char *string) const
|
||||
{
|
||||
float len = 0.0f;
|
||||
|
||||
|
||||
const char *p = string;
|
||||
char ch;
|
||||
|
||||
|
||||
while (*p)
|
||||
{
|
||||
ch = *p - 32;
|
||||
@@ -162,7 +162,7 @@ float JLBFont::GetStringWidth(const char *string) const
|
||||
if (ch < 0) continue;
|
||||
len += mCharWidth[ch+mBase];
|
||||
}
|
||||
|
||||
|
||||
return len*mScale;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ float JLBFont::GetRotation() const { return mRotation; }
|
||||
float JLBFont::GetTracking() const { return mTracking; }
|
||||
float JLBFont::GetHeight() const { return mHeight; }
|
||||
|
||||
void JLBFont::SetBase(int base)
|
||||
{
|
||||
mBase = (base==0)?0:128;
|
||||
void JLBFont::SetBase(int base)
|
||||
{
|
||||
mBase = (base==0)?0:128;
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ bool JMD2Model::Load(char *filename, char *textureName)
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// 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)
|
||||
#else
|
||||
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
|
||||
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
|
||||
glNormal3f(result[0]/length, result[1]/length, result[2]/length);
|
||||
|
||||
@@ -273,7 +273,7 @@ void JMD2Model::Render(int frameNum)
|
||||
mRenderer->BindTexture(mModel->modelTex);
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
|
||||
|
||||
// display the textured model with proper lighting normals
|
||||
@@ -465,7 +465,7 @@ void JMD2Model::Render()
|
||||
|
||||
mRenderer->BindTexture(mModel->modelTex);
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
@@ -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')
|
||||
output[index++] = buffer[start++];
|
||||
|
||||
while (start < size && buffer[start] == '\n' || buffer[start] == '\r')
|
||||
while ((start < size && buffer[start] == '\n') || buffer[start] == '\r')
|
||||
start++;
|
||||
|
||||
output[index] = 0;
|
||||
|
||||
@@ -90,7 +90,7 @@ bool JParticleEffect::Load(const char* filename)
|
||||
// FIELD_COUNT
|
||||
// };
|
||||
|
||||
char* lifeValues[] =
|
||||
const char* lifeValues[] =
|
||||
{
|
||||
"speed",
|
||||
"size",
|
||||
@@ -104,7 +104,7 @@ bool JParticleEffect::Load(const char* filename)
|
||||
"gravity"
|
||||
};
|
||||
|
||||
char* typeNames[] =
|
||||
const char* typeNames[] =
|
||||
{
|
||||
"POINT",
|
||||
"AREA",
|
||||
@@ -113,7 +113,7 @@ bool JParticleEffect::Load(const char* filename)
|
||||
"CIRCLE"
|
||||
};
|
||||
|
||||
char* modeNames[] =
|
||||
const char* modeNames[] =
|
||||
{
|
||||
"REPEAT",
|
||||
"ONCE",
|
||||
@@ -121,8 +121,6 @@ bool JParticleEffect::Load(const char* filename)
|
||||
"CONTINUOUS"
|
||||
};
|
||||
|
||||
int i;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// One effect per file only, well, we may extend it later to permit
|
||||
// multiple effect definitions:
|
||||
@@ -159,7 +157,7 @@ bool JParticleEffect::Load(const char* filename)
|
||||
else if (strcmp(element->Attribute("blend"), "ADDITIVE")==0)
|
||||
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)
|
||||
{
|
||||
@@ -170,7 +168,7 @@ bool JParticleEffect::Load(const char* filename)
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -109,7 +109,7 @@ void JParticleEmitter::SetQuad(JQuad *quad)
|
||||
|
||||
void JParticleEmitter::Update(float dt)
|
||||
{
|
||||
JParticleSystem* particleSys = mParent->GetParticleSystem();
|
||||
// JParticleSystem* particleSys = mParent->GetParticleSystem();
|
||||
|
||||
mActiveParticleCount = 0;
|
||||
|
||||
@@ -185,7 +185,7 @@ void JParticleEmitter::Update(float dt)
|
||||
|
||||
void JParticleEmitter::EmitParticles(int count)
|
||||
{
|
||||
JParticleSystem* particleSys = mParent->GetParticleSystem();
|
||||
// JParticleSystem* particleSys = mParent->GetParticleSystem();
|
||||
|
||||
JParticleData *dataPtr;
|
||||
JParticle* particle;
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
// 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>
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
#include "../include/JGE.h"
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
JResourceManager::JResourceManager()
|
||||
{
|
||||
//mResourceRoot = "Res/"; // default root folder
|
||||
//mResourceRoot = "Res/"; // default root folder
|
||||
|
||||
mTextureList.clear();
|
||||
mTextureList.reserve(16);
|
||||
@@ -43,7 +43,7 @@ JResourceManager::JResourceManager()
|
||||
// mParticleEffectList.clear();
|
||||
// mParticleEffectList.reserve(8);
|
||||
// mParticleEffectMap.clear();
|
||||
//
|
||||
//
|
||||
// mMotionEmitterList.clear();
|
||||
// mMotionEmitterList.reserve(16);
|
||||
// mMotionEmitterMap.clear();
|
||||
@@ -52,7 +52,7 @@ JResourceManager::JResourceManager()
|
||||
|
||||
JResourceManager::~JResourceManager()
|
||||
{
|
||||
|
||||
|
||||
RemoveAll();
|
||||
}
|
||||
|
||||
@@ -91,13 +91,13 @@ void JResourceManager::RemoveAll()
|
||||
|
||||
// for (vector<JParticleEffect *>::iterator effect = mParticleEffectList.begin(); effect != mParticleEffectList.end(); ++effect)
|
||||
// delete *effect;
|
||||
//
|
||||
//
|
||||
// mParticleEffectList.clear();
|
||||
// mParticleEffectMap.clear();
|
||||
//
|
||||
//
|
||||
// for (vector<JMotionEmitter *>::iterator emitter = mMotionEmitterList.begin(); emitter != mMotionEmitterList.end(); ++emitter)
|
||||
// delete *emitter;
|
||||
//
|
||||
//
|
||||
// mMotionEmitterList.clear();
|
||||
// mMotionEmitterMap.clear();
|
||||
|
||||
@@ -109,7 +109,7 @@ bool JResourceManager::LoadResource(const string& resourceName)
|
||||
string path = /*mResourceRoot + */resourceName;
|
||||
|
||||
// TiXmlDocument doc(path.c_str());
|
||||
//
|
||||
//
|
||||
// if (!doc.LoadFile()) return false;
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ bool JResourceManager::LoadResource(const string& resourceName)
|
||||
TiXmlNode* node = 0;
|
||||
TiXmlElement* element = 0;
|
||||
|
||||
resource = doc.FirstChild("resource");
|
||||
resource = doc.FirstChild("resource");
|
||||
if (resource)
|
||||
{
|
||||
element = resource->ToElement();
|
||||
@@ -161,10 +161,10 @@ bool JResourceManager::LoadResource(const string& resourceName)
|
||||
float value;
|
||||
float hotspotX = 0.0f;
|
||||
float hotspotY = 0.0f;
|
||||
|
||||
|
||||
if (element->QueryFloatAttribute("x", &value) == TIXML_SUCCESS)
|
||||
x = value;
|
||||
|
||||
|
||||
if (element->QueryFloatAttribute("y", &value) == TIXML_SUCCESS)
|
||||
y = value;
|
||||
|
||||
@@ -192,10 +192,10 @@ bool JResourceManager::LoadResource(const string& resourceName)
|
||||
|
||||
// if (element->QueryFloatAttribute("regx", &value) == TIXML_SUCCESS)
|
||||
// hotspotX = width/2;
|
||||
//
|
||||
//
|
||||
// if (element->QueryFloatAttribute("regy", &value) == TIXML_SUCCESS)
|
||||
// hotspotY = height/2;
|
||||
|
||||
|
||||
int id = CreateQuad(quadName, textureName, x, y, width, height);
|
||||
if (id != INVALID_ID)
|
||||
{
|
||||
@@ -223,9 +223,9 @@ bool JResourceManager::LoadResource(const string& resourceName)
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
fileSystem->CloseFile();
|
||||
delete[] xmlBuffer;
|
||||
// JGERelease();
|
||||
@@ -243,7 +243,7 @@ int JResourceManager::CreateTexture(const string &textureName)
|
||||
string path = /*mResourceRoot + */textureName;
|
||||
|
||||
printf("creating texture:%s\n", path.c_str());
|
||||
|
||||
|
||||
JTexture *tex = JRenderer::GetInstance()->LoadTexture(path.c_str());
|
||||
|
||||
if (tex == NULL)
|
||||
@@ -252,7 +252,7 @@ int JResourceManager::CreateTexture(const string &textureName)
|
||||
int id = mTextureList.size();
|
||||
mTextureList.push_back(tex);
|
||||
mTextureMap[textureName] = id;
|
||||
|
||||
|
||||
return id;
|
||||
}
|
||||
else
|
||||
@@ -286,7 +286,7 @@ int JResourceManager::CreateQuad(const string &quadName, const string &textureNa
|
||||
|
||||
if (itr == mQuadMap.end())
|
||||
{
|
||||
JTexture *tex = GetTexture(textureName);
|
||||
JTexture *tex = GetTexture(textureName);
|
||||
if (tex == NULL)
|
||||
{
|
||||
int texId = CreateTexture(textureName); // load texture if necessary
|
||||
@@ -302,7 +302,7 @@ int JResourceManager::CreateQuad(const string &quadName, const string &textureNa
|
||||
mQuadList.push_back(new JQuad(tex, x, y, width, height));
|
||||
|
||||
mQuadMap[quadName] = id;
|
||||
|
||||
|
||||
return id;
|
||||
|
||||
}
|
||||
@@ -340,13 +340,13 @@ int JResourceManager::LoadJLBFont(const string &fontName, int height)
|
||||
string path = /*mResourceRoot + */fontName;
|
||||
|
||||
printf("creating font:%s\n", path.c_str());
|
||||
|
||||
|
||||
int id = mFontList.size();
|
||||
///////////////////////////////////////
|
||||
mFontList.push_back(new JLBFont(path.c_str(), height, true));
|
||||
mFontList.push_back(new JLBFont(path.c_str(), height, true));
|
||||
|
||||
mFontMap[fontName] = id;
|
||||
|
||||
|
||||
return id;
|
||||
}
|
||||
else
|
||||
@@ -383,16 +383,16 @@ int JResourceManager::LoadMusic(const string &musicName)
|
||||
string path = /*mResourceRoot + */musicName;
|
||||
|
||||
printf("creating music:%s\n", path.c_str());
|
||||
|
||||
|
||||
JMusic *music = JSoundSystem::GetInstance()->LoadMusic(path.c_str());
|
||||
if (music == NULL)
|
||||
return INVALID_ID;
|
||||
|
||||
int id = mMusicList.size();
|
||||
mMusicList.push_back(music);
|
||||
mMusicList.push_back(music);
|
||||
|
||||
mMusicMap[musicName] = id;
|
||||
|
||||
|
||||
return id;
|
||||
}
|
||||
else
|
||||
@@ -429,16 +429,16 @@ int JResourceManager::LoadSample(const string &sampleName)
|
||||
string path = /*mResourceRoot + */sampleName;
|
||||
|
||||
printf("creating sample:%s\n", path.c_str());
|
||||
|
||||
|
||||
JSample *sample = JSoundSystem::GetInstance()->LoadSample(path.c_str());
|
||||
if (sample == NULL)
|
||||
return INVALID_ID;
|
||||
|
||||
int id = mSampleList.size();
|
||||
mSampleList.push_back(sample);
|
||||
mSampleList.push_back(sample);
|
||||
|
||||
mSampleMap[sampleName] = id;
|
||||
|
||||
|
||||
return id;
|
||||
}
|
||||
else
|
||||
@@ -465,46 +465,46 @@ JSample *JResourceManager::GetSample(int id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// int JResourceManager::RegisterParticleEffect(const string &effectName)
|
||||
// {
|
||||
// map<string, int>::iterator itr = mParticleEffectMap.find(effectName);
|
||||
//
|
||||
//
|
||||
// if (itr == mParticleEffectMap.end())
|
||||
// {
|
||||
// string path = mResourceRoot + effectName;
|
||||
// printf("creating effect:%s\n", path.c_str());
|
||||
// JParticleEffect *effect = new JParticleEffect(path.c_str());
|
||||
//
|
||||
//
|
||||
// if (effect == NULL)
|
||||
// return INVALID_ID;
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// int id = mParticleEffectList.size();
|
||||
// mParticleEffectList.push_back(effect);
|
||||
//
|
||||
//
|
||||
// mParticleEffectMap[effectName] = id;
|
||||
//
|
||||
//
|
||||
// return id;
|
||||
//
|
||||
//
|
||||
// }
|
||||
// else
|
||||
// return itr->second;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// JParticleEffect *JResourceManager::GetParticleEffect(const string &effectName)
|
||||
// {
|
||||
// map<string, int>::iterator itr = mParticleEffectMap.find(effectName);
|
||||
//
|
||||
//
|
||||
// if (itr == mParticleEffectMap.end())
|
||||
// return NULL;
|
||||
// else
|
||||
// return mParticleEffectList[itr->second];
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// JParticleEffect *JResourceManager::GetParticleEffect(int id)
|
||||
// {
|
||||
// if (id >=0 && id < (int)mParticleEffectList.size())
|
||||
@@ -512,48 +512,48 @@ JSample *JResourceManager::GetSample(int id)
|
||||
// else
|
||||
// return NULL;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// int JResourceManager::RegisterMotionEmitter(const string &emitterName)
|
||||
// {
|
||||
// map<string, int>::iterator itr = mMotionEmitterMap.find(emitterName);
|
||||
//
|
||||
//
|
||||
// if (itr == mMotionEmitterMap.end())
|
||||
// {
|
||||
// string path = mResourceRoot + emitterName;
|
||||
// printf("creating effect:%s\n", path.c_str());
|
||||
// JMotionEmitter *emitter = new JMotionEmitter();
|
||||
//
|
||||
//
|
||||
// if (emitter == NULL)
|
||||
// return INVALID_ID;
|
||||
//
|
||||
//
|
||||
// emitter->LoadMotionML(path.c_str());
|
||||
//
|
||||
//
|
||||
// int id = mMotionEmitterList.size();
|
||||
// mMotionEmitterList.push_back(emitter);
|
||||
//
|
||||
//
|
||||
// mMotionEmitterMap[emitterName] = id;
|
||||
//
|
||||
//
|
||||
// return id;
|
||||
//
|
||||
//
|
||||
// }
|
||||
// else
|
||||
// return itr->second;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// JMotionEmitter *JResourceManager::GetMotionEmitter(const string &emitterName)
|
||||
// {
|
||||
// map<string, int>::iterator itr = mMotionEmitterMap.find(emitterName);
|
||||
//
|
||||
//
|
||||
// if (itr == mMotionEmitterMap.end())
|
||||
// return NULL;
|
||||
// else
|
||||
// return mMotionEmitterList[itr->second];
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// JMotionEmitter *JResourceManager::GetMotionEmitter(int id)
|
||||
// {
|
||||
// if (id >=0 && id < (int)mMotionEmitterList.size())
|
||||
|
||||
@@ -144,7 +144,7 @@ void JSprite::Render()
|
||||
// //mQuad->SetColor(ARGB(alpha,255,255,255));
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
mFrames[mCurrentFrame]->SetColor(alpha<<24 | mColor);
|
||||
// mQuad->SetFlip(mFlipped[mCurrentFrame], false);
|
||||
#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); }
|
||||
#else
|
||||
void JSprite::SetColor(PIXEL_TYPE color) { mColor = (color&~MASK_ALPHA); }
|
||||
@@ -344,7 +344,7 @@ void JSprite::SetCurrentFrameIndex(int frame)
|
||||
|
||||
JQuad* JSprite::GetCurrentFrame()
|
||||
{
|
||||
if (mCurrentFrame < mFrames.size())
|
||||
if (mCurrentFrame < (signed int)mFrames.size())
|
||||
return mFrames[mCurrentFrame];
|
||||
else
|
||||
return NULL;
|
||||
@@ -358,7 +358,7 @@ int JSprite::GetFrameCount()
|
||||
|
||||
JQuad* JSprite::GetFrame(int index)
|
||||
{
|
||||
if (index < mFrames.size())
|
||||
if (index < (signed int)mFrames.size())
|
||||
return mFrames[index];
|
||||
else
|
||||
return NULL;
|
||||
|
||||
@@ -19,8 +19,9 @@
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
#pragma comment( lib, "freetype.lib" )
|
||||
|
||||
#ifndef LINUX
|
||||
#pragma comment( lib, "freetype.lib" )
|
||||
#endif
|
||||
|
||||
#include "../include/JGE.h"
|
||||
#include "../include/JRenderer.h"
|
||||
@@ -257,7 +258,7 @@ int JTTFont::PreCacheChar(u16 ch, u16 cachedCode)
|
||||
|
||||
FT_GlyphSlot slot = mFace->glyph;
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
DWORD *texBuffer = new DWORD[mMaxCharWidth*mMaxCharHeight];
|
||||
memset(texBuffer, 0, mMaxCharWidth*mMaxCharHeight*sizeof(DWORD));
|
||||
#else
|
||||
@@ -277,7 +278,7 @@ int JTTFont::PreCacheChar(u16 ch, u16 cachedCode)
|
||||
{
|
||||
int top = mSize-slot->bitmap_top+1;
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
int offset = top*mMaxCharWidth + slot->bitmap_left + 2;
|
||||
#else
|
||||
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];
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
texBuffer[i*mMaxCharWidth+j+offset] = RGBA(255, 255, 255, grey);
|
||||
#else
|
||||
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)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
texBuffer[i*mMaxCharWidth+j*8+k+offset] = RGBA(255, 255, 255, 255);
|
||||
#else
|
||||
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);
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, mMaxCharWidth, mMaxCharHeight, GL_RGBA, GL_UNSIGNED_BYTE, texBuffer);
|
||||
#else
|
||||
sceKernelDcacheWritebackAll();
|
||||
@@ -357,7 +358,7 @@ int JTTFont::PreCacheChar(u16 ch, u16 cachedCode)
|
||||
if (mCurr >= mMaxCharCount)
|
||||
mCurr = 0;
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
delete [] texBuffer;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
hgeDistortionMesh::hgeDistortionMesh(int cols, int rows)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
//hge=hgeCreate(HGE_VERSION);
|
||||
|
||||
nRows=rows;
|
||||
@@ -39,7 +39,7 @@ hgeDistortionMesh::hgeDistortionMesh(int cols, int rows)
|
||||
disp_array[i].y=0.0f;
|
||||
disp_array[i].u=0.0f;
|
||||
disp_array[i].v=0.0f;
|
||||
|
||||
|
||||
disp_array[i].z=0.5f;
|
||||
disp_array[i].color=ARGB(0xFF,0xFF,0xFF,0xFF);
|
||||
}
|
||||
@@ -89,7 +89,7 @@ hgeDistortionMesh& hgeDistortionMesh::operator= (const hgeDistortionMesh &dm)
|
||||
}
|
||||
|
||||
return *this;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void hgeDistortionMesh::SetTexture(JTexture* tex)
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ const char FNTCHARTAG[] = "Char";
|
||||
char hgeFont::buffer[256];
|
||||
|
||||
|
||||
hgeFont::hgeFont(const char *szFont, bool bMipmap)
|
||||
hgeFont::hgeFont(const char *szFont, bool bMipmap __attribute__((unused)))
|
||||
{
|
||||
//void *data;
|
||||
DWORD size;
|
||||
@@ -35,7 +35,7 @@ hgeFont::hgeFont(const char *szFont, bool bMipmap)
|
||||
int i, x, y, w, h, a, c;
|
||||
|
||||
// Setup variables
|
||||
|
||||
|
||||
//hge=hgeCreate(HGE_VERSION);
|
||||
|
||||
fHeight=0.0f;
|
||||
@@ -53,7 +53,7 @@ hgeFont::hgeFont(const char *szFont, bool bMipmap)
|
||||
memset( &letters, 0, sizeof(letters) );
|
||||
memset( &pre, 0, sizeof(letters) );
|
||||
memset( &post, 0, sizeof(letters) );
|
||||
|
||||
|
||||
// Load font description
|
||||
|
||||
JFileSystem* fileSys = JFileSystem::GetInstance();
|
||||
@@ -67,7 +67,7 @@ hgeFont::hgeFont(const char *szFont, bool bMipmap)
|
||||
//memcpy(desc,data,size);
|
||||
fileSys->ReadFile(desc, size);
|
||||
desc[size]=0;
|
||||
|
||||
|
||||
//hge->Resource_Free(data);
|
||||
fileSys->CloseFile();
|
||||
|
||||
@@ -75,7 +75,7 @@ hgeFont::hgeFont(const char *szFont, bool bMipmap)
|
||||
if(strcmp(linebuf, FNTHEADERTAG))
|
||||
{
|
||||
// hge->System_Log("Font %s has incorrect format.", szFont);
|
||||
delete[] desc;
|
||||
delete[] desc;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ hgeFont::hgeFont(const char *szFont, bool bMipmap)
|
||||
hTexture = renderer->LoadTexture(buf);
|
||||
if(!hTexture)
|
||||
{
|
||||
delete[] desc;
|
||||
delete[] desc;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ hgeFont::hgeFont(const char *szFont, bool bMipmap)
|
||||
}
|
||||
}
|
||||
|
||||
delete[] desc;
|
||||
delete[] desc;
|
||||
}
|
||||
|
||||
|
||||
@@ -265,7 +265,7 @@ void hgeFont::printfb(float x, float y, float w, float h, int align, const char
|
||||
prevword=&pbuf[i];
|
||||
pbuf=&pbuf[i+1];
|
||||
}
|
||||
|
||||
|
||||
tx=x;
|
||||
ty=y;
|
||||
hh=fHeight*fSpacing*fScale*lines;
|
||||
|
||||
@@ -35,7 +35,7 @@ distribution.
|
||||
const TiXmlString::size_type TiXmlString::npos = static_cast< size_type >(-1);
|
||||
|
||||
// Null rep.
|
||||
TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, '\0' };
|
||||
TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } };
|
||||
|
||||
|
||||
void TiXmlString::reserve (size_type cap)
|
||||
|
||||
@@ -2,23 +2,23 @@
|
||||
www.sourceforge.net/projects/tinyxml
|
||||
Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,8 @@ distribution.
|
||||
|
||||
// Note tha "PutString" hardcodes the same list. This
|
||||
// is less flexible than it appears. Changing the entries
|
||||
// or order will break putstring.
|
||||
TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] =
|
||||
// or order will break putstring.
|
||||
TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] =
|
||||
{
|
||||
{ "&", 5, '&' },
|
||||
{ "<", 4, '<' },
|
||||
@@ -53,16 +53,16 @@ TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] =
|
||||
// Including the basic of this table, which determines the #bytes in the
|
||||
// sequence from the lead byte. 1 placed for invalid sequences --
|
||||
// although the result will be junk, pass it through as much as possible.
|
||||
// Beware of the non-characters in UTF-8:
|
||||
// Beware of the non-characters in UTF-8:
|
||||
// ef bb bf (Microsoft "lead bytes")
|
||||
// ef bf be
|
||||
// ef bf bf
|
||||
// ef bf bf
|
||||
|
||||
const unsigned char TIXML_UTF_LEAD_0 = 0xefU;
|
||||
const unsigned char TIXML_UTF_LEAD_1 = 0xbbU;
|
||||
const unsigned char TIXML_UTF_LEAD_2 = 0xbfU;
|
||||
|
||||
const int TiXmlBase::utf8ByteTable[256] =
|
||||
const int TiXmlBase::utf8ByteTable[256] =
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00
|
||||
@@ -74,9 +74,9 @@ const int TiXmlBase::utf8ByteTable[256] =
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0
|
||||
1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte
|
||||
@@ -90,7 +90,7 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng
|
||||
const unsigned long BYTE_MARK = 0x80;
|
||||
const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
|
||||
|
||||
if (input < 0x80)
|
||||
if (input < 0x80)
|
||||
*length = 1;
|
||||
else if ( input < 0x800 )
|
||||
*length = 2;
|
||||
@@ -104,22 +104,22 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng
|
||||
output += *length;
|
||||
|
||||
// Scary scary fall throughs.
|
||||
switch (*length)
|
||||
switch (*length)
|
||||
{
|
||||
case 4:
|
||||
--output;
|
||||
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
|
||||
--output;
|
||||
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
|
||||
input >>= 6;
|
||||
case 3:
|
||||
--output;
|
||||
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
|
||||
--output;
|
||||
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
|
||||
input >>= 6;
|
||||
case 2:
|
||||
--output;
|
||||
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
|
||||
--output;
|
||||
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
|
||||
input >>= 6;
|
||||
case 1:
|
||||
--output;
|
||||
--output;
|
||||
*output = (char)(input | FIRST_BYTE_MARK[*length]);
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng
|
||||
{
|
||||
// This will only work for low-ascii, everything else is assumed to be a valid
|
||||
// letter. I'm not sure this is the best approach, but it is quite tricky trying
|
||||
// to figure out alhabetical vs. not across encoding. So take a very
|
||||
// to figure out alhabetical vs. not across encoding. So take a very
|
||||
// conservative approach.
|
||||
|
||||
// if ( encoding == TIXML_ENCODING_UTF8 )
|
||||
@@ -150,7 +150,7 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng
|
||||
{
|
||||
// This will only work for low-ascii, everything else is assumed to be a valid
|
||||
// letter. I'm not sure this is the best approach, but it is quite tricky trying
|
||||
// to figure out alhabetical vs. not across encoding. So take a very
|
||||
// to figure out alhabetical vs. not across encoding. So take a very
|
||||
// conservative approach.
|
||||
|
||||
// if ( encoding == TIXML_ENCODING_UTF8 )
|
||||
@@ -223,7 +223,7 @@ void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding )
|
||||
case '\r':
|
||||
// bump down to the next line
|
||||
++row;
|
||||
col = 0;
|
||||
col = 0;
|
||||
// Eat the character
|
||||
++p;
|
||||
|
||||
@@ -265,11 +265,11 @@ void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding )
|
||||
// In these cases, don't advance the column. These are
|
||||
// 0-width spaces.
|
||||
if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 )
|
||||
p += 3;
|
||||
p += 3;
|
||||
else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU )
|
||||
p += 3;
|
||||
p += 3;
|
||||
else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU )
|
||||
p += 3;
|
||||
p += 3;
|
||||
else
|
||||
{ p +=3; ++col; } // A normal character.
|
||||
}
|
||||
@@ -321,10 +321,10 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
|
||||
while ( *p )
|
||||
{
|
||||
const unsigned char* pU = (const unsigned char*)p;
|
||||
|
||||
|
||||
// Skip the stupid Microsoft UTF-8 Byte order marks
|
||||
if ( *(pU+0)==TIXML_UTF_LEAD_0
|
||||
&& *(pU+1)==TIXML_UTF_LEAD_1
|
||||
&& *(pU+1)==TIXML_UTF_LEAD_1
|
||||
&& *(pU+2)==TIXML_UTF_LEAD_2 )
|
||||
{
|
||||
p += 3;
|
||||
@@ -353,7 +353,7 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( *p && IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' )
|
||||
while ( ( *p && IsWhiteSpace( *p ) ) || *p == '\n' || *p =='\r' )
|
||||
++p;
|
||||
}
|
||||
|
||||
@@ -406,11 +406,11 @@ const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncodi
|
||||
// After that, they can be letters, underscores, numbers,
|
||||
// hyphens, or colons. (Colons are valid ony for namespaces,
|
||||
// but tinyxml can't tell namespaces from names.)
|
||||
if ( p && *p
|
||||
if ( p && *p
|
||||
&& ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) )
|
||||
{
|
||||
while( p && *p
|
||||
&& ( IsAlphaNum( (unsigned char ) *p, encoding )
|
||||
&& ( IsAlphaNum( (unsigned char ) *p, encoding )
|
||||
|| *p == '_'
|
||||
|| *p == '-'
|
||||
|| *p == '.'
|
||||
@@ -458,7 +458,7 @@ const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXml
|
||||
ucs += mult * (*q - 'a' + 10);
|
||||
else if ( *q >= 'A' && *q <= 'F' )
|
||||
ucs += mult * (*q - 'A' + 10 );
|
||||
else
|
||||
else
|
||||
return 0;
|
||||
mult *= 16;
|
||||
--q;
|
||||
@@ -481,7 +481,7 @@ const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXml
|
||||
{
|
||||
if ( *q >= '0' && *q <= '9' )
|
||||
ucs += mult * (*q - '0');
|
||||
else
|
||||
else
|
||||
return 0;
|
||||
mult *= 10;
|
||||
--q;
|
||||
@@ -558,10 +558,10 @@ bool TiXmlBase::StringEqual( const char* p,
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* TiXmlBase::ReadText( const char* p,
|
||||
TIXML_STRING * text,
|
||||
bool trimWhiteSpace,
|
||||
const char* endTag,
|
||||
const char* TiXmlBase::ReadText( const char* p,
|
||||
TIXML_STRING * text,
|
||||
bool trimWhiteSpace,
|
||||
const char* endTag,
|
||||
bool caseInsensitive,
|
||||
TiXmlEncoding encoding )
|
||||
{
|
||||
@@ -632,7 +632,7 @@ void TiXmlDocument::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
|
||||
// This "pre-streaming" will never read the closing ">" so the
|
||||
// sub-tag can orient itself.
|
||||
|
||||
if ( !StreamTo( in, '<', tag ) )
|
||||
if ( !StreamTo( in, '<', tag ) )
|
||||
{
|
||||
SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
|
||||
return;
|
||||
@@ -654,7 +654,7 @@ void TiXmlDocument::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
|
||||
|
||||
if ( in->good() )
|
||||
{
|
||||
// We now have something we presume to be a node of
|
||||
// We now have something we presume to be a node of
|
||||
// some sort. Identify it, and call the node to
|
||||
// continue streaming.
|
||||
TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING );
|
||||
@@ -763,7 +763,7 @@ const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiX
|
||||
encoding = TIXML_ENCODING_UTF8;
|
||||
else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) )
|
||||
encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice
|
||||
else
|
||||
else
|
||||
encoding = TIXML_ENCODING_LEGACY;
|
||||
}
|
||||
|
||||
@@ -781,7 +781,7 @@ const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiX
|
||||
}
|
||||
|
||||
void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding )
|
||||
{
|
||||
{
|
||||
// The first error in a chain is more accurate - don't set again!
|
||||
if ( error )
|
||||
return;
|
||||
@@ -818,7 +818,7 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
|
||||
return 0;
|
||||
}
|
||||
|
||||
// What is this thing?
|
||||
// What is this thing?
|
||||
// - Elements start with a letter or underscore, but xml is reserved.
|
||||
// - Comments: <!--
|
||||
// - Decleration: <?xml
|
||||
@@ -906,7 +906,7 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
|
||||
return;
|
||||
}
|
||||
(*tag) += (char) c ;
|
||||
|
||||
|
||||
if ( c == '>' )
|
||||
break;
|
||||
}
|
||||
@@ -916,7 +916,7 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
|
||||
// Okay...if we are a "/>" tag, then we're done. We've read a complete tag.
|
||||
// If not, identify and stream.
|
||||
|
||||
if ( tag->at( tag->length() - 1 ) == '>'
|
||||
if ( tag->at( tag->length() - 1 ) == '>'
|
||||
&& tag->at( tag->length() - 2 ) == '/' )
|
||||
{
|
||||
// All good!
|
||||
@@ -933,7 +933,7 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
|
||||
StreamWhiteSpace( in, tag );
|
||||
|
||||
// Do we have text?
|
||||
if ( in->good() && in->peek() != '<' )
|
||||
if ( in->good() && in->peek() != '<' )
|
||||
{
|
||||
// Yep, text.
|
||||
TiXmlText text( "" );
|
||||
@@ -966,7 +966,7 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
|
||||
document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( c == '>' )
|
||||
break;
|
||||
|
||||
@@ -1075,7 +1075,7 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
|
||||
// Empty tag.
|
||||
if ( *p != '>' )
|
||||
{
|
||||
if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY, p, data, encoding );
|
||||
if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY, p, data, encoding );
|
||||
return 0;
|
||||
}
|
||||
return (p+1);
|
||||
@@ -1175,8 +1175,8 @@ const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXm
|
||||
LinkEndChild( textNode );
|
||||
else
|
||||
delete textNode;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
// We hit a '<'
|
||||
// Have we hit a new element or an end tag? This could also be
|
||||
@@ -1192,7 +1192,7 @@ const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXm
|
||||
{
|
||||
p = node->Parse( p, data, encoding );
|
||||
LinkEndChild( node );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
@@ -1206,7 +1206,7 @@ const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXm
|
||||
if ( !p )
|
||||
{
|
||||
if ( document ) document->SetError( TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding );
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -1216,7 +1216,7 @@ void TiXmlUnknown::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
|
||||
{
|
||||
while ( in->good() )
|
||||
{
|
||||
int c = in->get();
|
||||
int c = in->get();
|
||||
if ( c <= 0 )
|
||||
{
|
||||
TiXmlDocument* document = GetDocument();
|
||||
@@ -1229,7 +1229,7 @@ void TiXmlUnknown::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
|
||||
if ( c == '>' )
|
||||
{
|
||||
// All is well.
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1274,7 +1274,7 @@ void TiXmlComment::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
|
||||
{
|
||||
while ( in->good() )
|
||||
{
|
||||
int c = in->get();
|
||||
int c = in->get();
|
||||
if ( c <= 0 )
|
||||
{
|
||||
TiXmlDocument* document = GetDocument();
|
||||
@@ -1285,12 +1285,12 @@ void TiXmlComment::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
|
||||
|
||||
(*tag) += (char) c;
|
||||
|
||||
if ( c == '>'
|
||||
if ( c == '>'
|
||||
&& tag->at( tag->length() - 2 ) == '-'
|
||||
&& tag->at( tag->length() - 3 ) == '-' )
|
||||
{
|
||||
// All is well.
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1359,7 +1359,7 @@ const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlE
|
||||
if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const char* end;
|
||||
|
||||
if ( *p == '\'' )
|
||||
@@ -1396,7 +1396,7 @@ void TiXmlText::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
|
||||
{
|
||||
if ( cdata )
|
||||
{
|
||||
int c = in->get();
|
||||
int c = in->get();
|
||||
if ( c <= 0 )
|
||||
{
|
||||
TiXmlDocument* document = GetDocument();
|
||||
@@ -1407,19 +1407,19 @@ void TiXmlText::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
|
||||
|
||||
(*tag) += (char) c;
|
||||
|
||||
if ( c == '>'
|
||||
if ( c == '>'
|
||||
&& tag->at( tag->length() - 2 ) == ']'
|
||||
&& tag->at( tag->length() - 3 ) == ']' )
|
||||
{
|
||||
// All is well.
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( in->good() )
|
||||
{
|
||||
int c = in->peek();
|
||||
int c = in->peek();
|
||||
if ( c == '<' )
|
||||
return;
|
||||
if ( c <= 0 )
|
||||
@@ -1471,7 +1471,7 @@ const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncodi
|
||||
++p;
|
||||
}
|
||||
|
||||
TIXML_STRING dummy;
|
||||
TIXML_STRING dummy;
|
||||
p = ReadText( p, &dummy, false, endTag, false, encoding );
|
||||
return p;
|
||||
}
|
||||
@@ -1545,19 +1545,19 @@ const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXm
|
||||
if ( StringEqual( p, "version", true, _encoding ) )
|
||||
{
|
||||
TiXmlAttribute attrib;
|
||||
p = attrib.Parse( p, data, _encoding );
|
||||
p = attrib.Parse( p, data, _encoding );
|
||||
version = attrib.Value();
|
||||
}
|
||||
else if ( StringEqual( p, "encoding", true, _encoding ) )
|
||||
{
|
||||
TiXmlAttribute attrib;
|
||||
p = attrib.Parse( p, data, _encoding );
|
||||
p = attrib.Parse( p, data, _encoding );
|
||||
encoding = attrib.Value();
|
||||
}
|
||||
else if ( StringEqual( p, "standalone", true, _encoding ) )
|
||||
{
|
||||
TiXmlAttribute attrib;
|
||||
p = attrib.Parse( p, data, _encoding );
|
||||
p = attrib.Parse( p, data, _encoding );
|
||||
standalone = attrib.Value();
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user