From a299307adde228d89752dd617a987797bdbf1bdd Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Sat, 25 Feb 2017 20:09:30 +0800 Subject: [PATCH] Create Test.cpp --- Test.cpp | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Test.cpp diff --git a/Test.cpp b/Test.cpp new file mode 100644 index 0000000..7b9d996 --- /dev/null +++ b/Test.cpp @@ -0,0 +1,75 @@ +#include "MiniEngine.h" +using namespace MiniEngine; + +#include +using namespace std; + +int AppMain() +{ + Window wnd("Sample Program",1280,720); + Renderer rnd=wnd.getRenderer(); + rnd.setBlendMode(BlendMode::Blend); + Font font("D:\\msyh.ttf",18); + + MusicPlayer mp; + Music mlogin=mp.loadMusic("res/1.mp3"); + Texture tlogin=rnd.loadTexture("res/page.jpg"); + tlogin.setBlendMode(BlendMode::Blend); + Texture tlogin2=rnd.loadTexture("res/page2.jpg"); + tlogin2.setBlendMode(BlendMode::Blend); + + mp.play(mlogin,0); + + int fade=0; + int fadex=0; + int aa=255; + int ba=0; + + EventHandle::RegistDispatcher(SDL_QUIT,[](SDL_Event e,int& r,int& u){r=0;u=1;}); + EventHandle::RegistDispatcher(SDL_KEYDOWN,[&](SDL_Event e,int& r,int& u){ + if(e.key.keysym.sym==SDLK_RETURN) + { + fade=1; + u=1; + } + else if(e.key.keysym.sym==SDLK_KP_ENTER) + { + fadex=1; + u=1; + } + }); + EventHandle::RegistUpdater([&](Renderer& rnd){ + if(fade) + { + cout<<"Fading..."<