summaryrefslogtreecommitdiff
path: root/noncore/games/kbill/MCursor.cc
Unidiff
Diffstat (limited to 'noncore/games/kbill/MCursor.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/kbill/MCursor.cc69
1 files changed, 69 insertions, 0 deletions
diff --git a/noncore/games/kbill/MCursor.cc b/noncore/games/kbill/MCursor.cc
new file mode 100644
index 0000000..30f7577
--- a/dev/null
+++ b/noncore/games/kbill/MCursor.cc
@@ -0,0 +1,69 @@
1/***************************************************************************
2 MCursor.cc - description
3 -------------------
4 begin : Thu Dec 30 1999
5 copyright : (C) 1999 by Jurrien Loonstra
6 email : j.h.loonstra@st.hanze.nl
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#include "MCursor.h"
18#include "objects.h"
19
20#include <qcursor.h>
21#include <qbitmap.h>
22#include <qwidget.h>
23#include <qstring.h>
24#ifdef KDEVER
25#include <kapp.h>
26#include <kstandarddirs.h>
27#endif
28#include <iostream.h>
29#include <qpe/resource.h>
30MCursor::~MCursor() {
31 delete cursor;
32}
33
34void MCursor::load(const char *name, int masked) {
35
36 #ifdef KDEVER
37 QString file, mfile;
38 KStandardDirs dirs;
39
40
41 file = dirs.findResource("data","kbill/bitmaps/" + QString::fromLocal8Bit(name) + ".xbm");
42
43 QBitmap bitmap, mask;
44 if (bitmap.load(file) == FALSE) {
45 cerr << "cannot open " << file << endl;
46 exit(1);
47 }
48 if (masked == SEP_MASK) {
49 // mfile.sprintf ("%sbitmaps/%s_mask.xbm", (const char*)dir, name);
50 mfile = file = dirs.findResource("data","kbill/bitmaps/" + QString::fromLocal8Bit(name) + "_mask.xbm");
51 if (mask.load(mfile) == FALSE) {
52 cerr << "cannot open " << file << endl;
53 exit(1);
54 }
55 }
56 else
57 mask = bitmap;
58 #endif
59
60 QBitmap bitmap, mask;
61 bitmap = Resource::loadBitmap("kbill/bitmaps/" + QString::fromLocal8Bit(name));
62
63 if (masked == SEP_MASK)
64 mask = bitmap = Resource::loadBitmap("kbill/bitmaps/" + QString::fromLocal8Bit(name) + "_mask.xbm");
65 else
66 mask = bitmap;
67 cursor = new QCursor(bitmap, mask, bitmap.width() / 2, bitmap.height() / 2);
68}
69