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


C++ Page::Draw方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........
	globals = new GlobalData();
	
	// starting
	SetBG(0, 10, 10);
	
	globals->LoadSongs();
	
	// starting
	SetBG(10, 0, 10);
	
	u16 i = 0;
	Keys *keys = new Keys();
	First *firstpage = new First(keys);
	Page *selected = firstpage;
	
	// init krawall
	kragInit( KRAG_INIT_STEREO );
	
	// make it so we can see the background
	REG_BG1CNT = BIT(7) | BIT(8) | BIT(9) | BIT(10) | BIT(11) | BIT(12); // high priority, 256 colour, point the banks at the right place etc
	
	// load the splash screen
	DMA3COPY((void*)splash_tiles, (u16*)VideoBuffer, SPLASH_TILESIZE | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC);
	DMA3COPY((void*)splash_palette, (u16*)&BG_PALETTE[5], SPLASH_PALSIZE | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC);
	DMA3COPY((void*)splash_map, (u16*)&VideoBuffer[0x7C00], 640 | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC);
	
	// check keys
	while (keys->TestKey(keyA) != pressed)
	{
		keys->Jiffie();
	}
	keys->Jiffie();
	
	// load the krawall splash screen
	DMA3COPY((void*)krawall_splash_tiles, (u16*)VideoBuffer, KRAWALL_SPLASH_TILESIZE| DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC);
	DMA3COPY((void*)krawall_splash_palette, (u16*)&BG_PALETTE[5], KRAWALL_SPLASH_PALSIZE | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC);
	DMA3COPY((void*)krawall_splash_map, (u16*)&VideoBuffer[0x7C00], 640 | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC);
	
	// check keys
	while (keys->TestKey(keyA) != pressed)
	{
		keys->Jiffie();
	}
	keys->Jiffie();
	
	// load charset into memory as a demo tileset
	DMA3COPY((void*)font::tiles, (u16*)VideoBuffer, 3232 | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC);
	DMA3COPY((void*)font::tiles_color, (u16*)&VideoBuffer[3232], 3232 | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC);
	
	// set up the background palette
	for (i=0;i<7;i++)
		BG_PALETTE[i] = RGB(0, 0, 0);
	// this starts from 7 becuase the kludgy legacy converter used a 7-color offset (for parallax-starfield reasons)
	
	BG_PALETTE[7] = RGB(0x1F, 0x1F, 0x1F);
	BG_PALETTE[8] = RGB(0, 0, 0);
	
	// set the H and V offset of our background to zero
	// REG_BG1HOFS = 0;	
	// REG_BG1VOFS = 0;
	
	// clear out the whole area
	BlankScreen();
	
	while (1)
	{
		// this is zerosync
		SetBG(0, 0, 10);
		
		// figure out all our latest song positions
		globals->Tick();
		// calculate audio stuff
		kramWorker();
		// update midi progression
		midiUpdateBeat(globals->beat);
		// check keys
		keys->Jiffie();
		// automatically cascades all pages and processes them
		firstpage->Process();
		
		SetBG(0, 0, 0);
		
		// this is vsync
                //while( !REG_VCOUNT );
                //while( REG_VCOUNT );
		
		// try and fit the drawing stuff into the off-screen sync
		while(REG_VCOUNT != 160);
		
		SetBG(10, 0, 0);
		// do all the display shit in here
		BlankScreen();
		selected = selected->Cycle();
		selected->Draw();
		
		SetBG(0, 0, 0);
	}
	
	return 1;
}
开发者ID:chr15m,项目名称:LooperAdvance,代码行数:101,代码来源:main.cpp


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