Remove the screenManager global, other assorted cleanup

This commit is contained in:
Henrik Rydgard 2012-09-18 09:46:58 +02:00
parent 113f10abfe
commit 01f2b5ada0
8 changed files with 35 additions and 13 deletions

View File

@ -69,6 +69,17 @@ void NativeMix(short *audio, int num_samples);
void NativeShutdownGraphics();
void NativeShutdown();
// Called on app.onCreate and app.onDestroy (?). Tells the app to save/restore
// light state. If app was fully rebooted between these calls, it's okay if some minor
// state is lost (position in level) but the level currently playihg, or the song
// currently being edited, or whatever, should be restored properly. In this case,
// firstTime will be set so that appropriate action can be taken (or not taken when
// it's not set).
//
// Note that NativeRestore is always called on bootup.
void NativeRestoreState(bool firstTime); // onCreate
void NativeSaveState(); // onDestroy
// Calls back into Java / SDL
// These APIs must be implemented by every port (for example app-android.cpp, PCMain.cpp).
// You are free to call these.

View File

@ -2,6 +2,7 @@ set(SRCS
lin/matrix4x4.cpp
lin/vec3.cpp
lin/quat.cpp
lin/aabb.cpp
)
set(SRCS ${SRCS})

View File

@ -2,8 +2,6 @@
#include "input/input_state.h"
#include "ui/screen.h"
ScreenManager screenManager;
Screen::Screen() { }
Screen::~Screen() { }
@ -81,4 +79,4 @@ void ScreenManager::pop() {
} else {
ELOG("Can't push when no dialog is shown");
}
}
}

View File

@ -62,6 +62,3 @@ private:
// Used for options, in-game menus and other things you expect to be able to back out from onto something.
std::list<Screen *> dialog_;
};
// Yeah, an old school non enforced singleton. Good enough (not?)
extern ScreenManager screenManager;

15
util/CMakeLists.txt Normal file
View File

@ -0,0 +1,15 @@
set(SRCS
bits/bits.cpp
bits/varint.cpp
random/perlin.cpp
hash/hash.cpp
)
set(SRCS ${SRCS})
add_library(util STATIC ${SRCS})
if(UNIX)
add_definitions(-fPIC)
endif(UNIX)

View File

@ -2,7 +2,7 @@
namespace varint {
void Encode32(uint32 value, char **dest) {
void Encode32(uint32_t value, char **dest) {
// Simple varint
char *p = *dest;
while (value > 127) {
@ -13,8 +13,8 @@ void Encode32(uint32 value, char **dest) {
*dest = p;
}
uint32 Decode32(const char **ptr) {
uint32 value = 0;
uint32_t Decode32(const char **ptr) {
uint32_t value = 0;
const char *p = *ptr;
while (true) {
uint8 b = *p++;

View File

@ -1,12 +1,12 @@
#ifndef _UTIL_BITS_VARINT
#define _UTIL_BITS_VARINT
#include "base/base.h"
#include "base/basictypes.h"
namespace varint {
void Encode32(uint32 value, char **dest);
uint32 Decode32(const char **ptr);
void Encode32(uint32_t value, char **dest);
uint32_t Decode32(const char **ptr);
} // namespace varint

View File

@ -1,4 +1,4 @@
#include "base/base.h"
#include "base/basictypes.h"
#include "util/hash/hash.h"
namespace hash {