-
Notifications
You must be signed in to change notification settings - Fork 27
/
enginesdl.h
65 lines (55 loc) · 2.28 KB
/
enginesdl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//////////////////////////////////////////////////////////////////////
// Yet Another Tibia Client
//////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//////////////////////////////////////////////////////////////////////
#ifndef __ENGINESDL_H
#define __ENGINESDL_H
#include "engine.h"
#include "spritesdl.h"
class EngineSDL : public Engine
{
public:
EngineSDL();
~EngineSDL();
bool isSupported() { return true; } ///< Since SDL is always supported, this function always returns true.
void doResize(int& h, int& w);
void drawLightmap(vertex* lightmap, int type, int width, int height, float scale);
void drawRectangle(float x, float y, float width, float height, oRGBA color);
void drawRectangleLines(float x, float y, float width, float height, oRGBA color, float thickness = 1.f);
virtual Sprite* createSprite(const std::string& filename, int index = 0)
{
return new SpriteSDL(filename, index);
}
virtual Sprite* createSprite(int w, int h, const oRGBA& c){
return new SpriteSDL(w, h, c);
}
virtual void Flip(){
SDL_Flip(m_screen);
}
void setClipping(int left, int top, int width, int height) {
SDL_Rect r = {Sint16(left), Sint16(top), Uint16(width), Uint16(height)};
SDL_SetClipRect(m_screen, &r);
}
void resetClipping() {
SDL_SetClipRect(m_screen, NULL);
}
const char* getName() const {return "SDL 1.2";}
protected:
static void clipper_func(float left, float right, float top, float bottom);
};
#endif