ManaPlus
cursors.cpp
Go to the documentation of this file.
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  static const StrToCursor hoverCursors[] =
29  {
30  {"select", Cursor::CURSOR_POINTER},
31  {"pointer", Cursor::CURSOR_POINTER},
34  {"resizeAcross", Cursor::CURSOR_RESIZE_ACROSS},
37  {"resizeDown", Cursor::CURSOR_RESIZE_DOWN},
42  {"resizeDownLeft", Cursor::CURSOR_RESIZE_DOWN_LEFT},
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  };
59 
60  CursorT stringToCursor(const std::string &name)
61  {
62  for (size_t f = 0; f < sizeof(hoverCursors) / sizeof(StrToCursor);
63  f ++)
64  {
65  if (hoverCursors[f].str == name)
66  return hoverCursors[f].cursor;
67  }
69  }
70 } // namespace Cursors
Cursor ::T CursorT
Definition: cursor.h:44
@ CURSOR_FIGHT
Definition: cursor.h:34
@ CURSOR_RESIZE_DOWN_RIGHT
Definition: cursor.h:33
@ CURSOR_PICKUP
Definition: cursor.h:35
@ CURSOR_RESIZE_DOWN
Definition: cursor.h:31
@ CURSOR_RIGHT
Definition: cursor.h:40
@ CURSOR_POINTER
Definition: cursor.h:29
@ CURSOR_LEFT
Definition: cursor.h:38
@ CURSOR_RESIZE_DOWN_LEFT
Definition: cursor.h:32
@ CURSOR_RESIZE_ACROSS
Definition: cursor.h:30
@ CURSOR_UP
Definition: cursor.h:39
@ CURSOR_TALK
Definition: cursor.h:36
@ CURSOR_DOWN
Definition: cursor.h:41
@ CURSOR_ACTION
Definition: cursor.h:37
static const StrToCursor hoverCursors[]
Definition: cursors.cpp:28
CursorT stringToCursor(const std::string &name)
Definition: cursors.cpp:60