This commit is contained in:
parent
af942304af
commit
ae882b7dfb
13 changed files with 84 additions and 74 deletions
|
@ -67,7 +67,7 @@ enum DRAW_TYPE
|
|||
#include "utils\cmxmacro.h"
|
||||
#include "utils\fixed.h"
|
||||
|
||||
#include "system\debug.h"
|
||||
#include "system\dbg.h"
|
||||
#include "system\info.h"
|
||||
#include "system\lnkopt.h"
|
||||
|
||||
|
|
|
@ -46,17 +46,17 @@ void GameState::think()
|
|||
{
|
||||
if( s_currentScene )
|
||||
{
|
||||
s_currentScene->Shutdown();
|
||||
s_currentScene->shutdown();
|
||||
}
|
||||
|
||||
s_currentScene=s_pendingScene;
|
||||
s_pendingScene=NULL;
|
||||
|
||||
s_currentScene->Init();
|
||||
s_currentScene->init();
|
||||
}
|
||||
}
|
||||
ASSERT(s_currentScene);
|
||||
s_currentScene->Control();
|
||||
s_currentScene->think();
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,7 +66,7 @@ void GameState::think()
|
|||
void GameState::render()
|
||||
{
|
||||
ASSERT(s_currentScene);
|
||||
s_currentScene->Render();
|
||||
s_currentScene->render();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,17 +14,24 @@
|
|||
#ifndef __SYSTEM_GSTATE_H__
|
||||
#define __SYSTEM_GSTATE_H__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
class CScene
|
||||
{
|
||||
public:
|
||||
CScene() {}
|
||||
virtual ~CScene() {}
|
||||
CScene() {;}
|
||||
virtual ~CScene() {;}
|
||||
|
||||
virtual void Init()=0;
|
||||
virtual void Shutdown()=0;
|
||||
virtual void Render()=0;
|
||||
virtual bool Control()=0;
|
||||
virtual char *GetSceneName()=0;
|
||||
virtual void init()=0;
|
||||
virtual void shutdown()=0;
|
||||
virtual void render()=0;
|
||||
virtual void think()=0;
|
||||
virtual char *getSceneName()=0;
|
||||
|
||||
protected:
|
||||
};
|
||||
|
@ -40,8 +47,8 @@ public:
|
|||
|
||||
static void setNextScene( CScene *_nextScene );
|
||||
|
||||
inline static u32 getTimeSinceLast() {return s_timeSinceLast;}
|
||||
inline static u32 getFramesSinceLast() {return (s_timeSinceLast>>12)+1;}
|
||||
inline static long int getTimeSinceLast() {return s_timeSinceLast;}
|
||||
inline static long int getFramesSinceLast() {return (s_timeSinceLast>>12)+1;}
|
||||
|
||||
static void setTimeSpeed( int speed );
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#include <stdio.h>
|
||||
//#include <stdio.h>
|
||||
|
||||
#include "system\vsprintf.h"
|
||||
|
||||
|
||||
// Linux Kernel Source Tour
|
||||
// http://www.tamacom.com/tour/linux/index.html
|
||||
|
@ -6,17 +9,6 @@
|
|||
|
||||
|
||||
|
||||
// stdarg defs from MSVC
|
||||
|
||||
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
|
||||
|
||||
#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) )
|
||||
#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
|
||||
#define va_end(ap) ( ap = (va_list)0 )
|
||||
|
||||
typedef char *va_list;
|
||||
|
||||
|
||||
|
||||
// linux/lib/string.c
|
||||
static int strnlen(const char * s, int count)
|
||||
|
@ -134,7 +126,7 @@ static char * number(char * str, long num, int base, int size, int precision
|
|||
return str;
|
||||
}
|
||||
|
||||
extern int vsprintf(char *buf, const char *fmt, va_list args)
|
||||
extern int __vsprintf(char *buf, const char *fmt, __va_list args)
|
||||
{
|
||||
int len;
|
||||
unsigned long num;
|
||||
|
@ -174,7 +166,7 @@ extern int vsprintf(char *buf, const char *fmt, va_list args)
|
|||
else if (*fmt == '*') {
|
||||
++fmt;
|
||||
/* it's the next argument */
|
||||
field_width = va_arg(args, int);
|
||||
field_width = __va_arg(args, int);
|
||||
if (field_width < 0) {
|
||||
field_width = -field_width;
|
||||
flags |= LEFT;
|
||||
|
@ -190,7 +182,7 @@ extern int vsprintf(char *buf, const char *fmt, va_list args)
|
|||
else if (*fmt == '*') {
|
||||
++fmt;
|
||||
/* it's the next argument */
|
||||
precision = va_arg(args, int);
|
||||
precision = __va_arg(args, int);
|
||||
}
|
||||
if (precision < 0)
|
||||
precision = 0;
|
||||
|
@ -211,13 +203,13 @@ extern int vsprintf(char *buf, const char *fmt, va_list args)
|
|||
if (!(flags & LEFT))
|
||||
while (--field_width > 0)
|
||||
*str++ = ' ';
|
||||
*str++ = (unsigned char) va_arg(args, int);
|
||||
*str++ = (unsigned char) __va_arg(args, int);
|
||||
while (--field_width > 0)
|
||||
*str++ = ' ';
|
||||
continue;
|
||||
|
||||
case 's':
|
||||
s = va_arg(args, char *);
|
||||
s = __va_arg(args, char *);
|
||||
if (!s)
|
||||
s = "<NULL>";
|
||||
|
||||
|
@ -238,17 +230,17 @@ extern int vsprintf(char *buf, const char *fmt, va_list args)
|
|||
flags |= ZEROPAD;
|
||||
}
|
||||
str = number(str,
|
||||
(unsigned long) va_arg(args, void *), 16,
|
||||
(unsigned long) __va_arg(args, void *), 16,
|
||||
field_width, precision, flags);
|
||||
continue;
|
||||
|
||||
|
||||
case 'n':
|
||||
if (qualifier == 'l') {
|
||||
long * ip = va_arg(args, long *);
|
||||
long * ip = __va_arg(args, long *);
|
||||
*ip = (str - buf);
|
||||
} else {
|
||||
int * ip = va_arg(args, int *);
|
||||
int * ip = __va_arg(args, int *);
|
||||
*ip = (str - buf);
|
||||
}
|
||||
continue;
|
||||
|
@ -280,16 +272,16 @@ extern int vsprintf(char *buf, const char *fmt, va_list args)
|
|||
continue;
|
||||
}
|
||||
if (qualifier == 'l')
|
||||
num = va_arg(args, unsigned long);
|
||||
num = __va_arg(args, unsigned long);
|
||||
else if (qualifier == 'h')
|
||||
if (flags & SIGN)
|
||||
num = va_arg(args, short);
|
||||
num = __va_arg(args, short);
|
||||
else
|
||||
num = va_arg(args, unsigned short);
|
||||
num = __va_arg(args, unsigned short);
|
||||
else if (flags & SIGN)
|
||||
num = va_arg(args, int);
|
||||
num = __va_arg(args, int);
|
||||
else
|
||||
num = va_arg(args, unsigned int);
|
||||
num = __va_arg(args, unsigned int);
|
||||
str = number(str, num, base, field_width, precision, flags);
|
||||
}
|
||||
*str = '\0';
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
#ifndef __SYSTEM_VSPRINTF_H__
|
||||
#define __SYSTEM_VSPRINTF_H__
|
||||
|
||||
extern int vsprintf(char *buf, const char *fmt, va_list args)
|
||||
|
||||
// stdarg defs from MSVC
|
||||
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
|
||||
#define __va_start(ap,v) ( ap = (__va_list)&v + _INTSIZEOF(v) )
|
||||
#define __va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
|
||||
#define __va_end(ap) ( ap = (__va_list)0 )
|
||||
typedef char *__va_list;
|
||||
|
||||
|
||||
extern int __vsprintf(char *buf, const char *fmt, __va_list args);
|
||||
|
||||
#endif /* __SYSTEM_VSPRINTF_H__ */
|
Loading…
Add table
Add a link
Reference in a new issue