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

« back to all changes in this revision

Viewing changes to src/sdlgraphics.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 SDLGRAPHICS_H
24
 
#define SDLGRAPHICS_H
25
 
 
26
 
#ifdef USE_SDL2
27
 
#include "sdl2graphics.h"
28
 
 
29
 
#else
30
 
 
31
 
#include "graphics.h"
32
 
 
33
 
#include "localconsts.h"
34
 
 
35
 
class Image;
36
 
class ImageCollection;
37
 
class ImageVertexes;
38
 
class MapLayer;
39
 
 
40
 
struct SDL_Surface;
41
 
 
42
 
/**
43
 
 * A central point of control for graphics.
44
 
 */
45
 
class SDLGraphics : public Graphics
46
 
{
47
 
    public:
48
 
        /**
49
 
         * Constructor.
50
 
         */
51
 
        SDLGraphics();
52
 
 
53
 
        A_DELETE_COPY(SDLGraphics)
54
 
 
55
 
        /**
56
 
         * Destructor.
57
 
         */
58
 
        virtual ~SDLGraphics();
59
 
 
60
 
        void _beginDraw();
61
 
 
62
 
        void _endDraw();
63
 
 
64
 
        bool pushClipArea(gcn::Rectangle rect);
65
 
 
66
 
        void popClipArea();
67
 
 
68
 
        virtual bool drawRescaledImage(const Image *const image, int srcX,
69
 
                                       int srcY, int dstX, int dstY,
70
 
                                       const int width, const int height,
71
 
                                       const int desiredWidth,
72
 
                                       const int desiredHeight,
73
 
                                       const bool useColor = false);
74
 
 
75
 
        virtual void drawImagePattern(const Image *const image,
76
 
                                      const int x, const int y,
77
 
                                      const int w, const int h);
78
 
 
79
 
        virtual void drawRescaledImagePattern(const Image *const image,
80
 
                                              const int x, const int y,
81
 
                                              const int w, const int h,
82
 
                                              const int scaledWidth,
83
 
                                              const int scaledHeight);
84
 
 
85
 
        virtual void calcImagePattern(ImageVertexes *const vert,
86
 
                                      const Image *const image,
87
 
                                      const int x, const int y,
88
 
                                      const int w, const int h) const;
89
 
 
90
 
        virtual void calcImagePattern(ImageCollection *const vert,
91
 
                                      const Image *const image,
92
 
                                      const int x, const int y,
93
 
                                      const int w, const int h) const;
94
 
 
95
 
        virtual void calcTile(ImageVertexes *const vert,
96
 
                              const Image *const image, int x, int y) const;
97
 
 
98
 
        virtual void calcTileSDL(ImageVertexes *const vert,
99
 
                                 int x, int y) const;
100
 
 
101
 
        virtual void calcTile(ImageCollection *const vertCol,
102
 
                              const Image *const image,
103
 
                              int x, int y);
104
 
 
105
 
        virtual void drawTile(const ImageVertexes *const vert);
106
 
 
107
 
        virtual void drawTile(const ImageCollection *const vertCol);
108
 
 
109
 
        virtual void updateScreen();
110
 
 
111
 
        virtual SDL_Surface *getScreenshot() A_WARN_UNUSED;
112
 
 
113
 
        virtual bool drawNet(const int x1, const int y1,
114
 
                             const int x2, const int y2,
115
 
                             const int width, const int height);
116
 
 
117
 
        virtual bool calcWindow(ImageCollection *const vertCol,
118
 
                                const int x, const int y,
119
 
                                const int w, const int h,
120
 
                                const ImageRect &imgRect);
121
 
 
122
 
        void fillRectangle(const gcn::Rectangle &rect) override;
123
 
 
124
 
        void drawRectangle(const gcn::Rectangle &rect) override;
125
 
 
126
 
        void drawPoint(int x, int y) override;
127
 
 
128
 
        void drawLine(int x1, int y1, int x2, int y2) override;
129
 
 
130
 
        bool setVideoMode(const int w, const int h, const int bpp,
131
 
                          const bool fs, const bool hwaccel,
132
 
                          const bool resize, const bool noFrame);
133
 
 
134
 
    protected:
135
 
        virtual bool drawImage2(const Image *const image,
136
 
                                int srcX, int srcY,
137
 
                                int dstX, int dstY,
138
 
                                const int width, const int height,
139
 
                                const bool useColor);
140
 
 
141
 
        int SDL_FakeUpperBlit(const SDL_Surface *const src,
142
 
                              SDL_Rect *const srcrect,
143
 
                              const SDL_Surface *const dst,
144
 
                              SDL_Rect *dstrect) const;
145
 
 
146
 
        void drawHLine(int x1, int y, int x2);
147
 
 
148
 
        void drawVLine(int x, int y1, int y2);
149
 
 
150
 
        uint32_t mOldPixel;
151
 
        int mOldAlpha;
152
 
};
153
 
 
154
 
#endif  // USE_SDL2
155
 
#endif  // SDLGRAPHICS_H