• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ MarkWholeScreenDirty函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MarkWholeScreenDirty函数的典型用法代码示例。如果您正苦于以下问题:C++ MarkWholeScreenDirty函数的具体用法?C++ MarkWholeScreenDirty怎么用?C++ MarkWholeScreenDirty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: OnClick

	virtual void OnClick(Point pt, int widget, int click_count)
	{
		if (widget >= WID_TT_BEGIN && widget < WID_TT_END) {
			if (_ctrl_pressed) {
				/* toggle the bit of the transparencies lock variable */
				ToggleTransparencyLock((TransparencyOption)(widget - WID_TT_BEGIN));
				this->SetDirty();
			} else {
				/* toggle the bit of the transparencies variable and play a sound */
				ToggleTransparency((TransparencyOption)(widget - WID_TT_BEGIN));
				if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
				MarkWholeScreenDirty();
			}
		} else if (widget == WID_TT_BUTTONS) {
			uint i;
			for (i = WID_TT_BEGIN; i < WID_TT_END; i++) {
				const NWidgetBase *nwid = this->GetWidget<NWidgetBase>(i);
				if (IsInsideBS(pt.x, nwid->pos_x, nwid->current_x)) {
					break;
				}
			}
			if (i == WID_TT_LOADING || i == WID_TT_END) return;

			ToggleInvisibility((TransparencyOption)(i - WID_TT_BEGIN));
			if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);

			/* Redraw whole screen only if transparency is set */
			if (IsTransparencySet((TransparencyOption)(i - WID_TT_BEGIN))) {
				MarkWholeScreenDirty();
			} else {
				this->SetWidgetDirty(WID_TT_BUTTONS);
			}
		}
	}
开发者ID:CliffsDover,项目名称:openttd-android,代码行数:34,代码来源:transparency_gui.cpp


示例2: CmdRenamePresident

/**
 * Change the name of the president.
 * @param tile unused
 * @param flags operation to perform
 * @param p1 unused
 * @param p2 unused
 * @param text the new name or an empty string when resetting to the default
 * @return the cost of this operation or an error
 */
CommandCost CmdRenamePresident(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
	bool reset = StrEmpty(text);

	if (!reset) {
		if (Utf8StringLength(text) >= MAX_LENGTH_PRESIDENT_NAME_CHARS) return CMD_ERROR;
		if (!IsUniquePresidentName(text)) return_cmd_error(STR_ERROR_NAME_MUST_BE_UNIQUE);
	}

	if (flags & DC_EXEC) {
		Company *c = Company::Get(_current_company);
		free(c->president_name);

		if (reset) {
			c->president_name = NULL;
		} else {
			c->president_name = strdup(text);

			if (c->name_1 == STR_SV_UNNAMED && c->name == NULL) {
				char buf[80];

				snprintf(buf, lengthof(buf), "%s Transport", text);
				DoCommand(0, 0, 0, DC_EXEC, CMD_RENAME_COMPANY, buf);
			}
		}

		MarkWholeScreenDirty();
		CompanyAdminUpdate(c);
	}

	return CommandCost();
}
开发者ID:habnabit,项目名称:openttd-cargodist,代码行数:41,代码来源:company_cmd.cpp


示例3: OnClick

	virtual void OnClick(Point pt, int widget, int click_count)
	{
		switch (widget) {
			case WID_BT_TYPE_11: case WID_BT_TYPE_12: case WID_BT_TYPE_13: case WID_BT_TYPE_14:
			case WID_BT_TYPE_21: case WID_BT_TYPE_22: case WID_BT_TYPE_23: case WID_BT_TYPE_24:
			case WID_BT_TYPE_31: case WID_BT_TYPE_32: case WID_BT_TYPE_33: case WID_BT_TYPE_34:
				if (widget - WID_BT_TYPE_11 >= this->count) break;

				if (HandlePlacePushButton(this, widget, SPR_CURSOR_TREE, HT_RECT)) {
					this->tree_to_plant = (TreeType)(this->base + widget - WID_BT_TYPE_11);
				}
				break;

			case WID_BT_TYPE_RANDOM: // tree of random type.
				if (HandlePlacePushButton(this, WID_BT_TYPE_RANDOM, SPR_CURSOR_TREE, HT_RECT)) {
					this->tree_to_plant = TREE_INVALID;
				}
				break;

			case WID_BT_MANY_RANDOM: // place trees randomly over the landscape
				if (_settings_client.sound.confirm) SndPlayFx(SND_15_BEEP);
				PlaceTreesRandomly();
				MarkWholeScreenDirty();
				break;
		}
	}
