Verified Commit fe07d48f authored by RobLoach's avatar RobLoach
Browse files

Update namespace usage

parent 6b31ff38
......@@ -2,12 +2,13 @@
# ChaiLove
SOURCES_CXX += $(wildcard \
src/*.cpp \
src/chailove/*.cpp \
src/Modules/*.cpp \
src/Types/*.cpp \
src/Types/Audio/*.cpp \
src/Types/Graphics/*.cpp \
src/Types/Input/*.cpp \
src/Types/System/*.cpp \
test/*.cpp \
src/chailove/graphics/*.cpp \
src/chailove/input/*.cpp \
src/chailove/audio/*.cpp \
src/chailove/system/*.cpp \
)
# filesystem
......
......@@ -43,7 +43,7 @@ bool ChaiLove::load(const std::string& file) {
filesystem.init(file);
// Initialize the scripting system.
script = new chailove::script(file);
script = new Modules::script(file);
script->conf(config);
// Testing.
......
......@@ -11,19 +11,19 @@
*
* ## Modules
*
* - \link chailove::audio audio \endlink
* - \link chailove::event event \endlink
* - \link chailove::filesystem filesystem \endlink
* - \link chailove::font font \endlink
* - \link chailove::graphics graphics \endlink
* - \link chailove::image image \endlink
* - \link chailove::joystick joystick \endlink
* - \link chailove::keyboard keyboard \endlink
* - \link chailove::script script \endlink
* - \link chailove::math math \endlink
* - \link chailove::mouse mouse \endlink
* - \link chailove::timer timer \endlink
* - \link chailove::window window \endlink
* - \link Modules::audio audio \endlink
* - \link Modules::event event \endlink
* - \link Modules::filesystem filesystem \endlink
* - \link Modules::font font \endlink
* - \link Modules::graphics graphics \endlink
* - \link Modules::image image \endlink
* - \link Modules::joystick joystick \endlink
* - \link Modules::keyboard keyboard \endlink
* - \link Modules::script script \endlink
* - \link Modules::math math \endlink
* - \link Modules::mouse mouse \endlink
* - \link Modules::timer timer \endlink
* - \link Modules::window window \endlink
*
* ## Example
*
......@@ -42,27 +42,29 @@
#include "SDL.h"
#include "libretro.h"
#include "chailove/keyboard.h"
#include "chailove/system/Config.h"
#include "chailove/script.h"
#include "chailove/filesystem.h"
#include "chailove/graphics.h"
#include "chailove/image.h"
#include "chailove/system.h"
#include "chailove/sound.h"
#include "chailove/font.h"
#include "chailove/timer.h"
#include "chailove/audio.h"
#include "chailove/joystick.h"
#include "chailove/mouse.h"
#include "chailove/window.h"
#include "chailove/math.h"
#include "chailove/event.h"
#include "Modules/keyboard.h"
#include "Types/System/Config.h"
#include "Modules/script.h"
#include "Modules/filesystem.h"
#include "Modules/graphics.h"
#include "Modules/image.h"
#include "Modules/system.h"
#include "Modules/sound.h"
#include "Modules/font.h"
#include "Modules/timer.h"
#include "Modules/audio.h"
#include "Modules/joystick.h"
#include "Modules/mouse.h"
#include "Modules/window.h"
#include "Modules/math.h"
#include "Modules/event.h"
#ifdef __HAVE_TESTS__
#include "test/Test.h"
#endif
using Types::System::Config;
class ChaiLove {
public:
static ChaiLove* getInstance();
......@@ -72,22 +74,22 @@ public:
static retro_input_state_t input_state_cb;
static retro_input_poll_t input_poll_cb;
chailove::Config config;
chailove::keyboard keyboard;
chailove::script* script;
chailove::filesystem filesystem;
chailove::graphics graphics;
chailove::image image;
chailove::system system;
chailove::sound sound;
chailove::font font;
chailove::timer timer;
chailove::audio audio;
chailove::joystick joystick;
chailove::mouse mouse;
chailove::math math;
chailove::window window;
chailove::event event;
Config config;
Modules::keyboard keyboard;
Modules::script* script;
Modules::filesystem filesystem;
Modules::graphics graphics;
Modules::image image;
Modules::system system;
Modules::sound sound;
Modules::font font;
Modules::timer timer;
Modules::audio audio;
Modules::joystick joystick;
Modules::mouse mouse;
Modules::math math;
Modules::window window;
Modules::event event;
void quit(void);
bool load(const std::string& file);
......
#include "audio.h"
#include <string>
#include "audio/SoundData.h"
#include "audio/AudioState.h"
#include "../Types/Audio/SoundData.h"
#include "../Types/Audio/AudioState.h"
#include "../ChaiLove.h"
#include "sound.h"
#include <physfs.h>
namespace chailove {
using Types::Audio::SoundData;
using Types::Audio::AudioState::Stopped;
namespace Modules {
void audio::play(SoundData* soundData) {
if (soundData) {
soundData->play();
......
#ifndef CHAILOVE_AUDIO_H
#define CHAILOVE_AUDIO_H
#include "audio/SoundData.h"
#include "../Types/Audio/SoundData.h"
#include "sound.h"
namespace chailove {
using Types::Audio::SoundData;
namespace Modules {
class audio {
public:
void play(SoundData* soundData);
......
#include "event.h"
namespace chailove {
namespace Modules {
void event::quit() {
quitstatus = true;
}
......
#ifndef CHAILOVE_EVENT_H
#define CHAILOVE_EVENT_H
namespace chailove {
namespace Modules {
/**
* @brief Manages events, like keypresses.
*/
......
......@@ -10,7 +10,7 @@
using namespace filesystem;
namespace chailove {
namespace Modules {
/**
* Initialize the file system.
......
......@@ -6,7 +6,7 @@
#include "SDL.h"
#include "physfs.h"
namespace chailove {
namespace Modules {
/**
* @brief Provides an interface to the user's filesystem.
*/
......
......@@ -2,9 +2,9 @@
#include "SDL.h"
//#include "SDL_ttf.h"
#include "font.h"
#include "graphics/Font.h"
#include "../Types/Graphics/Font.h"
namespace chailove {
namespace Modules {
bool font::load() {
/*int result = TTF_Init();
if(result == -1) {
......
#ifndef CHAILOVE_FONT_H
#define CHAILOVE_FONT_H
#include "graphics/Font.h"
#include "../Types/Graphics/Font.h"
namespace chailove {
namespace Modules {
/**
* @brief Allows you to work with fonts.
*/
......
......@@ -5,10 +5,15 @@
#include <SDL_gfxBlitFunc.h>
#include "../ChaiLove.h"
#include "graphics/Image.h"
#include "graphics/Font.h"
#include "../Types/Graphics/Image.h"
#include "../Types/Graphics/Font.h"
namespace chailove {
using Types::Graphics::Image;
using Types::Graphics::Quad;
using Types::Graphics::Font;
using Types::Graphics::Point;
namespace Modules {
graphics::graphics() {
setFont();
......
......@@ -5,12 +5,17 @@
#include "SDL.h"
#include "SDL_gfxPrimitives.h"
#include "graphics/Image.h"
#include "graphics/Quad.h"
#include "graphics/Font.h"
#include "graphics/Point.h"
#include "../Types/Graphics/Image.h"
#include "../Types/Graphics/Quad.h"
#include "../Types/Graphics/Font.h"
#include "../Types/Graphics/Point.h"
namespace chailove {
using Types::Graphics::Image;
using Types::Graphics::Quad;
using Types::Graphics::Font;
using Types::Graphics::Point;
namespace Modules {
/**
* @brief The primary purpose of the graphics module is to draw to the screen.
......
#include "image.h"
#include <string>
#include "graphics/Image.h"
#include "../Types/Graphics/Image.h"
namespace chailove {
chailove::Image* image::newImageData(const std::string& filename) {
Image* image = new chailove::Image(filename);
using Types::Graphics::Image;
namespace Modules {
Image* image::newImageData(const std::string& filename) {
Image* image = new Image(filename);
if (image->loaded()) {
return image;
}
......
#ifndef CHAILOVE_IMAGE_H
#define CHAILOVE_IMAGE_H
#include "graphics/Image.h"
#include "../Types/Graphics/Image.h"
#include <string>
namespace chailove {
using Types::Graphics::Image;
namespace Modules {
/**
* @brief Provides an interface to decode encoded image data.
*/
......@@ -15,7 +17,7 @@ namespace chailove {
/**
* @brief Creates a new ImageData object.
*/
chailove::Image* newImageData(const std::string& filename);
Image* newImageData(const std::string& filename);
};
}
......
......@@ -3,12 +3,15 @@
#include <string>
#include <vector>
#include <libretro.h>
#include "input/Joystick.h"
#include "../Types/Input/Joystick.h"
#include "../ChaiLove.h"
#include <iostream>
namespace chailove {
using Types::Input::Joystick;
using ::ChaiLove;
namespace Modules {
Joystick* joystick::getJoysticks() {
return joysticks;
}
......
#ifndef CHAILOVE_JOYSTICK_H
#define CHAILOVE_JOYSTICK_H
#include "input/Joystick.h"
#include "../Types/Input/Joystick.h"
#include "SDL.h"
#include <string>
namespace chailove {
using Types::Input::Joystick;
namespace Modules {
/**
* @brief Provides an interface to connected joysticks.
*/
......
......@@ -4,7 +4,7 @@
#include <iostream>
//#include "SDL.h"
namespace chailove {
namespace Modules {
bool keyboard::isDown(int key) {
return (bool)keys[key];
......
......@@ -5,7 +5,7 @@
#include <map>
#include "SDL.h"
namespace chailove {
namespace Modules {
/**
* @brief Provides an interface to the user's keyboard.
*/
......
......@@ -2,7 +2,7 @@
#include <cstdlib>
#include <ctime>
namespace chailove {
namespace Modules {
bool math::load() {
setRandomSeed((int)time(0));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment