ManaPlus
sdlsharedhelper.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2013-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 "utils/sdlsharedhelper.h"
23 
24 #ifdef __native_client__
25 #include <ppapi/c/ppb_mouse_cursor.h>
26 #include <ppapi/cpp/instance.h>
27 #include <ppapi/cpp/mouse_cursor.h>
28 #include <ppapi_simple/ps.h>
29 #endif // __native_client__
30 
31 PRAGMA48(GCC diagnostic push)
32 PRAGMA48(GCC diagnostic ignored "-Wshadow")
33 #include <SDL_events.h>
34 PRAGMA48(GCC diagnostic pop)
35 
36 #include "debug.h"
37 
38 void SDL::showCursor(const bool show)
39 {
40 #ifdef __native_client__
41  PP_MouseCursor_Type cursor;
42  if (show)
43  cursor = PP_MOUSECURSOR_TYPE_POINTER; // show default cursor
44  else
45  cursor = PP_MOUSECURSOR_TYPE_NONE; // hide cursor
46 
47  pp::MouseCursor::SetCursor(
48  pp::InstanceHandle(PSGetInstanceId()),
49  cursor);
50 #endif // __native_client__
51 
52  if (show)
53  SDL_ShowCursor(SDL_ENABLE);
54  else
55  SDL_ShowCursor(SDL_DISABLE);
56 }
#define PRAGMA48(str)
Definition: localconsts.h:199
void showCursor(const bool show)