From b552aa3b48a0b2a3e77523dfa0454265748bcf94 Mon Sep 17 00:00:00 2001 From: Patrik Gornicz Date: Fri, 29 Aug 2008 00:18:27 -0400 Subject: [PATCH] created key system, not yet used as there's a static bug --- src/Makefile | 1 + src/config/config.cpp | 8 ++++++++ src/config/keys.cpp | 39 +++++++++++++++++++++++++++++++++++++++ src/config/keys.h | 36 ++++++++++++++++++++++++++++++++++++ src/config/reader.cpp | 4 ++-- 5 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 src/config/keys.cpp create mode 100644 src/config/keys.h diff --git a/src/Makefile b/src/Makefile index 13c255e..a391724 100644 --- a/src/Makefile +++ b/src/Makefile @@ -47,6 +47,7 @@ SRCS += Effects/Screen.cpp SRCS += config/config.cpp SRCS += config/reader.cpp +SRCS += config/keys.cpp SRCS += input/inputManager.cpp diff --git a/src/config/config.cpp b/src/config/config.cpp index 9aa6f86..7d71e8a 100644 --- a/src/config/config.cpp +++ b/src/config/config.cpp @@ -17,6 +17,9 @@ #include "config.h" +#include +#include "keys.h" + #include "reader.h" #include "../input/inputManager.h" @@ -28,11 +31,16 @@ void cfg::init() { readConfigs(NULL); + // TODO read in config files + + key::init(); } void cfg::clean() { // TODO save to config files? + + key::clean(); } /// ***** Public Methods ***** diff --git a/src/config/keys.cpp b/src/config/keys.cpp new file mode 100644 index 0000000..6cd3cfd --- /dev/null +++ b/src/config/keys.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2008 Patrik Gornicz, Gornicz_P (at) hotmail (dot) com. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "keys.h" +#include "../debug.h" + +#include + +/// ***** Private Method Headers ***** +/// ***** Private Variables ***** + +/// ***** Initializers/Cleaners ***** +void key::init() +{ + pause = SDLK_PAUSE; + end = SDLK_ESCAPE; + + follow = SDLK_f; + + well = SDLK_SPACE; +} + +void key::clean() +{ +} diff --git a/src/config/keys.h b/src/config/keys.h new file mode 100644 index 0000000..9244a6f --- /dev/null +++ b/src/config/keys.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2008 Patrik Gornicz, Gornicz_P (at) hotmail (dot) com. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#ifndef KEYS_H +#define KEYS_H + +#include + +/// ***** Header Methods ***** +namespace key +{ + void init(); + void clean(); + + static SDLKey pause; + static SDLKey end; + static SDLKey follow; + static SDLKey well; +} + +#endif // KEYS_H diff --git a/src/config/reader.cpp b/src/config/reader.cpp index beb6e20..af2c43e 100644 --- a/src/config/reader.cpp +++ b/src/config/reader.cpp @@ -35,8 +35,8 @@ bool extractLine(const string& str, string* name, string* value); /// ***** Private Variables ***** -char* configDir = "configs/"; -char* testFile = "test.cfg"; +const char* configDir = "configs/"; +const char* testFile = "test.cfg"; /// ***** Public Methods ***** -- 2.10.2