Beispiel #1
0
void		load_menu(void)
{
  update_background();
  rect_pos(&game.rect, 90, 100, 0, 0);
  SDL_BlitSurface(obj.ttitle, NULL, game.screen, &game.rect);
  rect_pos(&game.rect, 70, 280, 0, 0);
  SDL_BlitSurface((kmenu.j == 1?obj.tsplay:obj.tplay), NULL, game.screen, &game.rect);
  rect_pos(&game.rect, 70, 380, 0, 0);
  SDL_BlitSurface((kmenu.j == -1?obj.tscredit:obj.tcredit), NULL, game.screen, &game.rect);
  rect_pos(&game.rect, 100, 480, 0, 0);
  SDL_BlitSurface(obj.texit, NULL, game.screen, &game.rect);
  draw();
}
enum piglit_result
draw(Display *dpy)
{
	int i;
	bool pass = true;

	/* draw a series of colored quads, one per context, at increasing
	 * Z distance.
	 */
	for (i = 0; i < num_contexts; i++) {
		glXMakeCurrent(dpy, win, ctx[i]);

		if (i == 0) {
			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		}

		glEnable(GL_DEPTH_TEST);
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		glOrtho(0, piglit_width, 0, piglit_height, 0, 1);

		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();

		glPushMatrix();
		float p = rect_pos(i);
		float z = -i / 10.0;
		glTranslatef(p, p, z);

		glColor4fv(colors[i]);
		piglit_draw_rect(0, 0, rect_size, rect_size);

		glPopMatrix();
	}

	/* probe rendering */
	glXMakeCurrent(dpy, win, ctx[0]);
	for (i = 0; i < num_contexts; i++) {
		int x = rect_pos(i) + rect_size * 3 / 4;
		int p = piglit_probe_pixel_rgb(x, x, colors[i]);

		if (!p) {
			printf("Failed probe for rect/context %d\n", i);
			pass = false;
		}
	}

	glXSwapBuffers(dpy, win);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Beispiel #3
0
void		load_intro(void)
{
  unsigned int	i;

  i = 0;
  while (i < 1000)
    {
      rect_pos(&game.rect, 0, 0, WW, WH);
      SDL_FillRect(game.screen, &game.rect, SDL_MapRGB(game.screen->format, 7, 82, 7));
      rect_pos(&game.rect, 0, 0, 0, 0);
      SDL_BlitSurface(obj.intro, NULL, game.screen, &game.rect);
      rect_pos(&game.rect, 250, 170, 0, 0);
      SDL_BlitSurface(obj.logo, NULL, game.screen, &game.rect);
      draw();
      i++;
    }
}
Beispiel #4
0
PopupMenuWindow::PopupMenuWindow(const PopupMenu &menu, const Point &screen_position, GUIComponent *owner)
: GUIComponent(owner, create_toplevel_description(), CssStr::PopupMenuWindow::type_name),
  menu(menu), selected(-1)
{
	set_class(menu.get_class(), true);

	create_parts();

	Rect rect_pos(screen_position, calc_desired_size());
	set_window_geometry(rect_pos);
	set_visible(true, false);

	func_close().set(this, &PopupMenuWindow::on_close);
}