开发者ID:fonsinchen,项目名称:openttd-cargodist,代码行数:26,代码来源:tree_gui.cpp


示例4: MakeNewGameDone

static void MakeNewGameDone()
{
	SettingsDisableElrail(_settings_game.vehicle.disable_elrails);

	/* In a dedicated server, the server does not play */
	if (_network_dedicated || BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 0) {
		SetLocalCompany(COMPANY_SPECTATOR);
		IConsoleCmdExec("exec scripts/game_start.scr 0");
		return;
	}

	/* Create a single company */
	DoStartupNewCompany(false);

	Company *c = Company::Get(COMPANY_FIRST);
	c->settings = _settings_client.company;

	IConsoleCmdExec("exec scripts/game_start.scr 0");

	SetLocalCompany(COMPANY_FIRST);

	InitializeRailGUI();

#ifdef ENABLE_NETWORK
	/* We are the server, we start a new company (not dedicated),
	 * so set the default password *if* needed. */
	if (_network_server && !StrEmpty(_settings_client.network.default_company_pass)) {
		NetworkChangeCompanyPassword(_local_company, _settings_client.network.default_company_pass);
	}
#endif /* ENABLE_NETWORK */

	if (_settings_client.gui.pause_on_newgame) DoCommandP(0, PM_PAUSED_NORMAL, 1, CMD_PAUSE);

	MarkWholeScreenDirty();
}
开发者ID:dolly22,项目名称:openttd-sai,代码行数:35,代码来源:openttd.cpp


示例5: EndGameWindow

    EndGameWindow(const WindowDesc *desc) : EndGameHighScoreBaseWindow(desc)
    {
        /* Pause in single-player to have a look at the highscore at your own leisure */
        if (!_networking) DoCommandP(0, PM_PAUSED_NORMAL, 1, CMD_PAUSE);

        this->background_img = SPR_TYCOON_IMG1_BEGIN;

        if (_local_company != COMPANY_SPECTATOR) {
            const Company *c = Company::Get(_local_company);
            if (c->old_economy[0].performance_history == SCORE_MAX) {
                this->background_img = SPR_TYCOON_IMG2_BEGIN;
            }
        }

        /* In a network game show the endscores of the custom difficulty 'network' which is the last one
         * as well as generate a TOP5 of that game, and not an all-time top5. */
        if (_networking) {
            this->window_number = lengthof(_highscore_table) - 1;
            this->rank = SaveHighScoreValueNetwork();
        } else {
            /* in single player _local company is always valid */
            const Company *c = Company::Get(_local_company);
            this->window_number = _settings_game.difficulty.diff_level;
            this->rank = SaveHighScoreValue(c);
        }

        MarkWholeScreenDirty();
    }
开发者ID:blackberry,项目名称:OpenTTD,代码行数:28,代码来源:highscore_gui.cpp


示例6: DEBUG

const char *VideoDriver_Allegro::Start(const char * const *parm)
{
	if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, NULL)) {
		DEBUG(driver, 0, "allegro: install_allegro failed '%s'", allegro_error);
		return "Failed to set up Allegro";
	}
	_allegro_instance_count++;

	install_timer();
	install_mouse();
	install_keyboard();

#if defined _DEBUG
/* Allegro replaces SEGV/ABRT signals meaning that the debugger will never
 * be triggered, so rereplace the signals and make the debugger useful. */
	signal(SIGABRT, NULL);
	signal(SIGSEGV, NULL);
#endif

#if defined(DOS)
	/* Force DOS builds to ALWAYS use full screen as
	 * it can't do windowed. */
	_fullscreen = true;
#endif

	GetVideoModes();
	if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) {
		return "Failed to set up Allegro video";
	}
	MarkWholeScreenDirty();
	set_close_button_callback(HandleExitGameRequest);

	return NULL;
}
开发者ID:Ayutac,项目名称:OpenTTD,代码行数:34,代码来源:allegro_v.cpp


示例7: GameSizeChanged

/**
 * Size of the application screen changed.
 * Adapt the game screen-size, re-allocate the open windows, and repaint everything
 */
