mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
Merge branch 'mingw-dev'
Fix exception specification compile error in C++17 (with -std=c++17 by GCC 6.1)
This commit is contained in:
commit
7d9729b530
|
@ -11,7 +11,7 @@ std::string ErrorViewer::getError() const
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * ErrorViewer::what() const throw()
|
const char * ErrorViewer::what() const noexcept
|
||||||
{
|
{
|
||||||
return str.c_str();
|
return str.c_str();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ class ErrorViewer : public std::exception
|
||||||
public:
|
public:
|
||||||
void fetch();
|
void fetch();
|
||||||
std::string getError() const;
|
std::string getError() const;
|
||||||
const char* what() const throw() override;
|
const char* what() const noexcept override;
|
||||||
private:
|
private:
|
||||||
std::string str;
|
std::string str;
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,7 +17,7 @@ TTF_Font* Font::_get() const
|
||||||
return _font.get();
|
return _font.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Font::Font(const std::string& FontFileName, size_t size) throw(ErrorViewer)
|
Font::Font(const std::string& FontFileName, size_t size)
|
||||||
{
|
{
|
||||||
if (use(FontFileName, size) != 0)
|
if (use(FontFileName, size) != 0)
|
||||||
{
|
{
|
||||||
|
@ -209,7 +209,7 @@ void Font::setFontHint(FontHint hint)
|
||||||
TTF_SetFontHinting(_get(),v);
|
TTF_SetFontHinting(_get(),v);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect Font::sizeText(const std::string& Text) const throw (ErrorViewer)
|
Rect Font::sizeText(const std::string& Text) const
|
||||||
{
|
{
|
||||||
int w=0,h=0;
|
int w=0,h=0;
|
||||||
if(TTF_SizeText(_get(),Text.c_str(),&w,&h)!=0)
|
if(TTF_SizeText(_get(),Text.c_str(),&w,&h)!=0)
|
||||||
|
@ -222,7 +222,7 @@ Rect Font::sizeText(const std::string& Text) const throw (ErrorViewer)
|
||||||
return Rect(0,0,w,h);
|
return Rect(0,0,w,h);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect Font::sizeUTF8(const std::string& Text) const throw (ErrorViewer)
|
Rect Font::sizeUTF8(const std::string& Text) const
|
||||||
{
|
{
|
||||||
int w=0,h=0;
|
int w=0,h=0;
|
||||||
if(TTF_SizeUTF8(_get(),Text.c_str(),&w,&h)!=0)
|
if(TTF_SizeUTF8(_get(),Text.c_str(),&w,&h)!=0)
|
||||||
|
@ -235,7 +235,7 @@ Rect Font::sizeUTF8(const std::string& Text) const throw (ErrorViewer)
|
||||||
return Rect(0,0,w,h);
|
return Rect(0,0,w,h);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect Font::sizeUnicode(const uint16_t* Text) const throw (ErrorViewer)
|
Rect Font::sizeUnicode(const uint16_t* Text) const
|
||||||
{
|
{
|
||||||
int w=0,h=0;
|
int w=0,h=0;
|
||||||
if(TTF_SizeUNICODE(_get(),Text,&w,&h)!=0)
|
if(TTF_SizeUNICODE(_get(),Text,&w,&h)!=0)
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Font
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Font() = default;
|
Font() = default;
|
||||||
Font(const std::string& FontFileName, size_t size) throw(ErrorViewer);
|
Font(const std::string& FontFileName, size_t size);
|
||||||
int use(const std::string& FontFileName, size_t size);
|
int use(const std::string& FontFileName, size_t size);
|
||||||
bool isReady() const;
|
bool isReady() const;
|
||||||
|
|
||||||
|
@ -61,9 +61,9 @@ public:
|
||||||
void setFontHint(FontHint hint);
|
void setFontHint(FontHint hint);
|
||||||
|
|
||||||
|
|
||||||
Rect sizeText(const std::string& Text) const throw (ErrorViewer);
|
Rect sizeText(const std::string& Text) const;
|
||||||
Rect sizeUTF8(const std::string& Text) const throw (ErrorViewer);
|
Rect sizeUTF8(const std::string& Text) const;
|
||||||
Rect sizeUnicode(const uint16_t* Text) const throw (ErrorViewer);
|
Rect sizeUnicode(const uint16_t* Text) const;
|
||||||
|
|
||||||
/// Surface Rendering Functions.
|
/// Surface Rendering Functions.
|
||||||
Surface renderText(const std::string& Text, const RGBA& fg) const;
|
Surface renderText(const std::string& Text, const RGBA& fg) const;
|
||||||
|
|
|
@ -54,7 +54,7 @@ Uint32 Renderer::_rendertype_caster(RendererType Type)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Renderer::Renderer(Window& wnd,std::initializer_list<RendererType> RendererFlags) throw (ErrorViewer)
|
Renderer::Renderer(Window& wnd,std::initializer_list<RendererType> RendererFlags)
|
||||||
{
|
{
|
||||||
if(createRenderer(wnd,RendererFlags)!=0)
|
if(createRenderer(wnd,RendererFlags)!=0)
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,7 @@ Renderer::Renderer(Window& wnd,std::initializer_list<RendererType> RendererFlags
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Renderer::Renderer(Surface& surf) throw (ErrorViewer)
|
Renderer::Renderer(Surface& surf)
|
||||||
{
|
{
|
||||||
if(createSoftRenderer(surf)!=0)
|
if(createSoftRenderer(surf)!=0)
|
||||||
{
|
{
|
||||||
|
@ -439,7 +439,7 @@ int Renderer::supercopy(const Texture& t,
|
||||||
return SDL_RenderCopyEx(_get(),t._get(),pR1,pR2,angle,pPoint,flip);
|
return SDL_RenderCopyEx(_get(),t._get(),pR1,pR2,angle,pPoint,flip);
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture Renderer::render(const Surface& surf) const throw(ErrorViewer)
|
Texture Renderer::render(const Surface& surf) const
|
||||||
{
|
{
|
||||||
Texture t;
|
Texture t;
|
||||||
SDL_Texture* temp = SDL_CreateTextureFromSurface(_get(), surf._get());
|
SDL_Texture* temp = SDL_CreateTextureFromSurface(_get(), surf._get());
|
||||||
|
@ -453,7 +453,7 @@ Texture Renderer::render(const Surface& surf) const throw(ErrorViewer)
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture Renderer::loadTexture(const std::string& FileName) const throw(ErrorViewer)
|
Texture Renderer::loadTexture(const std::string& FileName) const
|
||||||
{
|
{
|
||||||
Texture t;
|
Texture t;
|
||||||
SDL_Texture* temp = IMG_LoadTexture(_get(), FileName.c_str());
|
SDL_Texture* temp = IMG_LoadTexture(_get(), FileName.c_str());
|
||||||
|
@ -467,7 +467,7 @@ Texture Renderer::loadTexture(const std::string& FileName) const throw(ErrorView
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture Renderer::loadTextureRW(const RWOP& rwop) const throw (ErrorViewer)
|
Texture Renderer::loadTextureRW(const RWOP& rwop) const
|
||||||
{
|
{
|
||||||
Texture t;
|
Texture t;
|
||||||
SDL_Texture* temp=IMG_LoadTexture_RW(_get(),rwop._get(),0);
|
SDL_Texture* temp=IMG_LoadTexture_RW(_get(),rwop._get(),0);
|
||||||
|
@ -481,7 +481,7 @@ Texture Renderer::loadTextureRW(const RWOP& rwop) const throw (ErrorViewer)
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture Renderer::createTexture(int Width, int Height) const throw(ErrorViewer)
|
Texture Renderer::createTexture(int Width, int Height) const
|
||||||
{
|
{
|
||||||
SDL_Texture* temp = SDL_CreateTexture(_get(), SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, Width, Height);
|
SDL_Texture* temp = SDL_CreateTexture(_get(), SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, Width, Height);
|
||||||
if (temp == NULL)
|
if (temp == NULL)
|
||||||
|
|
|
@ -13,9 +13,9 @@ class Renderer
|
||||||
public:
|
public:
|
||||||
Renderer() = default;
|
Renderer() = default;
|
||||||
/// Create a Renderer associated with Window
|
/// Create a Renderer associated with Window
|
||||||
Renderer(Window& wnd,std::initializer_list<RendererType> RendererFlags = { RendererType::Accelerated,RendererType::TargetTexture }) throw (ErrorViewer);
|
Renderer(Window& wnd,std::initializer_list<RendererType> RendererFlags = { RendererType::Accelerated,RendererType::TargetTexture });
|
||||||
/// Create a software Renderer
|
/// Create a software Renderer
|
||||||
Renderer(Surface& surf) throw (ErrorViewer);
|
Renderer(Surface& surf);
|
||||||
~Renderer() = default;
|
~Renderer() = default;
|
||||||
|
|
||||||
/// If Renderer is current not ready, setRenderer will create Renderer.
|
/// If Renderer is current not ready, setRenderer will create Renderer.
|
||||||
|
@ -111,10 +111,10 @@ public:
|
||||||
double angle,
|
double angle,
|
||||||
bool haspoint,const Point& center,FlipMode mode);
|
bool haspoint,const Point& center,FlipMode mode);
|
||||||
|
|
||||||
Texture render(const Surface& surf) const throw (ErrorViewer);
|
Texture render(const Surface& surf) const;
|
||||||
Texture loadTexture(const std::string& FileName) const throw(ErrorViewer);
|
Texture loadTexture(const std::string& FileName) const;
|
||||||
Texture loadTextureRW(const RWOP& rwop) const throw(ErrorViewer);
|
Texture loadTextureRW(const RWOP& rwop) const;
|
||||||
Texture createTexture(int Width, int Height) const throw(ErrorViewer);
|
Texture createTexture(int Width, int Height) const;
|
||||||
|
|
||||||
bool isRenderTargetSupported() const;
|
bool isRenderTargetSupported() const;
|
||||||
bool isReady() const;
|
bool isReady() const;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "_caster.h"
|
#include "_caster.h"
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
// private
|
// private
|
||||||
void SDLSystem::_init(Uint32 sdl_flag, Uint32 img_flag, Uint32 mix_flag, bool init_ttf) throw (ErrorViewer)
|
void SDLSystem::_init(Uint32 sdl_flag, Uint32 img_flag, Uint32 mix_flag, bool init_ttf)
|
||||||
{
|
{
|
||||||
int ret=SDL_Init(sdl_flag);
|
int ret=SDL_Init(sdl_flag);
|
||||||
if(ret!=0)
|
if(ret!=0)
|
||||||
|
@ -44,7 +44,7 @@ void SDLSystem::_init(Uint32 sdl_flag, Uint32 img_flag, Uint32 mix_flag, bool in
|
||||||
SDLSystem::SDLSystem(const std::initializer_list<SDLInitFlag>& flag_sdl,
|
SDLSystem::SDLSystem(const std::initializer_list<SDLInitFlag>& flag_sdl,
|
||||||
const std::initializer_list<IMGInitFlag>& flag_img,
|
const std::initializer_list<IMGInitFlag>& flag_img,
|
||||||
const std::initializer_list<MixInitFlag>& flag_mix,
|
const std::initializer_list<MixInitFlag>& flag_mix,
|
||||||
bool init_ttf ) throw (ErrorViewer)
|
bool init_ttf )
|
||||||
{
|
{
|
||||||
Uint32 sdl_flag=0;
|
Uint32 sdl_flag=0;
|
||||||
for(auto& v:flag_sdl)
|
for(auto& v:flag_sdl)
|
||||||
|
@ -72,7 +72,7 @@ SDLSystem::SDLSystem(const std::initializer_list<SDLInitFlag>& flag_sdl,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDLSystem::SDLSystem(Uint32 sdl_flag, Uint32 img_flag, Uint32 mix_flag, bool init_ttf) throw (ErrorViewer)
|
SDLSystem::SDLSystem(Uint32 sdl_flag, Uint32 img_flag, Uint32 mix_flag, bool init_ttf)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,9 +18,9 @@ public:
|
||||||
SDLSystem(const std::initializer_list<SDLInitFlag>& flag_sdl = {SDLInitFlag::All} ,
|
SDLSystem(const std::initializer_list<SDLInitFlag>& flag_sdl = {SDLInitFlag::All} ,
|
||||||
const std::initializer_list<IMGInitFlag>& flag_img = {IMGInitFlag::JPG,IMGInitFlag::PNG} ,
|
const std::initializer_list<IMGInitFlag>& flag_img = {IMGInitFlag::JPG,IMGInitFlag::PNG} ,
|
||||||
const std::initializer_list<MixInitFlag>& flag_mix = {MixInitFlag::MP3} ,
|
const std::initializer_list<MixInitFlag>& flag_mix = {MixInitFlag::MP3} ,
|
||||||
bool init_ttf = true ) throw (ErrorViewer);
|
bool init_ttf = true );
|
||||||
/// Experimental Constructor
|
/// Experimental Constructor
|
||||||
SDLSystem(Uint32 sdl_flag, Uint32 img_flag, Uint32 mix_flag, bool init_ttf) throw (ErrorViewer);
|
SDLSystem(Uint32 sdl_flag, Uint32 img_flag, Uint32 mix_flag, bool init_ttf);
|
||||||
~SDLSystem();
|
~SDLSystem();
|
||||||
|
|
||||||
static void Delay(int ms);
|
static void Delay(int ms);
|
||||||
|
@ -70,7 +70,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _init(Uint32,Uint32,Uint32,bool) throw (ErrorViewer);
|
void _init(Uint32,Uint32,Uint32,bool);
|
||||||
void _quit();
|
void _quit();
|
||||||
};
|
};
|
||||||
#include "end_code.h"
|
#include "end_code.h"
|
||||||
|
|
|
@ -57,7 +57,7 @@ Channel::Channel()
|
||||||
_id=-1;
|
_id=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel& Channel::playSound(Sound sound, int loops) throw (ErrorViewer)
|
Channel& Channel::playSound(Sound sound, int loops)
|
||||||
{
|
{
|
||||||
int cret=Mix_PlayChannel(_get(),sound._get(),loops);
|
int cret=Mix_PlayChannel(_get(),sound._get(),loops);
|
||||||
if(cret==-1)
|
if(cret==-1)
|
||||||
|
@ -70,7 +70,7 @@ Channel& Channel::playSound(Sound sound, int loops) throw (ErrorViewer)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel& Channel::fadeIn(Sound sound, int loops, int ms) throw (ErrorViewer)
|
Channel& Channel::fadeIn(Sound sound, int loops, int ms)
|
||||||
{
|
{
|
||||||
int cret=Mix_FadeInChannel(_get(),sound._get(),loops,ms);
|
int cret=Mix_FadeInChannel(_get(),sound._get(),loops,ms);
|
||||||
if(cret==-1)
|
if(cret==-1)
|
||||||
|
@ -157,14 +157,14 @@ SoundPlayer::SoundPlayer(int Channels)
|
||||||
Mix_AllocateChannels(Channels);
|
Mix_AllocateChannels(Channels);
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel SoundPlayer::playSound(Sound sound, int loops) throw(ErrorViewer)
|
Channel SoundPlayer::playSound(Sound sound, int loops)
|
||||||
{
|
{
|
||||||
Channel c;
|
Channel c;
|
||||||
c.playSound(sound,loops);
|
c.playSound(sound,loops);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel SoundPlayer::fadeIn(Sound sound, int loops, int ms) throw(ErrorViewer)
|
Channel SoundPlayer::fadeIn(Sound sound, int loops, int ms)
|
||||||
{
|
{
|
||||||
Channel c;
|
Channel c;
|
||||||
c.fadeIn(sound,loops,ms);
|
c.fadeIn(sound,loops,ms);
|
||||||
|
|
|
@ -28,8 +28,8 @@ private:
|
||||||
class Channel
|
class Channel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Channel& playSound(Sound sound,int loops) throw (ErrorViewer);
|
Channel& playSound(Sound sound,int loops);
|
||||||
Channel& fadeIn(Sound sound,int loops,int ms) throw (ErrorViewer);
|
Channel& fadeIn(Sound sound,int loops,int ms);
|
||||||
|
|
||||||
int fadeOut(int ms);
|
int fadeOut(int ms);
|
||||||
void pause();
|
void pause();
|
||||||
|
@ -64,7 +64,7 @@ public:
|
||||||
static std::string GetDecoderName(int index);
|
static std::string GetDecoderName(int index);
|
||||||
|
|
||||||
SoundPlayer(int NumChannels = 16);
|
SoundPlayer(int NumChannels = 16);
|
||||||
Channel playSound(Sound sound, int loops) throw (ErrorViewer);
|
Channel playSound(Sound sound, int loops);
|
||||||
Channel fadeIn(Sound sound, int loops, int ms) throw (ErrorViewer);
|
Channel fadeIn(Sound sound, int loops, int ms);
|
||||||
};
|
};
|
||||||
#include "end_code.h"
|
#include "end_code.h"
|
||||||
|
|
|
@ -25,7 +25,7 @@ void Surface::_set_no_delete(SDL_Surface* p)
|
||||||
_surf.reset(p,[](SDL_Surface*) {});
|
_surf.reset(p,[](SDL_Surface*) {});
|
||||||
}
|
}
|
||||||
|
|
||||||
Surface::Surface(int width,int height,int depth,int Rmask,int Gmask,int Bmask,int Amask) throw(ErrorViewer)
|
Surface::Surface(int width,int height,int depth,int Rmask,int Gmask,int Bmask,int Amask)
|
||||||
{
|
{
|
||||||
if(createAs(width,height,depth,Rmask,Gmask,Bmask,Amask)!=0)
|
if(createAs(width,height,depth,Rmask,Gmask,Bmask,Amask)!=0)
|
||||||
{
|
{
|
||||||
|
@ -35,13 +35,13 @@ Surface::Surface(int width,int height,int depth,int Rmask,int Gmask,int Bmask,in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Surface::Surface(int width,int height,int depth,RGBA maskPack) throw (ErrorViewer)
|
Surface::Surface(int width,int height,int depth,RGBA maskPack)
|
||||||
: Surface(width,height,depth,maskPack.r,maskPack.g,maskPack.b,maskPack.a)
|
: Surface(width,height,depth,maskPack.r,maskPack.g,maskPack.b,maskPack.a)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Surface::Surface(int width,int height,int depth,Uint32 surfaceFormat) throw(ErrorViewer)
|
Surface::Surface(int width,int height,int depth,Uint32 surfaceFormat)
|
||||||
{
|
{
|
||||||
if(createAs(width,height,depth,surfaceFormat)!=0)
|
if(createAs(width,height,depth,surfaceFormat)!=0)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,7 @@ Surface::Surface(int width,int height,int depth,Uint32 surfaceFormat) throw(Erro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Surface::Surface(const std::string& filename) throw(ErrorViewer)
|
Surface::Surface(const std::string& filename)
|
||||||
{
|
{
|
||||||
if(loadAs(filename)!=0)
|
if(loadAs(filename)!=0)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ Surface::Surface(const std::string& filename) throw(ErrorViewer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Surface::Surface(const RWOP& rwop) throw (ErrorViewer)
|
Surface::Surface(const RWOP& rwop)
|
||||||
{
|
{
|
||||||
if(loadAs(rwop)!=0)
|
if(loadAs(rwop)!=0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,11 +11,11 @@ class Surface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Surface()=default;
|
Surface()=default;
|
||||||
Surface(int width,int height,int depth,int Rmask,int Gmask,int Bmask,int Amask) throw(ErrorViewer);
|
Surface(int width,int height,int depth,int Rmask,int Gmask,int Bmask,int Amask);
|
||||||
Surface(int width,int height,int depth,RGBA colorPack) throw(ErrorViewer);
|
Surface(int width,int height,int depth,RGBA colorPack);
|
||||||
Surface(int width,int height,int depth,Uint32 surfaceFormat) throw(ErrorViewer);
|
Surface(int width,int height,int depth,Uint32 surfaceFormat);
|
||||||
Surface(const std::string& filename) throw(ErrorViewer);
|
Surface(const std::string& filename);
|
||||||
Surface(const RWOP& rwop) throw(ErrorViewer);
|
Surface(const RWOP& rwop);
|
||||||
~Surface() = default;
|
~Surface() = default;
|
||||||
|
|
||||||
/// static functions
|
/// static functions
|
||||||
|
|
|
@ -20,7 +20,7 @@ SDL_Window* Window::_get() const
|
||||||
}
|
}
|
||||||
|
|
||||||
Window::Window(std::string Title, int Width, int Height,
|
Window::Window(std::string Title, int Width, int Height,
|
||||||
std::initializer_list<WindowType> WindowFlags, int WindowPositionX, int WindowPositionY) throw(ErrorViewer)
|
std::initializer_list<WindowType> WindowFlags, int WindowPositionX, int WindowPositionY)
|
||||||
{
|
{
|
||||||
/// Calculate Window Flags
|
/// Calculate Window Flags
|
||||||
Uint32 windowFlag=0;
|
Uint32 windowFlag=0;
|
||||||
|
|
|
@ -13,7 +13,7 @@ public:
|
||||||
Window()=default;
|
Window()=default;
|
||||||
Window(std::string Title, int Width, int Height,
|
Window(std::string Title, int Width, int Height,
|
||||||
std::initializer_list<WindowType> WindowFlags = {WindowType::Shown},
|
std::initializer_list<WindowType> WindowFlags = {WindowType::Shown},
|
||||||
int WindowPositionX=SDL_WINDOWPOS_CENTERED, int WindowPositionY=SDL_WINDOWPOS_CENTERED) throw(ErrorViewer);
|
int WindowPositionX=SDL_WINDOWPOS_CENTERED, int WindowPositionY=SDL_WINDOWPOS_CENTERED);
|
||||||
|
|
||||||
Rect getSize() const;
|
Rect getSize() const;
|
||||||
void setSize(const Rect& sizeRect);
|
void setSize(const Rect& sizeRect);
|
||||||
|
|
48
tests/test1.cpp
Normal file
48
tests/test1.cpp
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
#include "MiniEngine.h"
|
||||||
|
#include "MiniEngine_Event.h"
|
||||||
|
using namespace MiniEngine;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
/// Initialize SDL2, SDL2_image, SDL2_mixer, SDL2_ttf with default flags.
|
||||||
|
SDLSystem sys;
|
||||||
|
/// Create window
|
||||||
|
Window wnd("Window Title",1024,768);
|
||||||
|
/// Create renderer
|
||||||
|
Renderer rnd(wnd);
|
||||||
|
/// Load texture
|
||||||
|
Texture t=rnd.loadTexture("test.png");
|
||||||
|
/// Create a event loop
|
||||||
|
Looper lp;
|
||||||
|
/// Add event handling functions.
|
||||||
|
lp.add(SDL_QUIT,[](Looper& lp){lp.stop();});
|
||||||
|
/// Set Updater
|
||||||
|
lp.updater=[&]()
|
||||||
|
{
|
||||||
|
/// Clear screen
|
||||||
|
rnd.clear();
|
||||||
|
/// Copy the texture to full-fill the screen.
|
||||||
|
rnd.copyFullFill(t);
|
||||||
|
/// Update screen
|
||||||
|
rnd.update();
|
||||||
|
};
|
||||||
|
/// Start Looper
|
||||||
|
lp.run();
|
||||||
|
|
||||||
|
/// Texture will be freed.
|
||||||
|
/// Renderer will be destroyed.
|
||||||
|
/// Window will be destroyed.
|
||||||
|
|
||||||
|
/// All SDL system will be shut down.
|
||||||
|
}
|
||||||
|
catch (const ErrorViewer& e)
|
||||||
|
{
|
||||||
|
printf("Exception: %s\n",e.what());
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user