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


C++ running_machine::popmessage方法代码示例

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


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

示例1: tilemap_handle_keys

static void tilemap_handle_keys(running_machine &machine, ui_gfx_state &state, int viswidth, int visheight)
{
	// handle tilemap selection (open bracket,close bracket)
	if (machine.ui_input().pressed(IPT_UI_PREV_GROUP) && state.tilemap.which > 0)
	{ state.tilemap.which--; state.bitmap_dirty = true; }
	if (machine.ui_input().pressed(IPT_UI_NEXT_GROUP) && state.tilemap.which < machine.tilemap().count() - 1)
	{ state.tilemap.which++; state.bitmap_dirty = true; }

	// cache some info in locals
	tilemap_t *tilemap = machine.tilemap().find(state.tilemap.which);
	uint32_t mapwidth = tilemap->width();
	uint32_t mapheight = tilemap->height();

	// handle zoom (minus,plus)
	if (machine.ui_input().pressed(IPT_UI_ZOOM_OUT) && state.tilemap.zoom > 0)
	{
		state.tilemap.zoom--;
		state.bitmap_dirty = true;
		if (state.tilemap.zoom != 0)
			machine.popmessage("Zoom = %d", state.tilemap.zoom);
		else
			machine.popmessage("Zoom Auto");
	}
	if (machine.ui_input().pressed(IPT_UI_ZOOM_IN) && state.tilemap.zoom < 8)
	{
		state.tilemap.zoom++;
		state.bitmap_dirty = true;
		machine.popmessage("Zoom = %d", state.tilemap.zoom);
	}

	// handle rotation (R)
	if (machine.ui_input().pressed(IPT_UI_ROTATE))
	{
		state.tilemap.rotate = orientation_add(ROT90, state.tilemap.rotate);
		state.bitmap_dirty = true;
	}

	// return to (0,0) (HOME)
	if( machine.ui_input().pressed(IPT_UI_HOME))
	{
		state.tilemap.xoffs = 0;
		state.tilemap.yoffs = 0;
		state.bitmap_dirty = true;
	}

	// handle flags (category)
	if (machine.ui_input().pressed(IPT_UI_PAGE_UP) && state.tilemap.flags != TILEMAP_DRAW_ALL_CATEGORIES)
	{
		if (state.tilemap.flags > 0)
		{
			state.tilemap.flags--;
			machine.popmessage("Category = %d", state.tilemap.flags);
		}
		else
		{
			state.tilemap.flags = TILEMAP_DRAW_ALL_CATEGORIES;
			machine.popmessage("Category All");
		}
		state.bitmap_dirty = true;
	}
	if (machine.ui_input().pressed(IPT_UI_PAGE_DOWN) && (state.tilemap.flags < TILEMAP_DRAW_CATEGORY_MASK || (state.tilemap.flags == TILEMAP_DRAW_ALL_CATEGORIES)))
	{
		if (state.tilemap.flags == TILEMAP_DRAW_ALL_CATEGORIES)
			state.tilemap.flags = 0;
		else
			state.tilemap.flags++;
		state.bitmap_dirty = true;
		machine.popmessage("Category = %d", state.tilemap.flags);
	}

	// handle navigation (up,down,left,right), taking orientation into account
	int step = 8; // this may be applied more than once if multiple directions are pressed
	if (machine.input().code_pressed(KEYCODE_LSHIFT)) step = 1;
	if (machine.input().code_pressed(KEYCODE_LCONTROL)) step = 64;
	if (machine.ui_input().pressed_repeat(IPT_UI_UP, 4))
	{
		if (state.tilemap.rotate & ORIENTATION_SWAP_XY)
			state.tilemap.xoffs -= (state.tilemap.rotate & ORIENTATION_FLIP_Y) ? -step : step;
		else
			state.tilemap.yoffs -= (state.tilemap.rotate & ORIENTATION_FLIP_Y) ? -step : step;
		state.bitmap_dirty = true;
	}
	if (machine.ui_input().pressed_repeat(IPT_UI_DOWN, 4))
	{
		if (state.tilemap.rotate & ORIENTATION_SWAP_XY)
			state.tilemap.xoffs += (state.tilemap.rotate & ORIENTATION_FLIP_Y) ? -step : step;
		else
			state.tilemap.yoffs += (state.tilemap.rotate & ORIENTATION_FLIP_Y) ? -step : step;
		state.bitmap_dirty = true;
	}
	if (machine.ui_input().pressed_repeat(IPT_UI_LEFT, 6))
	{
		if (state.tilemap.rotate & ORIENTATION_SWAP_XY)
			state.tilemap.yoffs -= (state.tilemap.rotate & ORIENTATION_FLIP_X) ? -step : step;
		else
			state.tilemap.xoffs -= (state.tilemap.rotate & ORIENTATION_FLIP_X) ? -step : step;
		state.bitmap_dirty = true;
	}
	if (machine.ui_input().pressed_repeat(IPT_UI_RIGHT, 6))
	{
//.........这里部分代码省略.........
开发者ID:qwijibo,项目名称:mame,代码行数:101,代码来源:viewgfx.cpp

示例2: tilemap_handle_keys

static void tilemap_handle_keys(running_machine &machine, ui_gfx_state &state, int viswidth, int visheight)
{
	UINT32 mapwidth, mapheight;
	int step;

	// handle tilemap selection (open bracket,close bracket)
	if (ui_input_pressed(machine, IPT_UI_PREV_GROUP) && state.tilemap.which > 0)
	{ state.tilemap.which--; state.bitmap_dirty = true; }
	if (ui_input_pressed(machine, IPT_UI_NEXT_GROUP) && state.tilemap.which < machine.tilemap().count() - 1)
	{ state.tilemap.which++; state.bitmap_dirty = true; }

	// cache some info in locals
	tilemap_t *tilemap = machine.tilemap().find(state.tilemap.which);
	mapwidth = tilemap->width();
	mapheight = tilemap->height();

	// handle zoom (minus,plus)
	if (ui_input_pressed(machine, IPT_UI_ZOOM_OUT) && state.tilemap.zoom > 0)
	{
		state.tilemap.zoom--;
		state.bitmap_dirty = true;
		if (state.tilemap.zoom != 0)
			machine.popmessage("Zoom = %d", state.tilemap.zoom);
		else
			machine.popmessage("Zoom Auto");
	}
	if (ui_input_pressed(machine, IPT_UI_ZOOM_IN) && state.tilemap.zoom < 8)
	{
		state.tilemap.zoom++;
		state.bitmap_dirty = true;
		machine.popmessage("Zoom = %d", state.tilemap.zoom);
	}

	// handle rotation (R)
	if (ui_input_pressed(machine, IPT_UI_ROTATE))
	{
		state.tilemap.rotate = orientation_add(ROT90, state.tilemap.rotate);
		state.bitmap_dirty = true;
	}

	// handle navigation (up,down,left,right)
	step = 8;
	if (machine.input().code_pressed(KEYCODE_LSHIFT)) step = 1;
	if (machine.input().code_pressed(KEYCODE_LCONTROL)) step = 64;
	if (ui_input_pressed_repeat(machine, IPT_UI_UP, 4))
	{ state.tilemap.yoffs -= step; state.bitmap_dirty = true; }
	if (ui_input_pressed_repeat(machine, IPT_UI_DOWN, 4))
	{ state.tilemap.yoffs += step; state.bitmap_dirty = true; }
	if (ui_input_pressed_repeat(machine, IPT_UI_LEFT, 6))
	{ state.tilemap.xoffs -= step; state.bitmap_dirty = true; }
	if (ui_input_pressed_repeat(machine, IPT_UI_RIGHT, 6))
	{ state.tilemap.xoffs += step; state.bitmap_dirty = true; }

	// clamp within range
	while (state.tilemap.xoffs < 0)
		state.tilemap.xoffs += mapwidth;
	while (state.tilemap.xoffs >= mapwidth)
		state.tilemap.xoffs -= mapwidth;
	while (state.tilemap.yoffs < 0)
		state.tilemap.yoffs += mapheight;
	while (state.tilemap.yoffs >= mapheight)
		state.tilemap.yoffs -= mapheight;
}
开发者ID:ursine,项目名称:mame,代码行数:63,代码来源:viewgfx.cpp


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