コード例 #1
0
//x1:start_of_stop_line_x
//center_to_road
void draw_road(int road_index,int x1, int y1, int road_width,int center_to_road, int n_lines, int ratio, CDC* pDC) {
	/*			(x4,y4)
	*			 /	
	*			/	(600,y3)
	*		(x1,y1)	  /
	*			\	 /b
	*		   a \  /
	*			(x2,y2)
	*
	*/
	int x2 = x1 + road_width*sin(ratio/RAD);
	int y2 = y1-road_width*cos(ratio/RAD);
	int y3 = get_y3(y2,MAIN_RECT_WIDTH,ratio);
	int x4 = x1+(MAIN_RECT_WIDTH-x1)*sin((ratio-90)/RAD);
	int x5 = get_x5(x1,STOP_LINE,ratio);
	int y5 = get_y5(y1,STOP_LINE,ratio);

	CPen road_pen(PS_SOLID,2,RGB(0,0,0));
	auto old_pen = pDC->SelectObject(road_pen);
	pDC->MoveTo(x1,y1);
	pDC->MoveTo(x2,y2);
	pDC->LineTo(get_x3(x2,MAIN_RECT_WIDTH,ratio),y3);
	pDC->MoveTo(x1,y1);
	pDC->LineTo(x4, get_y4(y1,MAIN_RECT_WIDTH,ratio));
	pDC->SelectObject(old_pen);
	draw_back_lines(GLOBAL_EMU->cross()->road_at(road_index),x5,y5,ratio,pDC);
	draw_stop_line(x1,y1,center_to_road,road_width,n_lines,ratio,pDC);
	draw_lights(GLOBAL_EMU->cross()->road_at(road_index),x5,y5,ratio,pDC);

	draw_vehicles(GLOBAL_EMU->cross()->road_at(road_index),x5,y5,ratio,pDC);
}
コード例 #2
0
ファイル: draw.c プロジェクト: bear24rw/EECE6017
void draw_reset(void) 
{
    clear_screen();
    draw_frame(); 
    draw_keymap();
    draw_street();
    draw_walk(RED);
    draw_lights();
    hide_cursor();
}
コード例 #3
0
ファイル: draw.c プロジェクト: colinbouvry/minuit
void draw_scene(t_draw *draw, t_scene *scene)
{
	// Edit Mode
	if(scene->edit_mode) draw->edit_mode = 1;
	else draw->edit_mode = 0;

	// Objects
	draw_lights(draw,scene);
	draw_objects(draw,scene);
	draw_axis_world(draw);
}
コード例 #4
0
void
draw_preview_image (gint docompute)
{
  gint startx, starty, pw, ph;
  GdkColor  color;

  color.red   = 0x0;
  color.green = 0x0;
  color.blue  = 0x0;
  gdk_gc_set_rgb_bg_color (gc, &color);

  color.red   = 0xFFFF;
  color.green = 0xFFFF;
  color.blue  = 0xFFFF;
  gdk_gc_set_rgb_fg_color (gc, &color);

  gdk_gc_set_function (gc, GDK_COPY);
  linetab[0].x1 = -1;

  pw = PREVIEW_WIDTH * mapvals.zoom;
  ph = PREVIEW_HEIGHT * mapvals.zoom;
  startx = (PREVIEW_WIDTH - pw) / 2;
  starty = (PREVIEW_HEIGHT - ph) / 2;

  if (docompute == TRUE)
    {
      GdkDisplay *display = gtk_widget_get_display (previewarea);
      GdkCursor  *cursor;

      cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
      gdk_window_set_cursor (previewarea->window, cursor);
      gdk_cursor_unref (cursor);

      compute_preview (0, 0, width - 1, height - 1, pw, ph);

      cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
      gdk_window_set_cursor(previewarea->window, cursor);
      gdk_cursor_unref (cursor);

      clear_light_marker ();
    }

  if (pw != PREVIEW_WIDTH || ph != PREVIEW_HEIGHT)
    gdk_window_clear (previewarea->window);

  gdk_draw_rgb_image (previewarea->window, gc,
                      startx, starty, pw, ph,
                      GDK_RGB_DITHER_MAX,
                      preview_rgb_data, 3 * pw);

  draw_lights (startx, starty, pw, ph);
}
コード例 #5
0
void
update_light (gint xpos,
	      gint ypos)
{
  gint    startx, starty, pw, ph;

  pw     = PREVIEW_WIDTH * mapvals.zoom;
  ph     = PREVIEW_HEIGHT * mapvals.zoom;
  startx = (PREVIEW_WIDTH  - pw) / 2;
  starty = (PREVIEW_HEIGHT - ph) / 2;

  gimp_vector_2d_to_3d (startx, starty, pw, ph, xpos, ypos,
			&mapvals.viewpoint, &mapvals.lightsource.position);
  draw_lights (startx, starty,pw, ph);
}
コード例 #6
0
ファイル: cloudlayer.c プロジェクト: xtmacbook/SGI
void display(void) {
    glClear(GL_COLOR_BUFFER_BIT);

    glPushMatrix();
    glTranslatef(transx, transy, 0.f);
    glRotatef(rotx, 0., 1., 0.);
    glRotatef(roty, 1., 0., 0.);
    glScalef(10,1,10);
    glTranslatef(0.f,-1.f,0.f);
    draw_base();
    draw_runway();
    draw_lights();
    draw_clouds();
    glPopMatrix();
    glutSwapBuffers();
}
コード例 #7
0
ファイル: adrift.cpp プロジェクト: nornagon/torch
void handler() {
	process_keys();
	update_projectiles();
	update_animations();
	step_monsters();

	game.player.light->update_flicker();
	process_sight();
	draw_lights(game.fov_light, &game.map.block, game.map.lights);
	{
		lightsource *k = game.map.lights.head();
		for (; k; k = k->next()) {
			k->update_flicker();
			draw_light(game.fov_light, &game.map.block, k);
		}
	}

	u32 keys = keysHeld();
	u32 down = keysDown();
	touchPosition touch = touchReadXY();
	if (down & KEY_TOUCH && keys & KEY_R && touch.px != 0 && touch.py != 0) {
		luxel *l = torch.buf.luxat(torch.buf.scroll.x + touch.px/8, torch.buf.scroll.y + touch.py/8);
		iprintf("c:%d,%d,%d v:%d, low:%d\n", l->lr, l->lg, l->lb, l->lval, torch.get_low_luminance());
	}

	refresh(&game.map.block);

	if (game.player.hp <= 0) {
		playerdeath();
		game.player.clear();
		new_game();
	}

	if (game.cooldown <= 0) game.player.regenerate();

	statusbar();
}