exceptions.hpp
This commit is contained in:
parent
22c64c9e9b
commit
7471c09452
@ -2,7 +2,7 @@
|
||||
#include <backends/imgui_impl_opengl3.h>
|
||||
#include <iostream>
|
||||
#include "MainWindow.hpp"
|
||||
#include "exceptions.hpp"
|
||||
#include "../exceptions.hpp"
|
||||
#include "../format.hpp"
|
||||
#include "../Resources/fonts.hpp"
|
||||
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
#include "exceptions.hpp"
|
||||
#include <SDL.h>
|
||||
|
||||
namespace ougge::GUI {
|
||||
|
||||
SDLException_::SDLException_(const std::string& _file,const std::string& _func, int _line_n)
|
||||
: UsefulException_(SDL_GetError(), _file, _func, _line_n)
|
||||
{
|
||||
SDL_ClearError();
|
||||
}
|
||||
|
||||
}
|
||||
19
src/exceptions.cpp
Normal file
19
src/exceptions.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include "exceptions.hpp"
|
||||
#include <SDL.h>
|
||||
#include <SDL_image.h>
|
||||
|
||||
namespace ougge {
|
||||
|
||||
SDLException_::SDLException_(const std::string& _file,const std::string& _func, int _line_n)
|
||||
: UsefulException_(std::string("SDLException: ") + SDL_GetError(), _file, _func, _line_n)
|
||||
{
|
||||
SDL_ClearError();
|
||||
}
|
||||
|
||||
IMGException_::IMGException_(const std::string& _file,const std::string& _func, int _line_n)
|
||||
: UsefulException_(std::string("IMGException: ") + IMG_GetError(), _file, _func, _line_n)
|
||||
{
|
||||
SDL_ClearError();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "../UsefulException.hpp"
|
||||
#include "UsefulException.hpp"
|
||||
|
||||
namespace ougge::GUI {
|
||||
namespace ougge {
|
||||
|
||||
#define SDLException() SDLException_(__FILE__, __func__, __LINE__)
|
||||
|
||||
@ -11,6 +11,15 @@ public:
|
||||
SDLException_(const std::string& _file, const std::string& _func, int line_n);
|
||||
};
|
||||
|
||||
|
||||
#define IMGException() IMGException_(__FILE__, __func__, __LINE__)
|
||||
|
||||
class IMGException_ : public UsefulException_ {
|
||||
public:
|
||||
IMGException_(const std::string& _file, const std::string& _func, int line_n);
|
||||
};
|
||||
|
||||
|
||||
#define SDL_TRY(EXPR) if(EXPR) throw SDLException();
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user