1
/*
2
 *  The Mana World
3
 *  Copyright (C) 2004  The Mana World Development Team
4
 *
5
 *  This file is part of The Mana World.
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program; if not, write to the Free Software
19
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
 */
21
22
#ifndef OPENGLGRAPHICS_H
23
#define OPENGLGRAPHICS_H
24
25
#include "graphics.h"
26
27
class OpenGLGraphics : public Graphics
28
{
29
    public:
30
        OpenGLGraphics();
31
32
        ~OpenGLGraphics();
33
34
        /**
35
         * Sets whether vertical refresh syncing is enabled. Takes effect after
36
         * the next call to setVideoMode(). Only implemented on MacOS for now.
37
         */
38
        void setSync(bool sync);
39
        bool getSync() const { return mSync; }
40
41
        bool setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel);
42
43
        bool drawImage(Image *image,
44
                       int srcX, int srcY,
45
                       int dstX, int dstY,
46
                       int width, int height,
47
                       bool useColor);
48
49
        /**
50
         * Draws a resclaled version of the image
51
         */
52
        bool drawRescaledImage(Image *image, int srcX, int srcY,
53
                               int dstX, int dstY,
54
                               int width, int height,
55
                               int desiredWidth, int desiredHeight,
56
                               bool useColor);
57
58
        /**
59
         * Used to get the smooth rescale option over the standard function.
60
         */
61
        bool drawRescaledImage(Image *image, int srcX, int srcY,
62
                               int dstX, int dstY,
63
                               int width, int height,
64
                               int desiredWidth, int desiredHeight,
65
                               bool useColor, bool smooth);
66
67
        void drawImagePattern(Image *image,
68
                              int x, int y,
69
                              int w, int h);
70
71
        /**
72
         * Draw a pattern based on a rescaled version of the given image...
73
         */
74
        void drawRescaledImagePattern(Image *image,
75
                               int x, int y, int w, int h,
76
                               int scaledWidth, int scaledHeight);
77
78
        void updateScreen();
79
80
        void _beginDraw();
81
        void _endDraw();
82
83
        bool pushClipArea(gcn::Rectangle area);
84
        void popClipArea();
85
86
        void setColor(const gcn::Color &color);
87
88
        void drawPoint(int x, int y);
89
90
        void drawLine(int x1, int y1, int x2, int y2);
91
92
        void drawRectangle(const gcn::Rectangle &rect, bool filled);
93
94
        void drawRectangle(const gcn::Rectangle &rect);
95
96
        void fillRectangle(const gcn::Rectangle &rect);
97
98
        void setTargetPlane(int width, int height);
99
100
        /**
101
         * Takes a screenshot and returns it as SDL surface.
102
         */
103
        SDL_Surface *getScreenshot();
104
105
    protected:
106
        void setTexturingAndBlending(bool enable);
107
108
    private:
109
        bool mAlpha, mTexture;
110
        bool mColorAlpha;
111
        bool mSync;
112
};
113
114
#endif