void GameSizeChanged()
{
	_cur_resolution.width  = _screen.width;
	_cur_resolution.height = _screen.height;
	ScreenSizeChanged();
	RelocateAllWindows(_screen.width, _screen.height);
	MarkWholeScreenDirty();
}
开发者ID:CliffsDover,项目名称:openttd-android,代码行数:12,代码来源:main_gui.cpp


示例8: CmdSetCompanyManagerFace

/**
 * Change the company manager's face.
 * @param tile unused
 * @param flags operation to perform
 * @param p1 unused
 * @param p2 face bitmasked
 * @param text unused
 * @return the cost of this operation or an error
 */
CommandCost CmdSetCompanyManagerFace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
	CompanyManagerFace cmf = (CompanyManagerFace)p2;

	if (!IsValidCompanyManagerFace(cmf)) return CMD_ERROR;

	if (flags & DC_EXEC) {
		Company::Get(_current_company)->face = cmf;
		MarkWholeScreenDirty();
	}
	return CommandCost();
}
开发者ID:habnabit,项目名称:openttd-cargodist,代码行数:21,代码来源:company_cmd.cpp


示例9: FlatEmptyWorld

void FlatEmptyWorld(byte tile_height)
{
	int edge_distance = _settings_game.construction.freeform_edges ? 0 : 2;
	for (uint row = edge_distance; row < MapSizeY() - edge_distance; row++) {
		for (uint col = edge_distance; col < MapSizeX() - edge_distance; col++) {
			SetTileHeight(TileXY(col, row), tile_height);
		}
	}

	FixSlopes();
	MarkWholeScreenDirty();
}
开发者ID:jemmyw,项目名称:openttd,代码行数:12,代码来源:heightmap.cpp


示例10: DoScanNewGRFFiles

/**
 * Really perform the scan for all NewGRFs.
 * @param callback The callback to call after the scanning is complete.
 */
void DoScanNewGRFFiles(void *callback)
{
	_modal_progress_work_mutex->BeginCritical();

	ClearGRFConfigList(&_all_grfs);
	TarScanner::DoScan(TarScanner::NEWGRF);

	DEBUG(grf, 1, "Scanning for NewGRFs");
	uint num = GRFFileScanner::DoScan();

	DEBUG(grf, 1, "Scan complete, found %d files", num);
	if (num != 0 && _all_grfs != NULL) {
		/* Sort the linked list using quicksort.
		 * For that we first have to make an array, then sort and
		 * then remake the linked list. */
		GRFConfig **to_sort = MallocT<GRFConfig*>(num);

		uint i = 0;
		for (GRFConfig *p = _all_grfs; p != NULL; p = p->next, i++) {
			to_sort[i] = p;
		}
		/* Number of files is not necessarily right */
		num = i;

		QSortT(to_sort, num, &GRFSorter);

		for (i = 1; i < num; i++) {
			to_sort[i - 1]->next = to_sort[i];
		}
		to_sort[num - 1]->next = NULL;
		_all_grfs = to_sort[0];

		free(to_sort);

#ifdef ENABLE_NETWORK
		NetworkAfterNewGRFScan();
#endif
	}

	_modal_progress_work_mutex->EndCritical();
	_modal_progress_paint_mutex->BeginCritical();

	/* Yes... these are the NewGRF windows */
	InvalidateWindowClassesData(WC_SAVELOAD, 0, true);
	InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE, GOID_NEWGRF_RESCANNED, true);
	if (callback != NULL) ((NewGRFScanCallback*)callback)->OnNewGRFsScanned();

	DeleteWindowByClass(WC_MODAL_PROGRESS);
	SetModalProgress(false);
	MarkWholeScreenDirty();
	_modal_progress_paint_mutex->EndCritical();
}
开发者ID:tony,项目名称:openttd,代码行数:56,代码来源:newgrf_config.cpp


示例11: HighScoreWindow

    HighScoreWindow(const WindowDesc *desc, int difficulty, int8 ranking) : EndGameHighScoreBaseWindow(desc)
    {
        /* pause game to show the chart */
        if (!_networking) DoCommandP(0, PM_PAUSED_NORMAL, 1, CMD_PAUSE);

        /* Close all always on-top windows to get a clean screen */
        if (_game_mode != GM_MENU) HideVitalWindows();

        MarkWholeScreenDirty();
        this->window_number = difficulty; // show highscore chart for difficulty...
        this->background_img = SPR_HIGHSCORE_CHART_BEGIN; // which background to show
        this->rank = ranking;
    }
