Sha256: 7479171bf33b6e0e7aa10e088e76ae430b1f4453d8564a87f2d5bf0551d53542

Contents?: true

Size: 855 Bytes

Versions: 4

Compression:

Stored size: 855 Bytes

Contents

#include "say.h"

static bool say_input_is_key_in_range(say_key key) {
  return key > SAY_KEY_UNKNOWN && key < SAY_KEY_COUNT;
}

uint8_t say_input_is_holding(say_input *input, say_key key) {
  if (say_input_is_key_in_range(key))
    return input->keys[key - 1];
  else
    return 0;
}

say_vector2 say_input_get_mouse_pos(say_input *input) {
  return input->mouse_pos;
}

void say_input_reset(say_input *input) {
  memset(&input->keys, 0, sizeof(input->keys));
  input->mouse_pos = say_make_vector2(0, 0);
}

void say_input_press(say_input *input, say_key key) {
  if (say_input_is_key_in_range(key))
    input->keys[key - 1] = 1;
}

void say_input_release(say_input *input, say_key key) {
  if (say_input_is_key_in_range(key))
    input->keys[key - 1] = 0;
}

void say_input_set_mouse_pos(say_input *input, say_vector2 pos) {
  input->mouse_pos = pos;
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ray-0.2.1 ext/say_input.c
ray-0.2.0 ext/say_input.c
ray-0.1.1 ext/say_input.c
ray-0.1.0 ext/say_input.c