added namespaces

This commit is contained in:
Bob Polis 2020-10-23 13:55:57 +02:00
parent 3de586a516
commit c6e6333f9a
6 changed files with 49 additions and 31 deletions

View File

@ -10,6 +10,8 @@
#include <stdexcept>
#include "SDLImageWrapper.hpp"
using namespace sc::gui;
SDLImageWrapper::SDLImageWrapper() {
int flags = IMG_INIT_JPG | IMG_INIT_PNG | IMG_INIT_TIF;
int result = IMG_Init(flags);

View File

@ -9,6 +9,8 @@
#ifndef __SDLIMAGEWRAPPER_H_
#define __SDLIMAGEWRAPPER_H_
namespace sc {
namespace gui {
struct SDLImageWrapper {
SDLImageWrapper();
~SDLImageWrapper();
@ -19,5 +21,7 @@ struct SDLImageWrapper {
SDLImageWrapper(SDLImageWrapper&&) = delete;
SDLImageWrapper& operator=(SDLImageWrapper&&) = delete;
};
}
}
#endif // __SDLIMAGEWRAPPER_H_

View File

@ -9,6 +9,8 @@
#include <SDL2/SDL.h>
#include "SDLWrapper.hpp"
using namespace sc::gui;
SDLWrapper::SDLWrapper() {
SDL_Init(SDL_INIT_VIDEO);
}

View File

@ -9,6 +9,8 @@
#ifndef __SDLWRAPPER_H_
#define __SDLWRAPPER_H_
namespace sc {
namespace gui {
struct SDLWrapper {
SDLWrapper();
~SDLWrapper();
@ -19,5 +21,7 @@ struct SDLWrapper {
SDLWrapper(SDLWrapper&&) = delete;
SDLWrapper& operator=(SDLWrapper&&) = delete;
};
}
}
#endif // __SDLWRAPPER_H_

View File

@ -10,6 +10,8 @@
#include <cmath>
#include "Window.hpp"
using namespace sc::gui;
Window::Window(const char* title) : _path {title} {
SDL_Window* win = SDL_CreateWindow(title,
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,

View File

@ -14,6 +14,8 @@
#include <memory>
#include <stdexcept>
namespace sc {
namespace gui {
class Window {
public:
Window(const char* title);
@ -30,5 +32,7 @@ class Window {
std::unique_ptr<SDL_Renderer, void(*)(SDL_Renderer*)> _r {nullptr, SDL_DestroyRenderer};
std::unique_ptr<SDL_Texture, void(*)(SDL_Texture*)> _t {nullptr, SDL_DestroyTexture};
};
}
}
#endif // __WINDOW_H_