Nebula
Loading...
Searching...
No Matches
input.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
25//------------------------------------------------------------------------------
26#include "nsharp/nsconfig.h"
27
28namespace Scripting
29{
30namespace Api
31{
32
33//------------------------------------------------------------------------------
40{
41 uint64_t held;
42 uint64_t down;
43 uint64_t up;
44};
45
46//------------------------------------------------------------------------------
54{
56
57 uint32_t mouseHeld;
58 uint32_t mouseDown;
59 uint32_t mouseUp;
61 int32_t wheel;
62
63 uint32_t hasFocus;
64 uint32_t mouseCaptured;
65 uint32_t keyCaptured;
66 uint32_t mods;
67
68 float pixelX;
69 float pixelY;
70 float screenX;
71 float screenY;
72 float moveX;
73 float moveY;
74};
75
76static_assert(sizeof(InputSnapshot) == 136, "managed input mirror layout");
77
78//------------------------------------------------------------------------------
84{
85 uint8_t held;
86 uint8_t down;
87 uint8_t released;
88 uint8_t pad;
89 float value;
90};
91
92static_assert(sizeof(ActionStateEntry) == 8, "managed action mirror entry");
93
94//------------------------------------------------------------------------------
98NEBULA_EXPORT int ActionSync(void* stateBuffer, int stateSize, void* lastPlayerBuffer, int lastPlayerSize);
99
100//------------------------------------------------------------------------------
104NEBULA_EXPORT int ActionResolve(const char* name);
105
106//------------------------------------------------------------------------------
112
113//------------------------------------------------------------------------------
119
120//------------------------------------------------------------------------------
126
127//------------------------------------------------------------------------------
136NEBULA_EXPORT int InputSync(void* buffer, int bufferSize);
137
138//------------------------------------------------------------------------------
145NEBULA_EXPORT int InputCharInput(char* outBuffer, int outLen);
146
147} // namespace Api
148} // namespace Scripting
Definition game.cc:18
int ActionMaxPlayers()
Definition input.cc:205
int ActionMaxActions()
The size of the mirror on both sides.
Definition input.cc:196
int InputSync(void *buffer, int bufferSize)
The state is read as it stands when the call is made, which is why the managed side calls this at the...
Definition input.cc:28
int ActionLoad()
Read the definitions and then the player's file over them.
Definition input.cc:216
int ActionSync(void *stateBuffer, int stateSize, void *lastPlayerBuffer, int lastPlayerSize)
Copy this frame's action state into the buffers C# owns.
Definition input.cc:138
int ActionSave()
Write every action as it is now, to the player's file.
Definition input.cc:230
int InputCharInput(char *outBuffer, int outLen)
The text the keyboard produced during this frame, as utf8 into the buffer C# owns.
Definition input.cc:106
int ActionResolve(const char *name)
The id a name refers to, or -1 when the map does not have it.
Definition input.cc:183
Definition game.cc:16
#define NEBULA_EXPORT
Definition nsconfig.h:6
The action state as C# reads it.
Definition input.h:84
uint8_t pad
Definition input.h:88
uint8_t down
Definition input.h:86
uint8_t held
Definition input.h:85
uint8_t released
Definition input.h:87
float value
Definition input.h:89
The layout the managed input mirror is built from.
Definition input.h:54
uint32_t hasFocus
Definition input.h:63
KeyWords keys[3]
Definition input.h:55
float pixelX
Definition input.h:68
float pixelY
Definition input.h:69
float moveY
Definition input.h:73
float screenX
Definition input.h:70
uint32_t mouseDown
Definition input.h:58
uint32_t mouseUp
Definition input.h:59
uint32_t mouseHeld
Definition input.h:57
int32_t wheel
Definition input.h:61
uint32_t mouseCaptured
Definition input.h:64
float moveX
Definition input.h:72
float screenY
Definition input.h:71
uint32_t keyCaptured
Definition input.h:65
uint32_t mouseDoubleClicked
Definition input.h:60
uint32_t mods
Definition input.h:66
One key as three words: held through the frame, pressed during it, released during it.
Definition input.h:40
uint64_t up
Definition input.h:43
uint64_t held
Definition input.h:41
uint64_t down
Definition input.h:42