Beispiel #1
0
void
set_mouse_pos (struct pos *p)
{
  struct mouse_coord m;

  struct pos np; npos (p, &np);

  m.mr.w = mr.w;
  m.mr.h = mr.h;
  m.mr.room = mr.room = np.room;

  con_m (&np, &m.c);

  int x, y;
  if (! mr_coord (np.room, -1, &x, &y)) {
    mr_center_room (np.room);
    x = mr.x;
    y = mr.y;
  }

  m.mr.x = mr.x = x;
  m.mr.y = mr.y = y;

  set_mouse_coord (&m);
}
Beispiel #2
0
bool
ui_set_multi_room (int dw, int dh)
{
  char *text;

  if (mr.w + dw < 1 || mr.h + dh < 1) {
    xasprintf (&text, "MULTI-ROOM %ix%i", mr.w, mr.h);
    draw_bottom_text (NULL, text, 0);
    al_free (text);
    return false;
  }

  struct mouse_coord m;
  get_mouse_coord (&m);

  if (mr.w + dw != mr.w || mr.h + dh != mr.h)
    set_multi_room (mr.w + dw, mr.h + dh);

  mr_center_room (mr.room);

  if (mr_coord (m.c.room, -1, NULL, NULL))
    set_mouse_coord (&m);

  xasprintf (&text, "MULTI-ROOM %ix%i", mr.w, mr.h);
  draw_bottom_text (NULL, text, 0);
  al_free (text);
  return true;
}
Beispiel #3
0
void
set_mouse_room (int room)
{
  struct mouse_coord m;

  int x, y;
  if (mr_coord (room, -1, &x, &y))
    mr_set_origin (room, x, y);

  mr_save_origin (&m.mr);
  new_coord (&m.c, &global_level, room, ORIGINAL_WIDTH / 2, ORIGINAL_HEIGHT / 2);
  set_mouse_coord (&m);

  if (! room) {
    mr_center_room (0);
    mr.select_cycles = 0;
    int w = al_get_display_width (display);
    int h = al_get_display_height (display);
    al_set_mouse_xy (display, w / 2, h / 2);
  }
}