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


C++ Tetris::run方法代码示例

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


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

示例1: main

/////////////////////////////////////////////////
/// \brief Main function of the program.
///
/// Create a Tetris instance and run the game.
///
/// \param argc : Number of given command-line parameters.
/// \param argv : Command-line parameters.
/// \return Program ending status code.
/////////////////////////////////////////////////
int main(int argc, char* argv[])
{
    Tetris tetris;

    tetris.run();

    return EXIT_SUCCESS;
}
开发者ID:TheFakeCake,项目名称:Tetris-Clone,代码行数:17,代码来源:main.cpp

示例2: main

int main(int argc, char **argv) {
  try {
    Tetris game;
    game.run();
    return 0;
  }
  catch(const std::exception &exc) {
    std::cerr << exc.what() << std::endl;
  }
}
开发者ID:BlaiseRitchie,项目名称:WeirdTetris,代码行数:10,代码来源:main.cpp

示例3: main

int main( int argc, char** argv )
{
    (void)argc;
    (void)argv;

    try{
        Tetris tetris;
        tetris.run();
    }catch( std::exception& ex ){
        std::cerr << ex.what() << std::endl;
        return 1;
    }

	return 0;
}
开发者ID:moisesjbc,项目名称:moblok,代码行数:15,代码来源:main.cpp

示例4: main

int main (void) {
	cout << "Genetic Algorithm Tetris version 0.1" << endl;

	// The pieces that will allow us to play some tetris
	Tetris tetris;
	Controller controller;
	Display_Manager output;

	// Connect the pieces
	//tetris.input = controller;
	//output.feed = tetris.state;

	// Let it rip!
	tetris.run ();

	return 0;
}
开发者ID:abhinavchanda,项目名称:gen-alg-tetris,代码行数:17,代码来源:main.cpp

示例5: main

int main() {
	twi_init();
	srandom(0);

	//timer_init();
	
	DDRB = 0xff;
	PORTB = 0x00;

	uint16_t buttons;
	uint16_t changed;
	uint8_t selected = 0;
	
	matrix.setFont(font_3x5, codepage_ascii_caps, 3, 5);
	
	while (1) {
		psx.poll();
		buttons = psx.buttons();
		changed = psx.changed();
		if (buttons & PSB_SELECT && changed & PSB_SELECT) {
			selected++;
			selected %= 6;
		}
		else if (buttons & PSB_SQUARE && changed & PSB_SQUARE) {
			hsv.addHue(-30);
		}
		else if (buttons & PSB_CIRCLE && changed & PSB_CIRCLE) {
			hsv.addHue(30);
		}
		else if (buttons & PSB_PAD_DOWN && changed & PSB_PAD_DOWN) {
			uint8_t v = hsv.getValue();
			switch (v) {
				case 0xff: hsv.setValue(0x7f); break;
				case 0x7f: hsv.setValue(0x3f); break;
				case 0x3f: hsv.setValue(0x1f); break;
				case 0x1f: hsv.setValue(0x0f); break;
				case 0x0f: hsv.setValue(0x07); break;
				case 0x07: hsv.setValue(0x03); break;
				case 0x03: hsv.setValue(0x01); break;
				default: hsv.setValue(0x00);
			}
		}
		else if (buttons & PSB_PAD_UP && changed & PSB_PAD_UP) {
			uint8_t v = hsv.getValue();
			switch (v) {
				case 0x00: hsv.setValue(0x01); break;
				case 0x01: hsv.setValue(0x03); break;
				case 0x03: hsv.setValue(0x07); break;
				case 0x07: hsv.setValue(0x0f); break;
				case 0x0f: hsv.setValue(0x1f); break;
				case 0x1f: hsv.setValue(0x3f); break;
				case 0x3f: hsv.setValue(0x7f); break;
				default: hsv.setValue(0xff);
			}
		}
		else if (buttons & PSB_PAD_LEFT && changed & PSB_PAD_LEFT) {
			uint8_t s = hsv.getSaturation();
			switch (s) {
				case 0xff: hsv.setSaturation(0xfe); break;
				case 0xfe: hsv.setSaturation(0xfc); break;
				case 0xfc: hsv.setSaturation(0xf8); break;
				case 0xf8: hsv.setSaturation(0xf0); break;
				case 0xf0: hsv.setSaturation(0xe0); break;
				case 0xe0: hsv.setSaturation(0xc0); break;
				case 0xc0: hsv.setSaturation(0x80); break;
				default: hsv.setSaturation(0x00);
			}
		}
		else if (buttons & PSB_PAD_RIGHT && changed & PSB_PAD_RIGHT) {
			uint8_t s = hsv.getSaturation();
			switch (s) {
				case 0x00: hsv.setSaturation(0x80); break;
				case 0x80: hsv.setSaturation(0xc0); break;
				case 0xc0: hsv.setSaturation(0xe0); break;
				case 0xe0: hsv.setSaturation(0xf0); break;
				case 0xf0: hsv.setSaturation(0xf8); break;
				case 0xf8: hsv.setSaturation(0xfc); break;
				case 0xfc: hsv.setSaturation(0xfe); break;
				default: hsv.setSaturation(0xff);
			}
		}
		else if (buttons & PSB_START && changed & PSB_START) {
			switch (selected) {
				case 0: { Clock clk; clk.run(); break; }
				case 1: { AltClock alt; alt.run(); break; }
				case 2: { Life life; life.run(); break; }
				case 3: { Mood mood; mood.run(); break; }
				case 4: { Animated ani; ani.run(); break; }
				case 5: { Tictactoe ttt; ttt.run(); break; }
				case 6: { Tetris tet; tet.run(); break; }
			}
		}
		
		matrix.setColor(0,0,0);
		matrix.rectangle(0,0,11,11, DRAW_FILLED);
		matrix.setColor(Rgb(hsv));
		switch (selected) {
			case 0: matrix.text(0, 3, "CLK", DRAW_ORIENTATION_0); break;
			case 1: matrix.text(0, 3, "ALT", DRAW_ORIENTATION_0); break;
			case 2: matrix.text(0, 3, "LIF", DRAW_ORIENTATION_0); break;
//.........这里部分代码省略.........
开发者ID:imaculate,项目名称:microcontroller-projects,代码行数:101,代码来源:LedTable.cpp


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