MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / ApocCursor

Method ApocCursor

framework/apocresources/cursor.cpp:12–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10{
11
12ApocCursor::ApocCursor(sp<Palette> pal) : cursorPos{0, 0}
13{
14 auto f = fw().data->fs.open("xcom3/tacdata/mouse.dat");
15 if (!f)
16 {
17 LogError("Failed to open xcom3/tacdata/mouse.dat");
18 return;
19 }
20
21 auto cursorCount = f.size() / 576;
22
23 while (images.size() < cursorCount)
24 {
25 auto palImg = mksp<PaletteImage>(Vec2<int>{24, 24});
26 PaletteImageLock l(palImg, ImageLockUse::Write);
27 for (int y = 0; y < 24; y++)
28 {
29 for (int x = 0; x < 24; x++)
30 {
31 char palidx;
32 f.read(&palidx, 1);
33 l.set(Vec2<int>{x, y}, palidx);
34 }
35 }
36 images.push_back(palImg->toRGBImage(pal));
37 }
38
39 CurrentType = CursorType::Normal;
40}
41
42ApocCursor::~ApocCursor() = default;
43

Callers

nothing calls this directly

Calls 5

openMethod · 0.80
readMethod · 0.80
toRGBImageMethod · 0.80
sizeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected