1/**********************************************************************************
2 This file is part of the game 'KTron'
3
4 Copyright (C) 1998-2000 by Matthias Kiefer <matthias.kiefer@gmx.de>
5 Copyright (C) 2005 Benjamin C. Meyer <ben at meyerhome dot net>
6 Copyright (C) 2008-2009 Stas Verberkt <legolas at legolasweb dot nl>
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
22 *******************************************************************************/
23
24#ifndef RENDERER_H
25#define RENDERER_H
26
27#include "playfield.h"
28
29#include <QPainter>
30#include <QString>
31#include <QSize>
32
33class QPixmap;
34class RendererPrivate;
35
36class Renderer {
37 private:
38 Renderer();
39 Renderer(const Renderer &);
40 ~Renderer();
41 public:
42 static Renderer *self();
43
44 bool loadTheme(const QString &);
45 void boardResized(int width, int height, int partWidth, int partHeight);
46
47 int calculateOffsetX(int x);
48 int calculateOffsetY(int y);
49
50 QPixmap getPart(const QString &partName);
51 QPixmap getPartOfSize(const QString &partName, const QSize &partSize);
52 QPixmap background();
53 QPixmap messageBox(const QString &message);
54
55 void resetPlayField();
56 void drawPart(QPainter & painter, int x, int y, QString svgName);
57 void updatePlayField(PlayField &playfield);
58 QPixmap *getPlayField();
59
60 QPixmap pixmapFromCache(RendererPrivate *p, const QString &svgName, const QSize &size);
61
62 private:
63 RendererPrivate *p;
64};
65
66#endif // RENDERER_H
67