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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/*
Copyright (c) 2017 DIVIDE-Studio
Copyright (c) 2009 Ionut Cava

This file is part of DIVIDE Framework.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software
and associated documentation files (the "Software"), to deal in the Software
without restriction,
including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/

#ifndef _SCENE_INPUT_ACTIONS_H_
#define _SCENE_INPUT_ACTIONS_H_

#include "Platform/Headers/PlatformDefines.h"

namespace Divide {

struct InputParams {
    InputParams(U8 deviceIndex)
        : InputParams(deviceIndex, -1)
    {
    }

    InputParams(U8 deviceIndex, I32 var1)
        : InputParams(deviceIndex, var1, -1)
    {
    }

    InputParams(U8 deviceIndex, I32 var1, I32 var2)
        : InputParams(deviceIndex, var1, var2, -1)
    {
    }

    InputParams(U8 deviceIndex, I32 var1, I32 var2, I32 var3)
        : InputParams(deviceIndex, var1, var2, var3, -1)
    {
    }

    InputParams(U8 deviceIndex, I32 var1, I32 var2, I32 var3, I32 var4)
        : _var{ var1, var2, var3, var4 },
          _deviceIndex(deviceIndex)
    {
    }

    I32 _var[4];
    U8  _deviceIndex;
};

struct PressReleaseActions {
    PressReleaseActions();
    PressReleaseActions(U16 onPressAction,
                        U16 onReleaseAction);
    PressReleaseActions(U16 onPressAction,
                        U16 onReleaseAction,
                        U16 onLCtrlPressAction,
                        U16 onLCtrlReleaseAction = 0u,
                        U16 onRCtrlPressAction = 0u,
                        U16 onRCtrlReleaseAction = 0u,
                        U16 onLAltPressAction = 0u,
                        U16 onLAltReleaseAction = 0u,
                        U16 onRAltPressAction = 0u,
                        U16 onRAltReleaseAction = 0u);

    // key only
    U16 _onPressAction;
    U16 _onReleaseAction;

    U16 _onLCtrlPressAction;
    U16 _onLCtrlReleaseAction;
    U16 _onRCtrlPressAction;
    U16 _onRCtrlReleaseAction;

    U16 _onLAltPressAction;
    U16 _onLAltReleaseAction;
    U16 _onRAltPressAction;
    U16 _onRAltReleaseAction;

    inline void clear() {
        _onPressAction = 
        _onReleaseAction = 
        _onLCtrlPressAction = 
        _onLCtrlReleaseAction = 
        _onRCtrlPressAction = 
        _onRCtrlReleaseAction = 
        _onLAltPressAction = 
        _onLAltReleaseAction = 
        _onRAltPressAction = 
        _onRAltReleaseAction = 0;
    }
};

struct InputAction {
    InputAction();
    InputAction(DELEGATE_CBK<void, InputParams>& action);

    DELEGATE_CBK<void, InputParams> _action;
    // This will be usefull for menus and the like (defined in XML)
    stringImpl _displayName;

    void displayName(const stringImpl& name);
};

class InputActionList {
   public:
    InputActionList();

    bool registerInputAction(U16 id, DELEGATE_CBK<void, InputParams> action);
    InputAction& getInputAction(U16 id);
    const InputAction& getInputAction(U16 id) const;

   protected:
    hashMapImpl<U16 /*actionID*/, InputAction> _inputActions;
    InputAction _noOPAction;
};

}; //namespace Divide

#endif //_SCENE_INPUT_ACTIONS_H_

Commits for Divide-Framework/trunk/Source Code/Scenes/Headers/SceneInputActions.h

Diff revisions: vs.
Revision Author Commited Message
842 Diff Diff IonutCava picture IonutCava Wed 01 Feb, 2017 17:25:15 +0000

[IonutCava]
- Start to implement scripting support via ChaiScript: http://chaiscript.com/
- Cleanup DELEGATE_CBK alias

836 Diff Diff IonutCava picture IonutCava Fri 27 Jan, 2017 14:59:56 +0000

[IonutCava]
- Update copyright notice

817 Diff Diff IonutCava picture IonutCava Sun 15 Jan, 2017 21:29:59 +0000

[IonutCava]
- Add a new Unit component to SGNs that holds NPC/Player/etc. objects
- Add support for multiple keyboard+mouse combos and joysticks and add mapping between these and players

816 Diff Diff IonutCava picture IonutCava Fri 13 Jan, 2017 17:05:20 +0000

[IonutCava]
- Allow per player scene state and input source
— Add SceneStatePerPlayer class
— Add device index to InputParams objects.
— ToDo: map players to devide indices

703 Diff Diff IonutCava picture IonutCava Wed 11 May, 2016 15:44:57 +0000

[IonutCava]
- Finish XML-based control bindings:
— Allow per bind input params (key id, mouse button index, joystick control data, etc)
— Allow mouse binding (with up to 7 buttons)
— Allow up to 4 joysticks (for now) with 120+ button, POV, Axis, Slider and Vector binding support for each
- Change all hashes in code from U32 to size_t for compatibility with STL/Boost

699 IonutCava picture IonutCava Tue 10 May, 2016 16:16:57 +0000

[IonutCava]
- Initial key binding code with external XML support
— Allow separation of actions and keys
— Specify actions in code by id
— Specify action id for each Key state
— Allow key modifiers: Left/Right Alt, Left/Right Ctrl

- Initial default scene code