keyboard.hh 868 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/*
 * keyboard.hh
 *
 *  Created on: 27/03/2015
 *      Author: raster
 */

#ifndef SRC_KEYBOARD_HH_
#define SRC_KEYBOARD_HH_

#include <inttypes.h>
12
#include <SDL2/SDL.h>
13

14 15 16 17 18 19
enum JOYSTICK_TYPE {
	JOYSTICK_CURSOR,
	JOYSTICK_KEMPSTON,
	JOYSTICK_SINCLAIR1,
	JOYSTICK_SINCLAIR2
};
20

21 22 23
class Keyboard {
	// keyboard private global variables

24
	uint8_t k8, k9, k10, k11, k12, k13, k14, k15;
25 26 27 28 29 30 31 32 33 34 35
	uint8_t readed;

	// kempston joystick private global variables

	uint8_t jk;

public:
	Keyboard();
	void reset();
	void read_keyboard(SDL_Event *);

36
	uint8_t s8, s9, s10, s11, s12, s13, s14, s15;
37
	uint8_t js;
38
	enum JOYSTICK_TYPE joystick; // 0=cursor, 1=kempston, 2=sinclair1, 3=sinclair2
39 40 41 42 43
	int32_t mouse_x;
	int32_t mouse_y;
	bool mouse_left;
	bool mouse_center;
	bool mouse_right;
44 45 46 47 48 49 50
	bool tab_extended;
	bool esc_again;
};

extern class Keyboard *keyboard;

#endif /* SRC_KEYBOARD_HH_ */