当前位置: 首页>>代码示例>>C++>>正文


C++ CControl::Init方法代码示例

本文整理汇总了C++中CControl::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ CControl::Init方法的具体用法?C++ CControl::Init怎么用?C++ CControl::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CControl的用法示例。


在下文中一共展示了CControl::Init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Enter

// ---------------------------- init ----------------------------------
void CRacing::Enter (void) {
    CControl *ctrl = Players.GetCtrl (g_game.player_id);

    if (param.view_mode < 0 || param.view_mode >= NUM_VIEW_MODES) {
		param.view_mode = ABOVE;
    }
    set_view_mode (ctrl, (TViewMode)param.view_mode);
    left_turn = right_turn = trick_modifier = false;

    ctrl->turn_fact = 0.0;
    ctrl->turn_animation = 0.0;
    ctrl->is_braking = false;
    ctrl->is_paddling = false;
    ctrl->jumping = false;
    ctrl->jump_charging = false;

	lastsound = -1;
	newsound = -1;

	if (State::manager.PreviousState() != &Paused) ctrl->Init ();
    g_game.raceaborted = false;

	SetSoundVolumes ();
	Music.PlayTheme (g_game.theme_id, MUS_RACING);

	g_game.finish = false;
}
开发者ID:ktan2020,项目名称:extremetuxracer-win32,代码行数:28,代码来源:racing.cpp

示例2: racing_init

// ---------------------------- init ----------------------------------
void racing_init (void) {
    CControl *ctrl = Players.GetCtrl (g_game.player_id);

    if (param.view_mode < 0 || param.view_mode >= NUM_VIEW_MODES) {
		param.view_mode = ABOVE;
    }
    set_view_mode (ctrl, (TViewMode)param.view_mode);
    left_turn = right_turn = trick_modifier = false;

    ctrl->turn_fact = 0.0;
    ctrl->turn_animation = 0.0;
    ctrl->is_braking = false;
    ctrl->is_paddling = false;
    ctrl->jumping = false;
    ctrl->jump_charging = false;

	lastsound = -1;
	newsound = -1;

    if (g_game.prev_mode != PAUSED) ctrl->Init ();
    g_game.raceaborted = false;

	SetSoundVolumes ();
	Music.PlayTheme (g_game.theme_id, MUS_RACING);
	
	g_game.fps = 0;
	g_game.timesteps = 0;
	g_game.finish = false;
}
开发者ID:cdlewis,项目名称:extremetuxracer,代码行数:30,代码来源:racing.cpp

示例3: Loop

void CReset::Loop(double time_step) {
	CControl *ctrl = Players.GetCtrl (g_game.player_id);
    double elapsed_time = Winsys.ClockTime () - reset_start_time;
    static bool tux_visible = true;
    static int tux_visible_count = 0;

    check_gl_error();
	ClearRenderContext ();
    Env.SetupFog ();
    ctrl->UpdatePlayerPos (EPS);
    update_view (ctrl, EPS);
    SetupViewFrustum (ctrl);
    Env.DrawSkybox (ctrl->viewpos);
    Env.DrawFog ();
	Env.SetupLight ();	// and fog
    RenderCourse();
    DrawTrackmarks ();
    DrawTrees ();

    if ((elapsed_time > BLINK_IN_PLACE_TIME) && (!position_reset)) {
		TObjectType* object_types = &Course.ObjTypes[0];
		TItem* item_locs  = &Course.NocollArr[0];
		size_t num_item_types = Course.ObjTypes.size();
		size_t first_reset = 0;
		size_t last_reset = 0;
		for (size_t i = 0; i < num_item_types; i++) {
		    if (object_types[i].reset_point == true) {
				last_reset = first_reset + object_types[i].num_items - 1;
				break;
		    } else {
				first_reset += object_types[i].num_items;
		    }
		} // for

		if (last_reset == 0) {
		    ctrl->cpos.x = Course.GetDimensions().x/2.0;
		    ctrl->cpos.z = min(ctrl->cpos.z + 10, -1.0);
		} else {
			int best_loc = -1;
		    for (size_t i = first_reset; i <= last_reset; i++) {
				if (item_locs[i].pt.z > ctrl->cpos.z) {
				    if (best_loc == -1 || item_locs[i].pt.z < item_locs[best_loc].pt.z) {
						best_loc = (int)i;
				    } // if
				} // if
		    } // for

		    if (best_loc == -1) {
				ctrl->cpos.x = Course.GetDimensions().x/2.0;
				ctrl->cpos.z = min (ctrl->cpos.z + 10, -1.0);
		    } else if (item_locs[best_loc].pt.z <= ctrl->cpos.z) {
				ctrl->cpos.x = Course.GetDimensions().x/2.0;
				ctrl->cpos.z = min (ctrl->cpos.z + 10, -1.0);
		    } else {
				ctrl->cpos.x = item_locs[best_loc].pt.x;
				ctrl->cpos.z = item_locs[best_loc].pt.z;
		    } // if
		}

		ctrl->view_init = false;
		ctrl->Init ();
		position_reset = true;
    } // if elapsed time

    if (tux_visible) Char.Draw (g_game.char_id);

    if (++tux_visible_count > 3) {
		tux_visible = (bool) !tux_visible;
		tux_visible_count = 0;
    }

    DrawHud (ctrl);
	Reshape (Winsys.resolution.width, Winsys.resolution.height);
    Winsys.SwapBuffers ();
    g_game.time += time_step;

    if (elapsed_time > TOTAL_RESET_TIME) {
		State::manager.RequestEnterState (Racing);
    }
}
开发者ID:ktan2020,项目名称:extremetuxracer-win32,代码行数:80,代码来源:reset.cpp


注:本文中的CControl::Init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。