DungeonCrawl
|
Implements functionality for handling input. More...
#include "input_handler.h"
#include "../../logging/logger.h"
#include "../io_handler.h"
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
Go to the source code of this file.
Data Structures | |
struct | input_timing_t |
Macros | |
#define | CLOCK_MONOTONIC 1 |
#define | KEY_EVENT NCTYPE_UNKNOWN |
#define | KEY_DEBOUNCE_TIME_MS 20 |
Functions | |
input_t | translate_input (const ncinput *raw_input) |
Translate a raw Notcurses input to a logical input type. | |
bool | init_input_handler (struct notcurses *notcurses_ptr) |
Initialize the input handler. | |
bool | get_input_blocking (input_event_t *event) |
Get the next input event (blocking) | |
bool | get_input_nonblocking (input_event_t *event) |
Get the next input event (non-blocking) | |
void | shutdown_input_handler (void) |
Shutdown the input handler. |
Implements functionality for handling input.
Definition in file input_handler.c.
#define CLOCK_MONOTONIC 1 |
Definition at line 16 of file input_handler.c.
#define KEY_DEBOUNCE_TIME_MS 20 |
Definition at line 27 of file input_handler.c.
#define KEY_EVENT NCTYPE_UNKNOWN |
Definition at line 23 of file input_handler.c.
bool get_input_blocking | ( | input_event_t * | event | ) |
Get the next input event (blocking)
Waits for an input event and translates it to a logical input type. This function blocks until input is received.
[out] | event | Pointer to an input_event_t structure to fill with the input event |
Definition at line 147 of file input_handler.c.
bool get_input_nonblocking | ( | input_event_t * | event | ) |
Get the next input event (non-blocking)
Checks for an input event and translates it to a logical input type. This function does not block if no input is available.
[out] | event | Pointer to an input_event_t structure to fill with the input event |
Definition at line 181 of file input_handler.c.
bool init_input_handler | ( | struct notcurses * | nc | ) |
Initialize the input handler.
Sets up the input handling system. This function must be called before any other input functions.
nc | The Notcurses instance to use for input handling |
Definition at line 100 of file input_handler.c.
void shutdown_input_handler | ( | void | ) |
Shutdown the input handler.
Cleans up resources. This function should be called when shutting down the game.
Definition at line 212 of file input_handler.c.
input_t translate_input | ( | const ncinput * | raw_input | ) |
Translate a raw Notcurses input to a logical input type.
Helper function to convert from hardware-specific to logical inputs.
raw_input | The raw Notcurses input |
Definition at line 62 of file input_handler.c.