开发者ID:blackberry,项目名称:OpenTTD,代码行数:13,代码来源:highscore_gui.cpp


示例12: IConsoleSwitch

/** Toggle in-game console between opened and closed. */
void IConsoleSwitch()
{
	switch (_iconsole_mode) {
		case ICONSOLE_CLOSED:
			new IConsoleWindow();
			break;

		case ICONSOLE_OPENED: case ICONSOLE_FULL:
			DeleteWindowById(WC_CONSOLE, 0);
			break;
	}

	MarkWholeScreenDirty();
}
开发者ID:a7omic,项目名称:OpenTTD,代码行数:15,代码来源:console_gui.cpp


示例13: GenerateCompanyName

static void GenerateCompanyName(Company *c)
{
	TileIndex tile;
	Town *t;
	StringID str;
	Company *cc;
	uint32 strp;
	/* Reserve space for extra unicode character. We need to do this to be able
	 * to detect too long company name. */
	char buffer[MAX_LENGTH_COMPANY_NAME_BYTES + MAX_CHAR_LENGTH];

	if (c->name_1 != STR_SV_UNNAMED) return;

	tile = c->last_build_coordinate;
	if (tile == 0) return;

	t = ClosestTownFromTile(tile, UINT_MAX);

	if (t->name == NULL && IsInsideMM(t->townnametype, SPECSTR_TOWNNAME_START, SPECSTR_TOWNNAME_LAST + 1)) {
		str = t->townnametype - SPECSTR_TOWNNAME_START + SPECSTR_PLAYERNAME_START;
		strp = t->townnameparts;

verify_name:;
		/* No companies must have this name already */
		FOR_ALL_COMPANIES(cc) {
			if (cc->name_1 == str && cc->name_2 == strp) goto bad_town_name;
		}

		GetString(buffer, str, lastof(buffer));
		if (strlen(buffer) >= MAX_LENGTH_COMPANY_NAME_BYTES) goto bad_town_name;

set_name:;
		c->name_1 = str;
		c->name_2 = strp;

		MarkWholeScreenDirty();

		if (c->is_ai) {
			CompanyNewsInformation *cni = MallocT<CompanyNewsInformation>(1);
			cni->FillData(c);
			SetDParam(0, STR_NEWS_COMPANY_LAUNCH_TITLE);
			SetDParam(1, STR_NEWS_COMPANY_LAUNCH_DESCRIPTION);
			SetDParamStr(2, cni->company_name);
			SetDParam(3, t->index);
			AddNewsItem(STR_MESSAGE_NEWS_FORMAT, NS_COMPANY_NEW, NR_TILE, c->last_build_coordinate, NR_NONE, UINT32_MAX, cni);
		}
		AI::BroadcastNewEvent(new AIEventCompanyNew(c->index), c->index);
		return;
	}
开发者ID:jemmyw,项目名称:openttd,代码行数:49,代码来源:company_cmd.cpp


示例14: CleanupGeneration

/**
 * Clean up the 'mess' of generation. That is, show windows again, reset
 * thread variables, and delete the progress window.
 */
static void CleanupGeneration()
{
	_generating_world = false;

	if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE, PAL_NONE);
	/* Show all vital windows again, because we have hidden them */
	if (_gw.threaded && _game_mode != GM_MENU) ShowVitalWindows();
	_gw.active   = false;
	_gw.proc     = NULL;
	_gw.abortp   = NULL;
	_gw.threaded = false;

	DeleteWindowById(WC_GENERATE_PROGRESS_WINDOW, 0);
	MarkWholeScreenDirty();
}
开发者ID:a7omic,项目名称:OpenTTD,代码行数:19,代码来源:genworld.cpp


示例15: LoadHeightmap

/**
 * Load a heightmap from file and change the map in his current dimensions
 *  to a landscape representing the heightmap.
 * It converts pixels to height. The brighter, the higher.
 * @param dft Type of image file.
 * @param filename of the heightmap file to be imported
 */
