Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "Headers\AutoKeyRepeat.h"
#include "Platform/Input/Headers/InputInterface.h"

namespace Divide {
namespace Input {

AutoRepeatKey::AutoRepeatKey(D32 repeatDelay, D32 initialDelay)
    : _repeatDelay(repeatDelay), _initialDelay(initialDelay) {}

void AutoRepeatKey::begin(const KeyEvent &evt) {
    _key = evt;
    _elapsed = 0.0;
    _delay = _initialDelay;
}

void AutoRepeatKey::end(const KeyEvent &evt) {
    if (_key._text != evt._text) {
        return;
    }

    _key._key = KeyCode::KC_UNASSIGNED;
}

// Inject key repeats if the _repeatDelay expired between calls
void AutoRepeatKey::update(const U64 deltaTime) {
    if (_key._key == KeyCode::KC_UNASSIGNED) {
        return;
    }
    _elapsed += (deltaTime * 0.000001);  //< use seconds
    if (_elapsed < _delay) return;

    _elapsed -= _delay;
    _delay = _repeatDelay;

    do {
        repeatKey(_key._key, _key._text);

        _elapsed -= _repeatDelay;
    } while (_elapsed >= _repeatDelay);

    _elapsed = 0.0;
}

};  // namespace Input
};  // namespace Divide

Commits for Divide-Framework/trunk/Source Code/Platform/Input/AutoKeyRepeat.cpp

Diff revisions: vs.
Revision Author Commited Message
350 Diff Diff IonutCava picture IonutCava Tue 10 Feb, 2015 16:25:39 +0000

[Ionut]
- Simplified some Util-namespace level functions by using STL algorithms where possible
- Formatted the entire codebase using clang-format with the following style: "{BasedOnStyle: Google, IndentWidth: 4}"
- Attempted to make ProfileTimer thread-safe (temp fix until std::chrono works properly in Visual Studio)

334 IonutCava picture IonutCava Wed 10 Dec, 2014 17:21:22 +0000

[Ionut]
- Reorganized the Hardware project and renamed to "Platform"
- Reorganized the Server project