~ubuntu-branches/ubuntu/trusty/manaplus/trusty-proposed

« back to all changes in this revision

Viewing changes to src/sdl2graphics.h

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2013-09-17 10:35:51 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20130917103551-az7p3nz9jgxwqjfn
Tags: 1.3.9.15-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  The ManaPlus Client
3
 
 *  Copyright (C) 2004-2009  The Mana World Development Team
4
 
 *  Copyright (C) 2009-2010  The Mana Developers
5
 
 *  Copyright (C) 2011-2013  The ManaPlus Developers
6
 
 *
7
 
 *  This file is part of The ManaPlus Client.
8
 
 *
9
 
 *  This program is free software; you can redistribute it and/or modify
10
 
 *  it under the terms of the GNU General Public License as published by
11
 
 *  the Free Software Foundation; either version 2 of the License, or
12
 
 *  any later version.
13
 
 *
14
 
 *  This program is distributed in the hope that it will be useful,
15
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 
 *  GNU General Public License for more details.
18
 
 *
19
 
 *  You should have received a copy of the GNU General Public License
20
 
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 
 */
22
 
 
23
 
#ifndef SDL2GRAPHICS_H
24
 
#define SDL2GRAPHICS_H
25
 
 
26
 
#ifdef USE_SDL2
27
 
 
28
 
#include "graphics.h"
29
 
 
30
 
#include "localconsts.h"
31
 
 
32
 
class Image;
33
 
class ImageCollection;
34
 
class ImageVertexes;
35
 
class MapLayer;
36
 
 
37
 
struct SDL_Surface;
38
 
 
39
 
/**
40
 
 * A central point of control for graphics.
41
 
 */
42
 
class SDLGraphics : public Graphics
43
 
{
44
 
    public:
45
 
        /**
46
 
         * Constructor.
47
 
         */
48
 
        SDLGraphics();
49
 
 
50
 
        A_DELETE_COPY(SDLGraphics)
51
 
 
52
 
        /**
53
 
         * Destructor.
54
 
         */
55
 
        virtual ~SDLGraphics();
56
 
 
57
 
        void _beginDraw();
58
 
 
59
 
        void _endDraw();
60
 
 
61
 
        bool pushClipArea(gcn::Rectangle rect);
62
 
 
63
 
        void popClipArea();
64
 
 
65
 
        virtual bool drawRescaledImage(const Image *const image, int srcX,
66
 
                                       int srcY, int dstX, int dstY,
67
 
                                       const int width, const int height,
68
 
                                       const int desiredWidth,
69
 
                                       const int desiredHeight,
70
 
                                       const bool useColor = false);
71
 
 
72
 
        virtual void drawImagePattern(const Image *const image,
73
 
                                      const int x, const int y,
74
 
                                      const int w, const int h);
75
 
 
76
 
        virtual void drawRescaledImagePattern(const Image *const image,
77
 
                                              const int x, const int y,
78
 
                                              const int w, const int h,
79
 
                                              const int scaledWidth,
80
 
                                              const int scaledHeight);
81
 
 
82
 
        virtual void calcImagePattern(ImageVertexes *const vert,
83
 
                                      const Image *const image,
84
 
                                      const int x, const int y,
85
 
                                      const int w, const int h) const;
86
 
 
87
 
        virtual void calcImagePattern(ImageCollection *const vert,
88
 
                                      const Image *const image,
89
 
                                      const int x, const int y,
90
 
                                      const int w, const int h) const;
91
 
 
92
 
        virtual void calcTile(ImageVertexes *const vert,
93
 
                              const Image *const image, int x, int y) const;
94
 
 
95
 
        virtual void calcTileSDL(ImageVertexes *const vert,
96
 
                                 int x, int y) const;
97
 
 
98
 
        virtual void calcTile(ImageCollection *const vertCol,
99
 
                              const Image *const image,
100
 
                              int x, int y);
101
 
 
102
 
        virtual void drawTile(const ImageVertexes *const vert);
103
 
 
104
 
        virtual void drawTile(const ImageCollection *const vertCol);
105
 
 
106
 
        virtual void updateScreen();
107
 
 
108
 
        virtual SDL_Surface *getScreenshot() A_WARN_UNUSED;
109
 
 
110
 
        virtual bool drawNet(const int x1, const int y1,
111
 
                             const int x2, const int y2,
112
 
                             const int width, const int height);
113
 
 
114
 
        virtual bool calcWindow(ImageCollection *const vertCol,
115
 
                                const int x, const int y,
116
 
                                const int w, const int h,
117
 
                                const ImageRect &imgRect);
118
 
 
119
 
        void fillRectangle(const gcn::Rectangle &rect) override;
120
 
 
121
 
        void drawRectangle(const gcn::Rectangle &rect) override;
122
 
 
123
 
        void drawPoint(int x, int y) override;
124
 
 
125
 
        void drawLine(int x1, int y1, int x2, int y2) override;
126
 
 
127
 
        bool setVideoMode(const int w, const int h, const int bpp,
128
 
                          const bool fs, const bool hwaccel,
129
 
                          const bool resize, const bool noFrame);
130
 
 
131
 
    protected:
132
 
        virtual bool drawImage2(const Image *const image,
133
 
                                int srcX, int srcY,
134
 
                                int dstX, int dstY,
135
 
                                const int width, const int height,
136
 
                                const bool useColor);
137
 
 
138
 
        uint32_t mOldPixel;
139
 
        int mOldAlpha;
140
 
};
141
 
 
142
 
#endif  // USE_SDL2
143
 
#endif  // SDL2GRAPHICS_H