GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/utils/sdlsharedhelper.cpp Lines: 4 5 80.0 %
Date: 2017-11-29 Branches: 1 2 50.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2013-2017  The ManaPlus Developers
4
 *
5
 *  This file is part of The ManaPlus Client.
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#include "utils/sdlsharedhelper.h"
22
23
#ifdef __native_client__
24
#include <ppapi/c/ppb_mouse_cursor.h>
25
#include <ppapi/cpp/instance.h>
26
#include <ppapi/cpp/mouse_cursor.h>
27
#include <ppapi_simple/ps.h>
28
#endif  // __native_client__
29
30
PRAGMA48(GCC diagnostic push)
31
PRAGMA48(GCC diagnostic ignored "-Wshadow")
32
#include <SDL_events.h>
33
PRAGMA48(GCC diagnostic pop)
34
35
#include "debug.h"
36
37
248
void SDL::showCursor(const bool show)
38
{
39
#ifdef __native_client__
40
    PP_MouseCursor_Type cursor;
41
    if (show)
42
        cursor = PP_MOUSECURSOR_TYPE_POINTER;  // show default cursor
43
    else
44
        cursor = PP_MOUSECURSOR_TYPE_NONE;     // hide cursor
45
46
    pp::MouseCursor::SetCursor(
47
        pp::InstanceHandle(PSGetInstanceId()),
48
        cursor);
49
#endif  // __native_client__
50
51
248
    if (show)
52
        SDL_ShowCursor(SDL_ENABLE);
53
    else
54
248
        SDL_ShowCursor(SDL_DISABLE);
55
248
}