Nebula
Loading...
Searching...
No Matches
input.h File Reference

Detailed Description

The Input::InputServer as a C boundary for the managed runtime.

The input server is event driven: events come in through the window and travel the handler chain, and the default keyboard and mouse handlers are the handlers that present what they received as a state an application can poll. This is that polling state, copied into a buffer C# owns.

The copy is only this frame's between the point where the events have been pumped and InputServer's EndFrame(), which is what clears the per-frame flags. In the game application the render feature unit pumps the window events at the start of its OnBeginFrame, and the script feature unit is attached after it, so the managed sync at the beginning of the managed frame is the point where the state is the frame's own.

What the state holds is what the input server received. ImGui gets the keys first and the window drops the events it consumes, so a key typed into a text field never reaches the handlers. That is what the focus and capture flags are for: they tell a caller that a key is missing because the UI took it rather than because nobody pressed it.

#include "nsharp/nsconfig.h"

Go to the source code of this file.

Classes

struct  Scripting::Api::KeyWords
 One key as three words: held through the frame, pressed during it, released during it. More...
struct  Scripting::Api::InputSnapshot
 The layout the managed input mirror is built from. More...
struct  Scripting::Api::ActionStateEntry
 The action state as C# reads it. More...

Namespaces

namespace  Scripting
namespace  Scripting::Api

Functions

int Scripting::Api::ActionSync (void *stateBuffer, int stateSize, void *lastPlayerBuffer, int lastPlayerSize)
 Copy this frame's action state into the buffers C# owns.
int Scripting::Api::ActionResolve (const char *name)
 The id a name refers to, or -1 when the map does not have it.
int Scripting::Api::ActionMaxActions ()
 The size of the mirror on both sides.
int Scripting::Api::ActionMaxPlayers ()
int Scripting::Api::ActionLoad ()
 Read the definitions and then the player's file over them.
int Scripting::Api::ActionSave ()
 Write every action as it is now, to the player's file.
int Scripting::Api::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 beginning of its frame and not anywhere else.
int Scripting::Api::InputCharInput (char *outBuffer, int outLen)
 The text the keyboard produced during this frame, as utf8 into the buffer C# owns.