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


C++ rectangle::contains方法代码示例

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


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

示例1:

int s2636_device::check_collision( int spriteno1, int spriteno2, const rectangle &cliprect )
{
	int checksum = 0;

	UINT8* attr1 = &m_work_ram[sprite_offsets[spriteno1]];
	UINT8* attr2 = &m_work_ram[sprite_offsets[spriteno2]];

	/* TODO: does not check shadow sprites yet */

	m_collision_bitmap->fill(0, cliprect);

	if ((attr1[0x0a] != 0xff) && (attr2[0x0a] != 0xff))
	{
		int x, y;

		int x1 = attr1[0x0a] + m_x_offset;
		int y1 = attr1[0x0c] + m_y_offset;
		int x2 = attr2[0x0a] + m_x_offset;
		int y2 = attr2[0x0c] + m_y_offset;

		int expand1 = (m_work_ram[0xc0] >> (spriteno1 << 1)) & 0x03;
		int expand2 = (m_work_ram[0xc0] >> (spriteno2 << 1)) & 0x03;

		/* draw first sprite */
		draw_sprite(attr1, 1, y1, x1, expand1, FALSE, *m_collision_bitmap, cliprect);

		/* get fingerprint */
		for (x = x1; x < x1 + SPRITE_WIDTH; x++)
			for (y = y1; y < y1 + SPRITE_HEIGHT; y++)
			{
				if (!cliprect.contains(x, y))
					continue;

				checksum = checksum + m_collision_bitmap->pix16(y, x);
			}

		/* black out second sprite */
		draw_sprite(attr2, 0, y2, x2, expand2, FALSE, *m_collision_bitmap, cliprect);

		/* remove fingerprint */
		for (x = x1; x < x1 + SPRITE_WIDTH; x++)
			for (y = y1; y < y1 + SPRITE_HEIGHT; y++)
			{
				if (!cliprect.contains(x, y))
					continue;

				checksum = checksum - m_collision_bitmap->pix16(y, x);
			}
	}
开发者ID:LeWoY,项目名称:MAMEHub,代码行数:49,代码来源:s2636.c

示例2: screen_update_magicard

UINT32 magicard_state::screen_update_magicard(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
	magicard_state *state = machine().driver_data<magicard_state>();
	int x,y;
	UINT32 count;

	bitmap.fill(get_black_pen(machine()), cliprect); //TODO

	if(!(SCC_DE_VREG)) //display enable
		return 0;

	count = ((SCC_VSR_VREG)/2);

	if(SCC_FG_VREG) //4bpp gfx
	{
		for(y=0;y<300;y++)
		{
			for(x=0;x<84;x++)
			{
				UINT32 color;

				color = ((m_magicram[count]) & 0x000f)>>0;

				if(cliprect.contains((x*4)+3, y))
					bitmap.pix32(y, (x*4)+3) = machine().pens[color];

				color = ((m_magicram[count]) & 0x00f0)>>4;

				if(cliprect.contains((x*4)+2, y))
					bitmap.pix32(y, (x*4)+2) = machine().pens[color];

				color = ((m_magicram[count]) & 0x0f00)>>8;

				if(cliprect.contains((x*4)+1, y))
					bitmap.pix32(y, (x*4)+1) = machine().pens[color];

				color = ((m_magicram[count]) & 0xf000)>>12;

				if(cliprect.contains((x*4)+0, y))
					bitmap.pix32(y, (x*4)+0) = machine().pens[color];

				count++;
			}
		}
	}
	else //8bpp gfx
	{
		for(y=0;y<300;y++)
开发者ID:Ilgrim,项目名称:MAMEHub,代码行数:48,代码来源:magicard.c

示例3: screen_update

uint32_t invqix_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
	int x,y;

	// this means freeze or blank or something
	if (m_vctl == 0x100)
	{
		return 0;
	}

	if (m_vctl == 0x0000)
	{
		for(y=0;y<256;y++)
		{
			for(x=0;x<256;x++)
			{
				uint8_t r,g,b;
				int pen_data;

				pen_data = (m_vram[(x+y*256)]);
				b = (pen_data & 0x001f);
				g = (pen_data & 0x03e0) >> 5;
				r = (pen_data & 0x7c00) >> 10;
				r = (r << 3) | (r & 0x7);
				g = (g << 3) | (g & 0x7);
				b = (b << 3) | (b & 0x7);

				if(cliprect.contains(x, y))
					bitmap.pix32(y, x) = r << 16 | g << 8 | b;
			}
		}
	}
	else if (m_vctl == 0x0001)  // flip
开发者ID:fesh0r,项目名称:mame-full,代码行数:33,代码来源:invqix.cpp

示例4: screen_update_jantotsu

UINT32 jantotsu_state::screen_update_jantotsu(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
	int x, y, i;
	int count = 0;
	UINT8 pen_i;

	if(!m_display_on)
		return 0;

	for (y = 0; y < 256; y++)
	{
		for (x = 0; x < 256; x += 8)
		{
			UINT8 color;

			for (i = 0; i < 8; i++)
			{
				color = m_col_bank;

				for(pen_i = 0;pen_i<4;pen_i++)
					color |= (((m_bitmap[count + pen_i*0x2000]) >> (7 - i)) & 1) << pen_i;

				if (cliprect.contains(x + i, y))
					bitmap.pix32(y, x + i) = machine().pens[color];
			}

			count++;
		}
	}

	return 0;
}
开发者ID:Ilgrim,项目名称:MAMEHub,代码行数:32,代码来源:jantotsu.c

示例5: screen_update_gunpey

UINT32 gunpey_state::screen_update_gunpey(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
	UINT16 *blit_buffer = m_blit_buffer;
	int x,y;
	int count;

	count = 0;

	for(y=0;y<512;y++)
	{
		for(x=0;x<512;x++)
		{
			UINT32 color;
			int r,g,b;
			color = (blit_buffer[count] & 0xffff);

			b = (color & 0x001f) << 3;
			g = (color & 0x03e0) >> 2;
			r = (color & 0x7c00) >> 7;

			if(cliprect.contains(x, y))
				bitmap.pix32(y, x) = b | (g<<8) | (r<<16);


			count++;
		}
	}

	return 0;
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例6: BIT

uint32_t hd44102_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	for (int y = 0; y < 50; y++)
	{
		int z = m_page << 3;

		for (int x = 0; x < 32; x++)
		{
			uint8_t data = m_ram[z / 8][y];

			int sy = m_sy + z;
			int sx = m_sx + y;

			if (cliprect.contains(sx, sy))
			{
				int color = (m_status & STATUS_DISPLAY_OFF) ? 0 : BIT(data, z % 8);

				bitmap.pix16(sy, sx) = color;
			}

			z++;
			z %= 32;
		}
	}
	return 0;
}
开发者ID:Tauwasser,项目名称:mame,代码行数:26,代码来源:hd44102.cpp

示例7: screen_update_lbeach

UINT32 lbeach_state::screen_update_lbeach(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	// draw bg layer (road)
	m_bg_tilemap->set_scrolly(0, *m_scroll_y);
	m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);

	// check collision
	int sprite_code = *m_sprite_code & 0xf;
	int sprite_x = *m_sprite_x * 2 - 4;
	int sprite_y = 160;

	m_colmap_car.fill(0, cliprect);
	m_gfxdecode->gfx(2)->transpen(m_palette,m_colmap_car,cliprect, sprite_code, 0, 0, 0, sprite_x, sprite_y, 0);
	bitmap_ind16 &fg_bitmap = m_fg_tilemap->pixmap();

	m_collision_bg_car = 0;
	m_collision_fg_car = 0;

	for (int y = sprite_y; y < (sprite_y + 16); y++)
	{
		for (int x = sprite_x; x < (sprite_x + 16) && cliprect.contains(x, y); x++)
		{
			m_collision_bg_car |= (bitmap.pix16(y, x) & m_colmap_car.pix16(y, x) & 1);
			m_collision_fg_car |= (fg_bitmap.pix16(y, x) & m_colmap_car.pix16(y, x) & 1);
		}
	}

	// draw fg layer (tiles)
	m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);

	// draw player car
	m_gfxdecode->gfx(2)->transpen(m_palette,bitmap,cliprect, sprite_code, 0, 0, 0, sprite_x, sprite_y, 0);

	return 0;
}
开发者ID:jiangzhonghui,项目名称:mame,代码行数:35,代码来源:lbeach.c

示例8: screen_update

UINT32 prestige_state::screen_update(int bpp, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	int width = m_lcdc.fb_width + m_lcdc.lcd_w + 1;

	for (int y = 0; y <= m_lcdc.lcd_h; y++)
	{
		int line_start;
		if (y <= m_lcdc.split_pos)
			line_start = m_lcdc.addr1 + y * width;
		else
			line_start = m_lcdc.addr2 + (y - m_lcdc.split_pos - 1) * width;

		for (int sx = 0; sx <= m_lcdc.lcd_w; sx++)
		{
			UINT8 data = m_vram[(line_start + sx) & 0x1fff];

			for (int x = 0; x < 8 / bpp; x++)
			{
				int pix = 0;
				for (int b=0; b<bpp; b++)
					pix |= BIT(data, 7 - b) << b;

				if (cliprect.contains(sx * 8 / bpp + x, y))
					bitmap.pix16(y, sx * 8 / bpp + x) = pix;

				data <<= bpp;
			}
		}
	}

	return 0;
}
开发者ID:dinkc64,项目名称:mame,代码行数:32,代码来源:prestige.c

示例9: screen_update_taitowlf

UINT32 taitowlf_state::screen_update_taitowlf(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
	int x,y,count;

	bitmap.fill(m_palette->black_pen(), cliprect);

	count = (0);

	for(y=0;y<256;y++)
	{
		for(x=0;x<512;x++)
		{
			UINT32 color;

			color = (m_bootscreen_rom[count] & 0xff);

			if(cliprect.contains(x+0, y))
				bitmap.pix32(y, x+0) = m_palette->pen(color);

			count++;
		}
	}

	return 0;
}
开发者ID:Archlogic,项目名称:libretro-mame,代码行数:25,代码来源:taitowlf.c

示例10: draw_stars

static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int flip)
{
	bosco_state *state = machine.driver_data<bosco_state>();

	if (1)
	{
		int star_cntr;
		int set_a, set_b;

		/* two sets of stars controlled by these bits */
		set_a = (state->m_bosco_starblink[0] & 1);
		set_b = (state->m_bosco_starblink[1] & 1) | 2;

		for (star_cntr = 0;star_cntr < MAX_STARS;star_cntr++)
		{
			int x,y;

			if ( (set_a == star_seed_tab[star_cntr].set) || ( set_b == star_seed_tab[star_cntr].set) )
			{
				x = (star_seed_tab[star_cntr].x + state->m_stars_scrollx) % 256;
				y = (star_seed_tab[star_cntr].y + state->m_stars_scrolly) % 256;

				/* dont draw the stars that are off the screen */
				if ( x < 224 )
				{
					if (flip) x += 20*8;

					if (cliprect.contains(x, y))
						bitmap.pix16(y, x) = STARS_COLOR_BASE + star_seed_tab[star_cntr].col;
				}
			}
		}
	}
}
开发者ID:vikke,项目名称:mame_0145,代码行数:34,代码来源:bosco.c

