public override bool HandleEvent(GUIEvent guiEvent) { bool handled = false; if (guiEvent is GUIEventMouseButtonPressed) { chk = !chk; handled = true; } else if (guiEvent is GUIEventKeyPressed) { GUIEventKeyPressed guiEventKey = (GUIEventKeyPressed)guiEvent; if (guiEventKey.key == Sdl.SDLK_SPACE || guiEventKey.key == Sdl.SDLK_RETURN) { chk = !chk; handled = true; } else if (guiEventKey.key == Sdl.SDLK_DOWN) { Father.FocusNextChild(); handled = true; } else if (guiEventKey.key == Sdl.SDLK_UP) { Father.FocusPreviusChild(); handled = true; } } return(handled); }
public override bool HandleEvent(GUIEvent guiEvent) { bool handled = false; if (guiEvent is GUIEventKeyPressed) { GUIEventKeyPressed guiEventKey = (GUIEventKeyPressed)guiEvent; if (guiEventKey.key == Sdl.SDLK_LEFT || guiEventKey.key == Sdl.SDLK_MINUS) { value -= stepValue; value = (float)(Math.Round(value * 1000.0f) / 1000.0f); if (value < minValue) { value = minValue; } handled = true; } else if (guiEventKey.key == Sdl.SDLK_RIGHT || guiEventKey.key == Sdl.SDLK_PLUS) { value += stepValue; value = (float)(Math.Round(value * 1000.0f) / 1000.0f); if (value > maxValue) { value = maxValue; } handled = true; } else if (guiEventKey.key == Sdl.SDLK_DOWN) { Father.FocusNextChild(); handled = true; } else if (guiEventKey.key == Sdl.SDLK_UP) { Father.FocusPreviusChild(); handled = true; } } return(handled); }
public override bool HandleEvent(GUIEvent guiEvent) { bool handled = false; if (guiEvent is GUIEventKeyPressed) { GUIEventKeyPressed guiEventKey = (GUIEventKeyPressed)guiEvent; if (guiEventKey.key == Sdl.SDLK_LEFT) { selectedIndex--; if (selectedIndex < 0) { selectedIndex = items.Length - 1; } handled = true; } else if (guiEventKey.key == Sdl.SDLK_RIGHT) { selectedIndex++; if (selectedIndex >= items.Length) { selectedIndex = 0; } handled = true; } else if (guiEventKey.key == Sdl.SDLK_DOWN) { Father.FocusNextChild(); handled = true; } else if (guiEventKey.key == Sdl.SDLK_UP) { Father.FocusPreviusChild(); handled = true; } } return(handled); }
public override bool HandleEvent(GUIEvent guiEvent) { bool handled = false; bool pressed = false; if (guiEvent is GUIEventMouseButtonPressed) { pressed = true; handled = true; } else if (guiEvent is GUIEventMouseButtonReleased) { handled = true; } else if (guiEvent is GUIEventMouseMoved) { handled = true; GUIEventMouseMoved g = (GUIEventMouseMoved)guiEvent; if (pressed == true) { if (g.position.X < 0 || g.position.Y < 0 || g.position.X >= Size.Width || g.position.Y >= Size.Height) { pressed = false; } } } else if (guiEvent is GUIEventKeyPressed) { GUIEventKeyPressed guiEventKey = (GUIEventKeyPressed)guiEvent; if (guiEventKey.key == Sdl.SDLK_DOWN || guiEventKey.key == Sdl.SDLK_RIGHT) { Father.FocusNextChild(); handled = true; } else if (guiEventKey.key == Sdl.SDLK_UP || guiEventKey.key == Sdl.SDLK_LEFT) { Father.FocusPreviusChild(); handled = true; } } else if (guiEvent is GUIEventKeyReleased) { GUIEventKeyReleased guiEventKey = (GUIEventKeyReleased)guiEvent; if (guiEventKey.key == Sdl.SDLK_SPACE || guiEventKey.key == Sdl.SDLK_RETURN) { pressed = true; handled = true; } } if (pressed) { if (ButtonPressed != null) { ButtonPressed(this); } } return(handled); }