parent
0a94971f1a
commit
ab357ea120
|
|
@ -43,7 +43,10 @@ TinySDLGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
|
|||
_pitch = 0;
|
||||
update_pixel_factor();
|
||||
|
||||
add_input_device(GraphicsWindowInputDevice::pointer_and_keyboard(this, "keyboard_mouse"));
|
||||
PT(GraphicsWindowInputDevice) device =
|
||||
GraphicsWindowInputDevice::pointer_and_keyboard(this, "keyboard_mouse");
|
||||
add_input_device(device);
|
||||
_input = device.p();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -166,35 +169,35 @@ process_events() {
|
|||
switch(evt.type) {
|
||||
case SDL_KEYDOWN:
|
||||
if (evt.key.keysym.unicode) {
|
||||
_input_devices[0]->keystroke(evt.key.keysym.unicode);
|
||||
_input->keystroke(evt.key.keysym.unicode);
|
||||
}
|
||||
button = get_keyboard_button(evt.key.keysym.sym);
|
||||
if (button != ButtonHandle::none()) {
|
||||
_input_devices[0]->button_down(button);
|
||||
_input->button_down(button);
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_KEYUP:
|
||||
button = get_keyboard_button(evt.key.keysym.sym);
|
||||
if (button != ButtonHandle::none()) {
|
||||
_input_devices[0]->button_up(button);
|
||||
_input->button_up(button);
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
button = get_mouse_button(evt.button.button);
|
||||
_input_devices[0]->set_pointer_in_window(evt.button.x, evt.button.y);
|
||||
_input_devices[0]->button_down(button);
|
||||
_input->set_pointer_in_window(evt.button.x, evt.button.y);
|
||||
_input->button_down(button);
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
button = get_mouse_button(evt.button.button);
|
||||
_input_devices[0]->set_pointer_in_window(evt.button.x, evt.button.y);
|
||||
_input_devices[0]->button_up(button);
|
||||
_input->set_pointer_in_window(evt.button.x, evt.button.y);
|
||||
_input->button_up(button);
|
||||
break;
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
_input_devices[0]->set_pointer_in_window(evt.motion.x, evt.motion.y);
|
||||
_input->set_pointer_in_window(evt.motion.x, evt.motion.y);
|
||||
break;
|
||||
|
||||
case SDL_VIDEORESIZE:
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ private:
|
|||
unsigned int _flags;
|
||||
unsigned int _pitch;
|
||||
|
||||
GraphicsWindowInputDevice *_input;
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
|
|
|
|||
Loading…
Reference in New Issue