示例11: draw_box

void nitedrvr_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect, int bx, int by, int ex, int ey)
{
	for (int y = by; y < ey; y++)
	{
		for (int x = bx; x < ex; x++)
			if (cliprect.contains(x, y))
				bitmap.pix16(y, x) = 1;
	}
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例12: draw_pixel

void gpworld_state::draw_pixel(bitmap_rgb32 &bitmap,const rectangle &cliprect,int x,int y,int color,int flip)
{
	if (flip)
	{
		x = bitmap.width() - x - 1;
		y = bitmap.height() - y - 1;
	}

	if (cliprect.contains(x, y))
		bitmap.pix32(y, x) = m_palette->pen(color);
}
开发者ID:DragonMinded,项目名称:mame,代码行数:11,代码来源:gpworld.cpp

示例13: draw_pixel

INLINE void draw_pixel(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int color,int flip)
{
	if (flip)
	{
		x = bitmap.width() - x - 1;
		y = bitmap.height() - y - 1;
	}

	if (cliprect.contains(x, y))
		bitmap.pix16(y, x) = color;
}
开发者ID:risico,项目名称:jsmess,代码行数:11,代码来源:gpworld.c

示例14: draw_pixel

INLINE void draw_pixel(running_machine &machine, bitmap_rgb32 &bitmap,const rectangle &cliprect,int x,int y,int color,int flip)
{
	if (flip)
	{
		x = bitmap.width() - x - 1;
		y = bitmap.height() - y - 1;
	}

	if (cliprect.contains(x, y))
		bitmap.pix32(y, x) = machine.pens[color];
}
开发者ID:coinhelper,项目名称:jsmess,代码行数:11,代码来源:gpworld.c

示例15: query

int query(node *nd, rectangle r, rectangle qr)
{
    if (r.isBad()) return -INF;
    if (r.intersects(qr)) return -INF;
    if (qr.contains(r)) return nd->high;

    int q1 = query(nd->children[0], r.getLU(), qr);
    int q2 = query(nd->children[1], r.getRU(), qr);
    int q3 = query(nd->children[2], r.getLB(), qr);
    int q4 = query(nd->children[3], r.getRB(), qr);
    return max(max(q1, q2), max(q3, q4));
}
开发者ID:metaphysis,项目名称:Code,代码行数:12,代码来源:2.11.2.2.cpp


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