summaryrefslogtreecommitdiffstats
path: root/kolf/canvasitem.cpp
blob: 3acacba236e7b8012e64a8985e92d4f757344757 (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
#include <tqcanvas.h>

#include <tdeconfig.h>

#include "game.h"
#include "canvasitem.h"

TQCanvasRectangle *CanvasItem::onVStrut()
{
	TQCanvasItem *qthis = dynamic_cast<TQCanvasItem *>(this);
	if (!qthis)
		return 0;
	TQCanvasItemList l = qthis->collisions(true);
	l.sort();
	bool aboveVStrut = false;
	CanvasItem *item = 0;
	TQCanvasItem *qitem = 0;
	for (TQCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it)
	{
		item = dynamic_cast<CanvasItem *>(*it);
		if (item)
		{
			qitem = *it;
			if (item->vStrut())
			{
				//kdDebug(12007) << "above vstrut\n";
				aboveVStrut = true;
				break;
			}
		}
	}

	TQCanvasRectangle *ritem = dynamic_cast<TQCanvasRectangle *>(qitem);

	return aboveVStrut && ritem? ritem : 0;
}

void CanvasItem::save(TDEConfig *cfg)
{
	cfg->writeEntry("dummykey", true);
}

void CanvasItem::playSound(TQString file, double vol)
{
	if (game)
		game->playSound(file, vol);
}