您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ window_find_by_class函数代码示例

51自学网 2021-06-03 09:57:51
  C++
这篇教程C++ window_find_by_class函数代码示例写得很实用,希望能帮到您。

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

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

示例1: title_handle_keyboard_input

/** * *  rct2: 0x006E3B43 */void title_handle_keyboard_input(){	rct_window *w;	int key;	if (gOpenRCT2Headless) {		return;	}	if (!gConsoleOpen) {		// Handle modifier keys and key scrolling		gInputPlaceObjectModifier = PLACE_OBJECT_MODIFIER_NONE;		if (RCT2_GLOBAL(0x009E2B64, uint32) != 1) {			if (gKeysState[SDL_SCANCODE_LSHIFT] || gKeysState[SDL_SCANCODE_RSHIFT])				gInputPlaceObjectModifier |= PLACE_OBJECT_MODIFIER_SHIFT_Z;			if (gKeysState[SDL_SCANCODE_LCTRL] || gKeysState[SDL_SCANCODE_RCTRL])				gInputPlaceObjectModifier |= PLACE_OBJECT_MODIFIER_COPY_Z;			if (gKeysState[SDL_SCANCODE_LALT] || gKeysState[SDL_SCANCODE_RALT])				gInputPlaceObjectModifier |= 4;#ifdef __MACOSX__			if (gKeysState[SDL_SCANCODE_LGUI] || gKeysState[SDL_SCANCODE_RGUI]) {				gInputPlaceObjectModifier |= 8;			}#endif		}	}	while ((key = get_next_key()) != 0) {		if (key == 255)			continue;		// Reserve backtick for console		if (key == SDL_SCANCODE_GRAVE) {			if (gConfigGeneral.debugging_tools || gConsoleOpen) {				window_cancel_textbox();				console_toggle();			}			continue;		} else if (gConsoleOpen) {			console_input(key);			continue;		}		key |= gInputPlaceObjectModifier << 8;		w = window_find_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);		if (w != NULL) {			keyboard_shortcut_set(key);		} else {			w = window_find_by_class(WC_TEXTINPUT);			if (w != NULL) {				window_text_input_key(w, key);			}						if (key == gShortcutKeys[SHORTCUT_SCREENSHOT]) {				keyboard_shortcut_handle_command(SHORTCUT_SCREENSHOT);			}		}	}}
开发者ID:1337Noob1337,项目名称:OpenRCT2,代码行数:64,


示例2: news_item_open_subject

/** * Opens the window/tab for the subject of the news item * *  rct2: 0x0066EBE6 * */void news_item_open_subject(sint32 type, sint32 subject){    rct_peep* peep;    rct_window* window;    switch (type) {    case NEWS_ITEM_RIDE:        window_ride_main_open(subject);        break;    case NEWS_ITEM_PEEP_ON_RIDE:    case NEWS_ITEM_PEEP:        peep = GET_PEEP(subject);        window_guest_open(peep);        break;    case NEWS_ITEM_MONEY:        window_finances_open();        break;    case NEWS_ITEM_RESEARCH:        if (subject >= 0x10000) {            // Open ride list window            window_new_ride_open();            // Switch to right tab and scroll to ride location            ride_list_item rideItem;            rideItem.type = subject >> 8;            rideItem.entry_index = subject & 0xFF;            window_new_ride_focus(rideItem);            break;        }        // Check if window is already open        window = window_bring_to_front_by_class(WC_SCENERY);        if (window == NULL) {            window = window_find_by_class(WC_TOP_TOOLBAR);            if (window != NULL) {                window_invalidate(window);                if (!tool_set(window, WC_TOP_TOOLBAR__WIDX_SCENERY, TOOL_ARROW)) {                    input_set_flag(INPUT_FLAG_6, true);                    window_scenery_open();                }            }        }        // Switch to new scenery tab        window = window_find_by_class(WC_SCENERY);        if (window != NULL)            window_event_mouse_down_call(window, WC_SCENERY__WIDX_SCENERY_TAB_1 + subject);        break;    case NEWS_ITEM_PEEPS:        window_guest_list_open_with_filter(GLFT_GUESTS_THINKING_X, subject);;        break;    case NEWS_ITEM_AWARD:        window_park_awards_open();        break;    case NEWS_ITEM_GRAPH:        window_park_rating_open();        break;    }
开发者ID:trigger-death,项目名称:OpenRCT2,代码行数:64,


示例3: window_ride_refurbish_prompt_open

rct_window * window_ride_refurbish_prompt_open(sint32 rideIndex){    rct_window *w;    w = window_find_by_class(WC_DEMOLISH_RIDE_PROMPT);    if (w != nullptr)    {        int x = w->x;        int y = w->y;        window_close(w);        w = window_create(x, y, WW, WH, &window_ride_refurbish_events, WC_DEMOLISH_RIDE_PROMPT, WF_TRANSPARENT);    }    else    {        w = window_create_centred(WW, WH, &window_ride_refurbish_events, WC_DEMOLISH_RIDE_PROMPT, WF_TRANSPARENT);    }    w->widgets = window_ride_refurbish_widgets;    w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_CANCEL) | (1 << WIDX_REFURBISH);    window_init_scroll_widgets(w);    w->number = rideIndex;    _demolishRideCost = -ride_get_refund_price(rideIndex);    return w;}
开发者ID:Wirlie,项目名称:OpenRCT2,代码行数:25,


示例4: window_new_ride_focus

/** * *  rct2: 0x006B3EBA */void window_new_ride_focus(ride_list_item rideItem){	rct_window *w;	rct_ride_entry *rideType;	w = window_find_by_class(WC_CONSTRUCT_RIDE);	if (w == NULL)		return;	rideType = get_ride_entry(rideItem.entry_index);	if(!gConfigInterface.select_by_track_type)		window_new_ride_set_page(w, rideType->category[0]);	else		window_new_ride_set_page(w, gRideCategories[rideType->ride_type[0]]);	ride_list_item *listItem = _windowNewRideListItems;	while (listItem->type != RIDE_TYPE_NULL) {		if (listItem->type == rideItem.type && listItem->entry_index == rideItem.entry_index) {			_windowNewRideHighlightedItem[0] = rideItem;			w->new_ride.highlighted_ride_id = rideItem.ride_type_and_entry;			window_new_ride_scroll_to_focused_ride(w);		}		listItem++;	}}
开发者ID:YJSoft,项目名称:OpenRCT2,代码行数:30,


示例5: game_handle_key_scroll

static void game_handle_key_scroll(){    rct_window * mainWindow;    sint32       scrollX, scrollY;    mainWindow = window_get_main();    if (mainWindow == nullptr)        return;    if ((mainWindow->flags & WF_NO_SCROLLING) || (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO)))        return;    if (mainWindow->viewport == nullptr)        return;    rct_window * textWindow;    textWindow = window_find_by_class(WC_TEXTINPUT);    if (textWindow || gUsingWidgetTextBox)        return;    if (gChatOpen)        return;    scrollX                 = 0;    scrollY                 = 0;    const uint8 * keysState = context_get_keys_state();    get_keyboard_map_scroll(keysState, &scrollX, &scrollY);    if (scrollX != 0 || scrollY != 0)    {        window_unfollow_sprite(mainWindow);    }    input_scroll_viewport(scrollX, scrollY);}
开发者ID:Gymnasiast,项目名称:OpenRCT2,代码行数:32,


示例6: window_map_tooltip_update_visibility

/** * *  rct2: 0x006EE77A */void window_map_tooltip_update_visibility(){	int cursorX, cursorY, inputFlags;	cursorX = gCursorState.x;	cursorY = gCursorState.y;	inputFlags = gInputFlags;	// Check for cursor movement	_cursorHoldDuration++;	if (abs(cursorX - _lastCursorX) > 5 || abs(cursorY - _lastCursorY) > 5 || (inputFlags & INPUT_FLAG_5))		_cursorHoldDuration = 0;	_lastCursorX = cursorX;	_lastCursorY = cursorY;	// Show or hide tooltip	rct_string_id stringId;	memcpy(&stringId, gMapTooltipFormatArgs, sizeof(rct_string_id));	if (_cursorHoldDuration < 25 ||		stringId == STR_NONE ||		(gInputPlaceObjectModifier & 3) ||		window_find_by_class(WC_ERROR) != NULL	) {		window_close_by_class(WC_MAP_TOOLTIP);	} else {		window_map_tooltip_open();	}}
开发者ID:YJSoft,项目名称:OpenRCT2,代码行数:34,


示例7: window_track_manage_open

/** * *  rct2: 0x006D348F */void window_track_manage_open(){	// RCT2_CALLPROC_EBPSAFE(0x006D348F);	rct_window *w, *trackDesignListWindow;	window_close_by_class(WC_MANAGE_TRACK_DESIGN);	w = window_create(		max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 250) / 2),		(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 44) / 2,		250,		44,		(uint32*)window_track_manage_events,		WC_MANAGE_TRACK_DESIGN,		WF_STICK_TO_FRONT	);	w->widgets = window_track_manage_widgets;	w->enabled_widgets =		(1 << WIDX_CLOSE) |		(1 << WIDX_RENAME) |		(1 << WIDX_DELETE);	window_init_scroll_widgets(w);	w->flags |= WF_TRANSPARENT;	w->colours[0] = 1;	w->colours[1] = 1;	w->colours[2] = 1;	trackDesignListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST);	if (trackDesignListWindow != NULL)		trackDesignListWindow->track_list.var_484 |= 1;}
开发者ID:jcdavis,项目名称:OpenRCT2,代码行数:36,


示例8: window_maze_construction_update_pressed_widgets

/** * *  rct2: 0x006CD887 */void window_maze_construction_update_pressed_widgets(){    rct_window *w;    w = window_find_by_class(WC_RIDE_CONSTRUCTION);    if (w == NULL)        return;    uint64 pressedWidgets = w->pressed_widgets;    pressedWidgets &= ~(1ULL << WIDX_MAZE_BUILD_MODE);    pressedWidgets &= ~(1ULL << WIDX_MAZE_MOVE_MODE);    pressedWidgets &= ~(1ULL << WIDX_MAZE_FILL_MODE);    switch (_rideConstructionState) {    case RIDE_CONSTRUCTION_STATE_MAZE_BUILD:        pressedWidgets |= (1ULL << WIDX_MAZE_BUILD_MODE);        break;    case RIDE_CONSTRUCTION_STATE_MAZE_MOVE:        pressedWidgets |= (1ULL << WIDX_MAZE_MOVE_MODE);        break;    case RIDE_CONSTRUCTION_STATE_MAZE_FILL:        pressedWidgets |= (1ULL << WIDX_MAZE_FILL_MODE);        break;    }    w->pressed_widgets = pressedWidgets;    window_invalidate(w);}
开发者ID:trigger-death,项目名称:OpenRCT2,代码行数:32,


示例9: window_water_open

/** * *  rct2: 0x006E6A40 */void window_water_open(){    rct_window* window;    // Check if window is already open    if (window_find_by_class(WC_WATER) != NULL)        return;    window = window_create(        context_get_width() - 76,        29,        76,        77,        &window_water_events,        WC_WATER,        0    );    window->widgets = window_water_widgets;    window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_DECREMENT) | (1 << WIDX_INCREMENT) | (1 << WIDX_PREVIEW);    window->hold_down_widgets = (1 << WIDX_INCREMENT) | (1 << WIDX_DECREMENT);    window_init_scroll_widgets(window);    window_push_others_below(window);    gLandToolSize = 1;    gWaterToolRaiseCost = MONEY32_UNDEFINED;    gWaterToolLowerCost = MONEY32_UNDEFINED;}
开发者ID:trigger-death,项目名称:OpenRCT2,代码行数:31,


示例10: window_land_open

/** * *  rct2: 0x00663E7D */void window_land_open(){	rct_window* window;	// Check if window is already open	if (window_find_by_class(WC_LAND) != NULL)		return;	window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 98, 29, 98, 126, (uint32*)window_land_events, WC_LAND, 0);	window->widgets = window_land_widgets;	window->enabled_widgets =		(1 << WIDX_CLOSE) |		(1 << WIDX_DECREMENT) |		(1 << WIDX_INCREMENT) |		(1 << WIDX_FLOOR) |		(1 << WIDX_WALL) |		(1 << WIDX_PAINTMODE) |		(1 << WIDX_PREVIEW);	window_init_scroll_widgets(window);	window_push_others_below(window);	RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) = 255;	RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) = 255;	LandPaintMode = false;	_selectedFloorTexture = 0;	_selectedWallTexture = 0;	RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) = MONEY32_UNDEFINED;	RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) = MONEY32_UNDEFINED;}
开发者ID:MaikelS11,项目名称:OpenRCT2,代码行数:33,


示例11: window_debug_paint_open

void window_debug_paint_open(){	rct_window * window;	// Check if window is already open	if (window_find_by_class(WC_DEBUG_PAINT) != NULL)		return;	window = window_create(		16,		gScreenHeight - 16 - 33 - WINDOW_HEIGHT,		WINDOW_WIDTH,		WINDOW_HEIGHT,		&window_debug_paint_events,		WC_DEBUG_PAINT,		WF_STICK_TO_FRONT | WF_TRANSPARENT	);	window->widgets = window_debug_paint_widgets;	window->enabled_widgets = (1 << WIDX_TOGGLE_OLD_DRAWING) | (1 << WIDX_TOGGLE_SHOW_BOUND_BOXES) | (1 << WIDX_TOGGLE_SHOW_SEGMENT_HEIGHTS);	window_init_scroll_widgets(window);	window_push_others_below(window);	window->colours[0] = TRANSLUCENT(COLOUR_BLACK);	window->colours[1] = COLOUR_GREY;}
开发者ID:LucaRed,项目名称:OpenRCT2,代码行数:26,


示例12: window_track_manage_close

/** * *  rct2: 0x006D364C */static void window_track_manage_close(){	rct_window *w;	w = window_find_by_class(WC_TRACK_DESIGN_LIST);	if (w != NULL)		w->track_list.var_484 &= ~1;}
开发者ID:jcdavis,项目名称:OpenRCT2,代码行数:12,


示例13: shortcut_remove_top_bottom_toolbar_toggle

static void shortcut_remove_top_bottom_toolbar_toggle(){	if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TITLE_DEMO)		return;	if (window_find_by_class(WC_TOP_TOOLBAR) != NULL) {		window_close(window_find_by_class(WC_TOP_TOOLBAR));		window_close(window_find_by_class(WC_BOTTOM_TOOLBAR));	} else {		if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) == 0) {			window_top_toolbar_open();			window_game_bottom_toolbar_open();		} else {			window_top_toolbar_open();			window_editor_bottom_toolbar_open();		}	}}
开发者ID:janisozaur,项目名称:rct-release-test,代码行数:18,


示例14: window_tooltip_show

void window_tooltip_show(rct_string_id id, int x, int y){	rct_window *w;	int width, height;	w = window_find_by_class(WC_ERROR);	if (w != NULL)		return;	RCT2_GLOBAL(0x0142006C, sint32) = -1;	char* buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char);	format_string(buffer, id, (void*)0x013CE952);	RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = FONT_SPRITE_BASE_MEDIUM;	int tooltip_text_width;	tooltip_text_width = gfx_get_string_width_new_lined(buffer);	buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char);	tooltip_text_width = min(tooltip_text_width, 196);	RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = FONT_SPRITE_BASE_MEDIUM;	int numLines, fontSpriteBase;	tooltip_text_width = gfx_wrap_string(buffer, tooltip_text_width + 1, &numLines, &fontSpriteBase);	RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TEXT_HEIGHT, sint16) = numLines;	width = tooltip_text_width + 3;	height = ((numLines + 1) * font_get_line_height(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16))) + 4;	window_tooltip_widgets[WIDX_BACKGROUND].right = width;	window_tooltip_widgets[WIDX_BACKGROUND].bottom = height;	memcpy(gTooltip_text_buffer, buffer, 512);	x = clamp(0, x - (width / 2), RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - width);	int max_y = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - height;	y += 26; // Normally, we'd display the tooltip 26 lower	if (y > max_y)		// If y is too large, the tooltip could be forced below the cursor if we'd just clamped y,		// so we'll subtract a bit more		y -= height + 40;	y = clamp(22, y, max_y);	w = window_create(		x,		y,		width,		height,		&window_tooltip_events,		WC_TOOLTIP,		WF_TRANSPARENT | WF_STICK_TO_FRONT		);	w->widgets = window_tooltip_widgets;	RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_NOT_SHOWN_TICKS, uint16) = 0;}
开发者ID:Aitchwing,项目名称:OpenRCT2,代码行数:56,


示例15: shortcut_cancel_construction_mode

static void shortcut_cancel_construction_mode(){	rct_window *window;	window = window_find_by_class(WC_ERROR);	if (window != NULL)		window_close(window);	else if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE)		tool_cancel();}
开发者ID:Achilleshiel,项目名称:OpenRCT2,代码行数:10,


示例16: shortcut_rotate_construction_object

static void shortcut_rotate_construction_object(){	rct_window *w;	// Rotate scenery	w = window_find_by_class(WC_SCENERY);	if (w != NULL && !widget_is_disabled(w, 25) && w->widgets[25].type != WWT_EMPTY) {		window_event_mouse_up_call(w, 25);		return;	}	// Rotate construction track piece	w = window_find_by_class(WC_RIDE_CONSTRUCTION);	if (w != NULL && !widget_is_disabled(w, 32) && w->widgets[32].type != WWT_EMPTY) {		// Check if building a maze...		if (w->widgets[32].tooltip != 1761) {			window_event_mouse_up_call(w, 32);			return;		}	}	// Rotate track design preview	w = window_find_by_class(WC_TRACK_DESIGN_LIST);	if (w != NULL && !widget_is_disabled(w, 5) && w->widgets[5].type != WWT_EMPTY) {		window_event_mouse_up_call(w, 5);		return;	}	// Rotate track design placement	w = window_find_by_class(WC_TRACK_DESIGN_PLACE);	if (w != NULL && !widget_is_disabled(w, 3) && w->widgets[3].type != WWT_EMPTY) {		window_event_mouse_up_call(w, 3);		return;	}	// Rotate park entrance	w = window_find_by_class(WC_MAP);	if (w != NULL && !widget_is_disabled(w, 20) && w->widgets[20].type != WWT_EMPTY) {		window_event_mouse_up_call(w, 20);		return;	}}
开发者ID:janisozaur,项目名称:rct-release-test,代码行数:42,


示例17: shortcut_show_staff_list

static void shortcut_show_staff_list(){	rct_window *window;	if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {		window = window_find_by_class(WC_TOP_TOOLBAR);		if (window != NULL) {			window_invalidate(window);			window_event_mouse_up_call(window, 14);		}	}}
开发者ID:Achilleshiel,项目名称:OpenRCT2,代码行数:12,


示例18: shortcut_open_cheat_window

static void shortcut_open_cheat_window(){	rct_window *window;	// Check if window is already open	window = window_find_by_class(WC_CHEATS);	if (window != NULL) {		window_close(window);		return;	}	window_cheats_open();}
开发者ID:Achilleshiel,项目名称:OpenRCT2,代码行数:12,


示例19: shortcut_show_research_information

static void shortcut_show_research_information(){	rct_window *window;	if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {		// Open new ride window		RCT2_CALLPROC_EBPSAFE(0x006B3CFF);		window = window_find_by_class(WC_CONSTRUCT_RIDE);		if (window != NULL)			window_event_mouse_up_call(window, 10);	}}
开发者ID:Achilleshiel,项目名称:OpenRCT2,代码行数:12,


示例20: window_title_menu_mouseup

static void window_title_menu_mouseup(rct_window *w, rct_widgetindex widgetIndex){    rct_window *windowToOpen = nullptr;    switch (widgetIndex) {    case WIDX_START_NEW_GAME:        windowToOpen = window_find_by_class(WC_SCENARIO_SELECT);        if (windowToOpen != nullptr) {            window_bring_to_front(windowToOpen);        }        else {            window_close_by_class(WC_LOADSAVE);            window_close_by_class(WC_SERVER_LIST);            window_scenarioselect_open(window_title_menu_scenarioselect_callback, false);        }        break;    case WIDX_CONTINUE_SAVED_GAME:        windowToOpen = window_find_by_class(WC_LOADSAVE);        if (windowToOpen != nullptr) {            window_bring_to_front(windowToOpen);        }        else {            window_close_by_class(WC_SCENARIO_SELECT);            window_close_by_class(WC_SERVER_LIST);            game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);        }        break;    case WIDX_MULTIPLAYER:        windowToOpen = window_find_by_class(WC_SERVER_LIST);        if (windowToOpen != nullptr) {            window_bring_to_front(windowToOpen);        }        else {            window_close_by_class(WC_SCENARIO_SELECT);            window_close_by_class(WC_LOADSAVE);            context_open_window(WC_SERVER_LIST);        }        break;    }}
开发者ID:Gymnasiast,项目名称:OpenRCT2,代码行数:40,


示例21: window_tooltip_show

void window_tooltip_show(rct_string_id id, int32_t x, int32_t y){    rct_window* w;    int32_t width, height;    w = window_find_by_class(WC_ERROR);    if (w != nullptr)        return;    char* buffer = gCommonStringFormatBuffer;    format_string(buffer, sizeof(gCommonStringFormatBuffer), id, gCommonFormatArgs);    gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;    int32_t tooltip_text_width;    tooltip_text_width = gfx_get_string_width_new_lined(buffer);    buffer = gCommonStringFormatBuffer;    tooltip_text_width = std::min(tooltip_text_width, 196);    gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;    int32_t numLines, fontSpriteBase;    tooltip_text_width = gfx_wrap_string(buffer, tooltip_text_width + 1, &numLines, &fontSpriteBase);    _tooltipNumLines = numLines;    width = tooltip_text_width + 3;    height = ((numLines + 1) * font_get_line_height(gCurrentFontSpriteBase)) + 4;    window_tooltip_widgets[WIDX_BACKGROUND].right = width;    window_tooltip_widgets[WIDX_BACKGROUND].bottom = height;    std::memcpy(_tooltipText, buffer, sizeof(_tooltipText));    int32_t screenWidth = context_get_width();    int32_t screenHeight = context_get_height();    x = std::clamp(x - (width / 2), 0, screenWidth - width);    // TODO The cursor size will be relative to the window DPI.    //      The amount to offset the y should be adjusted.    int32_t max_y = screenHeight - height;    y += 26; // Normally, we'd display the tooltip 26 lower    if (y > max_y)        // If y is too large, the tooltip could be forced below the cursor if we'd just clamped y,        // so we'll subtract a bit more        y -= height + 40;    y = std::clamp(y, 22, max_y);    w = window_create(x, y, width, height, &window_tooltip_events, WC_TOOLTIP, WF_TRANSPARENT | WF_STICK_TO_FRONT);    w->widgets = window_tooltip_widgets;    reset_tooltip_not_shown();}
开发者ID:OpenRCT2,项目名称:OpenRCT2,代码行数:52,


示例22: window_track_place_tooldown

/** * *  rct2: 0x006CFF34 */static void window_track_place_tooldown(rct_window* w, rct_widgetindex widgetIndex, sint32 x, sint32 y){    sint32 i;    sint16 mapX, mapY, mapZ;    money32 cost;    uint8 rideIndex;    window_track_place_clear_provisional();    map_invalidate_map_selection_tiles();    gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;    gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;    gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;    sub_68A15E(x, y, &mapX, &mapY, nullptr, nullptr);    if (mapX == LOCATION_NULL)        return;    // Try increasing Z until a feasible placement is found    mapZ = window_track_place_get_base_z(mapX, mapY);    for (i = 0; i < 7; i++) {        gDisableErrorWindowSound = true;        window_track_place_attempt_placement(_trackDesign, mapX, mapY, mapZ, 1, &cost, &rideIndex);        gDisableErrorWindowSound = false;        if (cost != MONEY32_UNDEFINED) {            window_close_by_class(WC_ERROR);            audio_play_sound_at_location(SOUND_PLACE_ITEM, mapX, mapY, mapZ);            _currentRideIndex = rideIndex;            if (track_design_are_entrance_and_exit_placed()) {                auto intent = Intent(WC_RIDE);                intent.putExtra(INTENT_EXTRA_RIDE_ID, rideIndex);                context_open_intent(&intent);                window_close(w);            } else {                ride_initialise_construction_window(rideIndex);                w = window_find_by_class(WC_RIDE_CONSTRUCTION);                window_event_mouse_up_call(w, WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE);            }            return;        }        // Check if player did not have enough funds        if (gGameCommandErrorText == STR_NOT_ENOUGH_CASH_REQUIRES)            break;        mapZ += 8;    }    // Unable to build track    audio_play_sound_at_location(SOUND_ERROR, mapX, mapY, mapZ);}
开发者ID:Gymnasiast,项目名称:OpenRCT2,代码行数:56,


示例23: window_title_editor_mousedown

static void window_title_editor_mousedown(rct_window * w, rct_widgetindex widgetIndex, rct_widget * widget){    switch (widgetIndex)    {    case WIDX_TITLE_EDITOR_PRESETS_TAB:    case WIDX_TITLE_EDITOR_SAVES_TAB:    case WIDX_TITLE_EDITOR_SCRIPT_TAB:    {        sint32 newSelectedTab = widgetIndex - WIDX_TITLE_EDITOR_PRESETS_TAB;        if (w->selected_tab != newSelectedTab)        {            w->selected_tab = newSelectedTab;            w->selected_list_item = -1;            _window_title_editor_highlighted_index = -1;            w->scrolls[0].v_top = 0;            w->frame_no = 0;            window_event_resize_call(w);            window_invalidate(w);        }        break;    }    case WIDX_TITLE_EDITOR_PRESETS_DROPDOWN:        if (window_find_by_class(WC_TITLE_COMMAND_EDITOR) != nullptr)        {            context_show_error(STR_TITLE_EDITOR_ERR_CANT_CHANGE_WHILE_EDITOR_IS_OPEN, STR_NONE);        }        else        {            sint32 numItems = (sint32)title_sequence_manager_get_count();            for (sint32 i = 0; i < numItems; i++)            {                gDropdownItemsFormat[i] = STR_OPTIONS_DROPDOWN_ITEM;                gDropdownItemsArgs[i] = (uintptr_t)title_sequence_manager_get_name(i);            }            widget--;            window_dropdown_show_text_custom_width(                w->x + widget->left,                w->y + widget->top,                widget->bottom - widget->top + 1,                w->colours[1],                0,                DROPDOWN_FLAG_STAY_OPEN,                numItems,                widget->right - widget->left - 3);            dropdown_set_checked((sint32)_selectedTitleSequence, true);        }        break;    }}
开发者ID:Wirlie,项目名称:OpenRCT2,代码行数:50,


示例24: shortcut_build_new_ride

static void shortcut_build_new_ride(){	rct_window *window;	if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {		if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {			window = window_find_by_class(WC_TOP_TOOLBAR);			if (window != NULL) {				window_invalidate(window);				window_event_mouse_up_call(window, 11);			}		}	}}
开发者ID:Achilleshiel,项目名称:OpenRCT2,代码行数:14,


示例25: window_title_editor_check_can_edit

static bool window_title_editor_check_can_edit(){	bool commandEditorOpen = (window_find_by_class(WC_TITLE_COMMAND_EDITOR) != NULL);	if (_isSequenceReadOnly) {		window_error_open(STR_ERROR_CANT_CHANGE_TITLE_SEQUENCE, STR_NONE);	} else if (_isSequencePlaying) {		window_error_open(STR_TITLE_EDITOR_ERR_CANT_EDIT_WHILE_PLAYING, STR_TITLE_EDITOR_PRESS_STOP_TO_CONTINUE_EDITING);	} else if (commandEditorOpen) {		window_error_open(STR_TITLE_EDITOR_ERR_CANT_CHANGE_WHILE_EDITOR_IS_OPEN, STR_NONE);	} else {		return true;	}	return false;}
开发者ID:CraigCraig,项目名称:OpenRCT2,代码行数:14,


示例26: window_editor_inventions_list_drag_cursor

/** * *  rct2: 0x0068549C */static void window_editor_inventions_list_drag_cursor(    rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y, int32_t* cursorId){    rct_window* inventionListWindow = window_find_by_class(WC_EDITOR_INVENTION_LIST);    if (inventionListWindow != nullptr)    {        rct_research_item* researchItem = get_research_item_at(x, y);        if (researchItem != inventionListWindow->research_item)        {            window_invalidate(inventionListWindow);        }    }    *cursorId = CURSOR_HAND_CLOSED;}
开发者ID:OpenRCT2,项目名称:OpenRCT2,代码行数:19,


示例27: shortcut_open_cheat_window

static void shortcut_open_cheat_window(){	rct_window *window;	if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) != SCREEN_FLAGS_PLAYING)		return;	// Check if window is already open	window = window_find_by_class(WC_CHEATS);	if (window != NULL) {		window_close(window);		return;	}	window_cheats_open();}
开发者ID:janisozaur,项目名称:rct-release-test,代码行数:15,


示例28: window_title_editor_check_can_edit

static bool window_title_editor_check_can_edit(){    bool commandEditorOpen = (window_find_by_class(WC_TITLE_COMMAND_EDITOR) != nullptr);    if (_isSequenceReadOnly)        context_show_error(STR_ERROR_CANT_CHANGE_TITLE_SEQUENCE, STR_NONE);    else if (title_is_previewing_sequence())        context_show_error(STR_TITLE_EDITOR_ERR_CANT_EDIT_WHILE_PLAYING, STR_TITLE_EDITOR_PRESS_STOP_TO_CONTINUE_EDITING);    else if (commandEditorOpen)        context_show_error(STR_TITLE_EDITOR_ERR_CANT_CHANGE_WHILE_EDITOR_IS_OPEN, STR_NONE);    else        return true;    return false;}
开发者ID:Wirlie,项目名称:OpenRCT2,代码行数:15,


示例29: window_editor_inventions_list_update

/** * *  rct2: 0x00685392 */static void window_editor_inventions_list_update(rct_window* w){    w->frame_no++;    window_event_invalidate_call(w);    widget_invalidate(w, WIDX_TAB_1);    if (_editorInventionsListDraggedItem == nullptr)        return;    if (window_find_by_class(WC_EDITOR_INVENTION_LIST_DRAG) != nullptr)        return;    _editorInventionsListDraggedItem = nullptr;    window_invalidate(w);}
开发者ID:OpenRCT2,项目名称:OpenRCT2,代码行数:19,


示例30: window_editor_bottom_toolbar_check_object_selection

/** * *  rct2: 0x006AB1CE */bool window_editor_bottom_toolbar_check_object_selection(){	rct_window *w;	int missingObjectType = editor_check_object_selection();	if (missingObjectType < 0) {		window_close_by_class(WC_EDITOR_OBJECT_SELECTION);		return true;	}	window_error_open(STR_INVALID_SELECTION_OF_OBJECTS, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id));	w = window_find_by_class(WC_EDITOR_OBJECT_SELECTION);	if (w != NULL) {		// Click tab with missing object		window_event_mouse_up_call(w, 4 + missingObjectType);	}	return false;}
开发者ID:1337Noob1337,项目名称:OpenRCT2,代码行数:22,



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


C++ window_get_root_layer函数代码示例
C++ window_draw_widgets函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。