summaryrefslogtreecommitdiff
path: root/noncore/games/kbill/MCursor.cc
blob: 93dd559225cce735a449af7c448381fd02280e97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/***************************************************************************
                          MCursor.cc  -  description
                             -------------------
    begin                : Thu Dec 30 1999
    copyright            : (C) 1999 by Jurrien Loonstra
    email                : j.h.loonstra@st.hanze.nl
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#include "MCursor.h"

#ifdef KDEVER
#include <kapp.h>
#include <kstandarddirs.h>
#endif
#include <opie2/odebug.h>
using namespace Opie::Core;
#include <qpe/resource.h>
MCursor::~MCursor() {
	delete cursor;
}

void MCursor::load(const char *name, int masked) {
	
	#ifdef KDEVER
	QString file, mfile;
        KStandardDirs dirs;


	file = dirs.findResource("data","kbill/bitmaps/" + QString::fromLocal8Bit(name)  + ".xbm");

	QBitmap bitmap, mask;
	if (bitmap.load(file) == FALSE) {
		oerr << "cannot open " << file << oendl;
		exit(1);
	}
	if (masked == SEP_MASK) {
//		mfile.sprintf ("%sbitmaps/%s_mask.xbm", (const char*)dir, name);
		mfile = file = dirs.findResource("data","kbill/bitmaps/" + QString::fromLocal8Bit(name)  + "_mask.xbm");
		if (mask.load(mfile) == FALSE) {
			oerr << "cannot open " << file << oendl;
			exit(1);
		}
	}
	else
	mask = bitmap;
	#endif

	QBitmap bitmap, mask;
	bitmap = Resource::loadBitmap("kbill/bitmaps/" + QString::fromLocal8Bit(name));

        if (masked == SEP_MASK)
	    mask = bitmap = Resource::loadBitmap("kbill/bitmaps/" + QString::fromLocal8Bit(name) + "_mask.xbm");
	else
	   mask = bitmap;
	cursor = new QCursor(bitmap, mask, bitmap.width() / 2, bitmap.height() / 2);
}