void LoadHeightmap(DetailedFileType dft, const char *filename)
{
	uint x, y;
	byte *map = nullptr;

	if (!ReadHeightMap(dft, filename, &x, &y, &map)) {
		free(map);
		return;
	}

	GrayscaleToMapHeights(x, y, map);
	free(map);

	FixSlopes();
	MarkWholeScreenDirty();
}
开发者ID:OpenTTD,项目名称:OpenTTD,代码行数:23,代码来源:heightmap.cpp


示例16: LoadHeightmap

void LoadHeightmap(char *filename)
{
	uint x, y;
	byte *map = NULL;

	if (!ReadHeightMap(filename, &x, &y, &map)) {
		free(map);
		return;
	}

	GrayscaleToMapHeights(x, y, map);
	free(map);

	FixSlopes();
	MarkWholeScreenDirty();
}
开发者ID:jemmyw,项目名称:openttd,代码行数:16,代码来源:heightmap.cpp


示例17: CleanupGeneration

/**
 * Clean up the 'mess' of generation. That is, show windows again, reset
 * thread variables, and delete the progress window.
 */
static void CleanupGeneration()
{
	_generating_world = false;

	SetMouseCursorBusy(false);
	/* Show all vital windows again, because we have hidden them */
	if (_gw.threaded && _game_mode != GM_MENU) ShowVitalWindows();
	SetModalProgress(false);
	_gw.proc     = NULL;
	_gw.abortp   = NULL;
	_gw.threaded = false;

	DeleteWindowByClass(WC_MODAL_PROGRESS);
	ShowFirstError();
	MarkWholeScreenDirty();
}
开发者ID:IchiroWang,项目名称:OpenTTD,代码行数:20,代码来源:genworld.cpp


示例18: IConsoleResize

/** Change the size of the in-game console window after the screen size changed, or the window state changed. */
void IConsoleResize(Window *w)
{
	switch (_iconsole_mode) {
		case ICONSOLE_OPENED:
			w->height = _screen.height / 3;
			w->width = _screen.width;
			break;
		case ICONSOLE_FULL:
			w->height = _screen.height - ICON_BOTTOM_BORDERWIDTH;
			w->width = _screen.width;
			break;
		default: return;
	}

	MarkWholeScreenDirty();
}
开发者ID:a7omic,项目名称:OpenTTD,代码行数:17,代码来源:console_gui.cpp


示例19: ScanNewGRFFiles

/**
 * Scan for all NewGRFs.
 * @param callback The callback to call after the scanning is complete.
 */
void ScanNewGRFFiles(NewGRFScanCallback *callback)
{
	/* First set the modal progress. This ensures that it will eventually let go of the paint mutex. */
	SetModalProgress(true);
	/* Only then can we really start, especially by marking the whole screen dirty. Get those other windows hidden!. */
	MarkWholeScreenDirty();

	if (!VideoDriver::GetInstance()->HasGUI() || !ThreadObject::New(&DoScanNewGRFFiles, callback, NULL, "ottd:newgrf-scan")) {
		_modal_progress_work_mutex->EndCritical();
		_modal_progress_paint_mutex->EndCritical();
		DoScanNewGRFFiles(callback);
		_modal_progress_paint_mutex->BeginCritical();
		_modal_progress_work_mutex->BeginCritical();
	} else {
		UpdateNewGRFScanStatus(0, NULL);
	}
}
开发者ID:tony,项目名称:openttd,代码行数:21,代码来源:newgrf_config.cpp


示例20: ResetViewportAfterLoadGame

void ResetViewportAfterLoadGame()
{
	Window *w = FindWindowById(WC_MAIN_WINDOW, 0);

	w->viewport->scrollpos_x = _saved_scrollpos_x;
	w->viewport->scrollpos_y = _saved_scrollpos_y;
	w->viewport->dest_scrollpos_x = _saved_scrollpos_x;
	w->viewport->dest_scrollpos_y = _saved_scrollpos_y;

	ViewPort *vp = w->viewport;
	vp->zoom = (ZoomLevel)min(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
	vp->virtual_width = ScaleByZoom(vp->width, vp->zoom);
	vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);

	DoZoomInOutWindow(ZOOM_NONE, w); // update button status
	MarkWholeScreenDirty();
}
开发者ID:blackberry,项目名称:OpenTTD,代码行数:17,代码来源:misc_sl.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Marshal函数代码示例发布时间:2022-05-30
下一篇:
C++ MarkTextDirty函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap