Example #1
0
void CPaused::Loop(float time_step) {
	CControl *ctrl = g_game.player->ctrl;
	int width = Winsys.resolution.width;
	int height = Winsys.resolution.height;

	ClearRenderContext();
	Env.SetupFog();
	update_view(ctrl, 0);
	SetupViewFrustum(ctrl);

	if (sky) Env.DrawSkybox(ctrl->viewpos);
	if (fog) Env.DrawFog();
	Env.SetupLight();
	if (terr) RenderCourse();
	DrawTrackmarks();
	if (trees) DrawTrees();

	DrawSnow(ctrl);

	if (param.perf_level > 2) draw_particles(ctrl);
	g_game.character->shape->Draw();

	DrawHud(ctrl);
	Reshape(width, height);
	Winsys.SwapBuffers();
}
Example #2
0
int main() {
    SDL_Surface* f;
    int couleur;
    int ordre;
    int wight = 300;
    int hight = 100;

    /* Initialisation de la bibliotheque video  */
    /* Creation d'une fenetre de dimension dimx x dimy, couleurs sur 32 bits */
    f=newfenetregraphique(wight,hight);
    if ( f== NULL) { printf("Impossible d'ouvrir la fenetre d'(affichageƵ"); exit(1);}
    couleur= 0; /*0xff0000FF;*/
    /*Draw_Line(f,10,0,300,50,couleur);*/
    /*SDL_Flip(f);*/


    printf ("ordre ? ");
    scanf ("%d", &ordre);

    printf ("couleur ? ");
    scanf ("%d", &couleur);
    DrawVanKoch (ordre, f, couleur, wight, hight);

    printf ("couleur ? ");
    scanf ("%d", &couleur);
    DrawSnow (ordre, f, couleur, wight, hight);


    getchar();

    return 0;
}
Example #3
0
void racing_loop (double time_step){
    CControl *ctrl = Players.GetCtrl (g_game.player_id);
	double ycoord = Course.FindYCoord (ctrl->cpos.x, ctrl->cpos.z);
	bool airborne = (bool) (ctrl->cpos.y > (ycoord + JUMP_MAX_START_HEIGHT));

    check_gl_error();
    ClearRenderContext ();
	Env.SetupFog ();
	Music.Update ();    

	CalcTrickControls (ctrl, time_step, airborne);

	if (!g_game.finish) CalcSteeringControls (ctrl, time_step);
		else CalcFinishControls (ctrl, time_step, airborne);
	PlayTerrainSound (ctrl, airborne);

//  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	ctrl->UpdatePlayerPos (time_step); 
//  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

	if (g_game.finish) IncCameraDistance (time_step);
	update_view (ctrl, time_step);
	UpdateTrackmarks (ctrl);

    SetupViewFrustum (ctrl);
	if (sky) Env.DrawSkybox (ctrl->viewpos);
	if (fog) Env.DrawFog ();
	void SetupLight ();
	if (terr) RenderCourse ();
	DrawTrackmarks ();
	if (trees) DrawTrees ();
	if (param.perf_level > 2) {
		update_particles (time_step);
		draw_particles (ctrl);
    }
	Char.Draw (g_game.char_id);
	UpdateWind (time_step, ctrl);
	UpdateSnow (time_step, ctrl);
	DrawSnow (ctrl);
	DrawHud (ctrl);
	
	Reshape (param.x_resolution, param.y_resolution);
    Winsys.SwapBuffers ();
	if (g_game.finish == false) g_game.time += time_step;
} 
Example #4
0
void GameOverLoop (double time_step) {
    CControl *ctrl = Players.GetCtrl (g_game.player_id);
    int width, height;
    width = param.x_resolution;
    height = param.y_resolution;
    check_gl_error();

    Music.Update ();

    ClearRenderContext ();
    Env.SetupFog ();

    update_view (ctrl, 0);

    if (final_frame != NULL) final_frame->Update (time_step, ctrl);

    SetupViewFrustum (ctrl);
    Env.DrawSkybox (ctrl->viewpos);
    Env.DrawFog ();
    Env.SetupLight ();

    RenderCourse ();
    DrawTrackmarks ();
    DrawTrees ();

    UpdateWind (time_step, ctrl);
    UpdateSnow (time_step, ctrl);
    DrawSnow (ctrl);

    Char.Draw (g_game.char_id);

    set_gl_options (GUI);
    SetupGuiDisplay ();
    if (final_frame != NULL) {
        if (!final_frame->active) GameOverMessage (ctrl);
    } else GameOverMessage (ctrl);
    DrawHud (ctrl);
    Reshape (width, height);
    Winsys.SwapBuffers ();
}
Example #5
0
void Game_Screen::Update() {
	if (data.tint_time_left > 0) {
		data.tint_current_red = interpolate(data.tint_time_left, data.tint_current_red, data.tint_finish_red);
		data.tint_current_green = interpolate(data.tint_time_left, data.tint_current_green, data.tint_finish_green);
		data.tint_current_blue = interpolate(data.tint_time_left, data.tint_current_blue, data.tint_finish_blue);
		data.tint_current_sat = interpolate(data.tint_time_left, data.tint_current_sat, data.tint_finish_sat);
		data.tint_time_left--;
	}

	if (data.flash_time_left > 0) {
		data.flash_current_level = interpolate(data.flash_time_left, data.flash_current_level / 31, 0);
		data.flash_time_left--;
		if (data.flash_time_left <= 0)
			data.flash_time_left = data.flash_continuous ? flash_period : 0;
	}

    if (data.shake_continuous || data.shake_time_left > 0 || data.shake_position != 0) {
		double delta = (data.shake_strength * data.shake_speed * shake_direction) / 10.0;
		if (data.shake_time_left <= 1 && data.shake_position * (data.shake_position + delta) < 0)
			data.shake_position = 0;
		else
			data.shake_position += delta;
		if (data.shake_position > data.shake_strength * 2)
			shake_direction = -1;
		if (data.shake_position < -data.shake_strength * 2)
			shake_direction = 1;

		if (data.shake_time_left > 0)
			data.shake_time_left--;
	}

	std::vector<EASYRPG_SHARED_PTR<Picture> >::const_iterator it;
	for (it = pictures.begin(); it != pictures.end(); it++) {
		if(*it) { (*it)->Update(); }
	}

	if (!movie_filename.empty()) {
		/* update movie */
	}

	switch (data.weather) {
		case Weather_None:
			break;
		case Weather_Rain:
			InitWeather();
			InitSnowRain();
			UpdateSnowRain(4);
			DrawRain();
			break;
		case Weather_Snow:
			InitWeather();
			InitSnowRain();
			UpdateSnowRain(2);
			DrawSnow();
			break;
		case Weather_Fog:
			InitWeather();
			DrawFog();
			break;
		case Weather_Sandstorm:
			InitWeather();
			DrawSandstorm();
			break;
	}

	if (animation != NULL) {
		animation->Update();
		if (animation->IsDone()) {
			animation.reset();
		}
	}
}