source: trunk/src/input/keyboard.cpp @ 2818

Last change on this file since 2818 was 2818, checked in by sam, 8 years ago

build: fix a few compilation issues with input v2.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 1.0 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://www.wtfpl.net/ for more details.
9//
10
11#if defined HAVE_CONFIG_H
12#   include "config.h"
13#endif
14
15#include <cstdlib>
16
17#include "core.h"
18
19#ifndef LOL_INPUT_V2
20
21namespace lol
22{
23
24/*
25 * Keyboard implementation class
26 */
27
28static class KeyboardData
29{
30    friend class Keyboard;
31
32public:
33    KeyboardData() { }
34
35private:
36    Array<uint32_t> m_chars;
37}
38keyboarddata;
39
40/*
41 * Public Keyboard class
42 */
43
44Keyboard::Keyboard()
45  : m_data(new KeyboardData())
46{
47}
48
49Keyboard::~Keyboard()
50{
51    delete m_data;
52}
53
54void Keyboard::PushChar(uint32_t ch)
55{
56    m_data->m_chars.Push(ch);
57}
58
59uint32_t Keyboard::PopChar()
60{
61    if (!m_data->m_chars.Count())
62        return 0;
63
64    uint32_t ret = m_data->m_chars[0];
65    m_data->m_chars.Remove(0);
66    return ret;
67}
68
69} /* namespace lol */
70
71#endif // !LOL_INPUT_V2
Note: See TracBrowser for help on using the repository browser.