GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/resources/cursors.cpp Lines: 7 7 100.0 %
Date: 2021-03-17 Branches: 35 68 51.5 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2012-2019  The ManaPlus Developers
4
 *  Copyright (C) 2019-2021  Andrei Karas
5
 *
6
 *  This file is part of The ManaPlus Client.
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
 *  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, see <http://www.gnu.org/licenses/>.
20
 */
21
22
#include "resources/cursors.h"
23
24
#include "debug.h"
25
26
namespace Cursors
27
{
28
3
    static const StrToCursor hoverCursors[] =
29
    {
30
        {"select", Cursor::CURSOR_POINTER},
31
        {"pointer", Cursor::CURSOR_POINTER},
32
        {"lr", Cursor::CURSOR_RESIZE_ACROSS},
33
        {"rl", Cursor::CURSOR_RESIZE_ACROSS},
34
        {"resizeAcross", Cursor::CURSOR_RESIZE_ACROSS},
35
        {"ud", Cursor::CURSOR_RESIZE_DOWN},
36
        {"du", Cursor::CURSOR_RESIZE_DOWN},
37
        {"resizeDown", Cursor::CURSOR_RESIZE_DOWN},
38
        {"ldru", Cursor::CURSOR_RESIZE_DOWN_LEFT},
39
        {"ruld", Cursor::CURSOR_RESIZE_DOWN_LEFT},
40
        {"ld", Cursor::CURSOR_RESIZE_DOWN_LEFT},
41
        {"ru", Cursor::CURSOR_RESIZE_DOWN_LEFT},
42
        {"resizeDownLeft", Cursor::CURSOR_RESIZE_DOWN_LEFT},
43
        {"lurd", Cursor::CURSOR_RESIZE_DOWN_RIGHT},
44
        {"rdlu", Cursor::CURSOR_RESIZE_DOWN_RIGHT},
45
        {"rd", Cursor::CURSOR_RESIZE_DOWN_RIGHT},
46
        {"lu", Cursor::CURSOR_RESIZE_DOWN_RIGHT},
47
        {"resizeDownRight", Cursor::CURSOR_RESIZE_DOWN_RIGHT},
48
        {"attack", Cursor::CURSOR_FIGHT},
49
        {"fight", Cursor::CURSOR_FIGHT},
50
        {"take", Cursor::CURSOR_PICKUP},
51
        {"pickup", Cursor::CURSOR_PICKUP},
52
        {"talk", Cursor::CURSOR_TALK},
53
        {"action", Cursor::CURSOR_ACTION},
54
        {"left", Cursor::CURSOR_LEFT},
55
        {"up", Cursor::CURSOR_UP},
56
        {"right", Cursor::CURSOR_RIGHT},
57
        {"down", Cursor::CURSOR_DOWN}
58














56
    };
59
60
36
    CursorT stringToCursor(const std::string &name)
61
    {
62
792
        for (size_t f = 0; f < sizeof(hoverCursors) / sizeof(StrToCursor);
63
             f ++)
64
        {
65
792
            if (hoverCursors[f].str == name)
66
36
                return hoverCursors[f].cursor;
67
        }
68
        return Cursor::CURSOR_POINTER;
69
    }
70

3
}  // namespace Cursors