Exemplo n.º 1
0
static void
btn(struct zr_input *in, SDL_Event *evt, zr_bool down)
{
    const zr_int x = evt->button.x;
    const zr_int y = evt->button.y;
    if (evt->button.button == SDL_BUTTON_LEFT)
        zr_input_button(in, ZR_BUTTON_LEFT, x, y, down);
    else if (evt->button.button == SDL_BUTTON_LEFT)
        zr_input_button(in, ZR_BUTTON_RIGHT, x, y, down);
}
Exemplo n.º 2
0
static void zrmenu_input_mouse_button(struct zr_context *ctx)
{
   int16_t mouse_x = menu_input_mouse_state(MENU_MOUSE_X_AXIS);
   int16_t mouse_y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS);

   zr_input_button(ctx, ZR_BUTTON_LEFT,
         mouse_x, mouse_y, menu_input_mouse_state(MENU_MOUSE_LEFT_BUTTON));
   zr_input_button(ctx, ZR_BUTTON_RIGHT,
         mouse_x, mouse_y, menu_input_mouse_state(MENU_MOUSE_RIGHT_BUTTON));
}
Exemplo n.º 3
0
static void
btn(struct zr_input *in, XEvent *evt, zr_bool down)
{
    const zr_int x = evt->xbutton.x;
    const zr_int y = evt->xbutton.y;
    if (evt->xbutton.button == Button1)
        zr_input_button(in, ZR_BUTTON_LEFT, x, y, down);
    else if (evt->xbutton.button == Button3)
        zr_input_button(in, ZR_BUTTON_RIGHT, x, y, down);
    else if (evt->xbutton.button == Button4)
        zr_input_scroll(in, 1.0f);
    else if (evt->xbutton.button == Button5)
        zr_input_scroll(in, -1.0f);
}
Exemplo n.º 4
0
static void
btn(struct zr_input *in, MSG *msg, zr_bool down)
{
    const zr_int x = GET_X_LPARAM(msg->lParam);
    const zr_int y = GET_Y_LPARAM(msg->lParam);
    zr_input_button(in, ZR_BUTTON_LEFT, x, y, down);
}