The Battle for Wesnoth
1.19.5+dev
key.hpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2003 - 2024
3
by David White <dave@whitevine.net>
4
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY.
12
13
See the COPYING file for more details.
14
*/
15
16
#pragma once
17
18
#include <cstdint>
19
#include <SDL2/SDL.h>
20
21
/**
22
* Class that keeps track of all the keys on the keyboard.
23
* Whether any key is pressed or not can be found by using its
24
* operator[]. Note though that it is generally better to use
25
* key events to see when keys are pressed rather than to poll using
26
* this object.
27
*/
28
class
CKey
29
{
30
const
uint8_t *
key_list
;
31
32
public
:
33
CKey
();
34
bool
operator[]
(
int
k)
const
;
35
static
bool
is_uncomposable
(
const
SDL_KeyboardEvent &event);
36
};
CKey
Class that keeps track of all the keys on the keyboard.
Definition:
key.hpp:29
CKey::key_list
const uint8_t * key_list
Definition:
key.hpp:30
CKey::is_uncomposable
static bool is_uncomposable(const SDL_KeyboardEvent &event)
Definition:
key.cpp:28
CKey::CKey
CKey()
Definition:
key.cpp:18
CKey::operator[]
bool operator[](int k) const
Definition:
key.cpp:23
Generated by
1.9.1