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


C++ Navigator::setHeight方法代码示例

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


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

示例1: run

int Game::run(int argc, char* argv[])
{
	/* INITIALIZATION */
	SDL_Init(SDL_INIT_EVERYTHING);
	atexit(SDL_Quit);
	
	SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32);
	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
	SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 8);
	SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
	
	screen = SDL_SetVideoMode(mScreenSize.width, mScreenSize.height, 0, SDL_OPENGL);
	SDL_WM_SetCaption("gl2d", "gl2d");
	SDL_EnableUNICODE(1);
	
	glViewport(0, 0, screen->w, screen->h);
	glFrustum(0.0, screen->w, screen->h, 0.0, 300.0, 500.0);
	glTranslatef(0.0, 0.0, -300.0);
	
	glClearColor(0.0, 0.0, 0.0, 0.0);	
	
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_BLEND);
	
	glEnable(GL_MULTISAMPLE_ARB);
	
	/* INIT JS */
	v8::HandleScope handle_scope;
	v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
	Script::initializeGlobalTemplate(global);
	v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
	v8::Context::Scope context_scope(context);
	Script::setContext(context);
	
	Script::load("main.js");
	
	
	/* ALL CLEAR -- START HAVING FUN */
	Background bg;
	bg.setZIndex(-100.0);
	bg.setTexture(Texture::fromFile("heineken.jpg"));
	bg.setClipSize(Vector(600, 400));
	
	
	triangle = new RotatingTriangle;
	triangle->setZIndex(-1.0);
	widget = new Button;
	
	Texture* tex = Texture::fromFile("salmon.png");
	Block* b1 = new Block(Rect(300, 300, 50, 80), -60);
	b1->setTexture(tex);
	Block* b2 = new Block(Rect(200, 200, 100, 20), 15);
	
	Block* simon = new Block(Rect(1000, 500, 800, 800), 80);
	simon->setTexture(Texture::fromFile("foto.jpg"));
	
	YinYang* yy = new YinYang(Point(500, 500), 24);
	
	Navigator nav;
	nav.setZIndex(100);
	nav.setHeight(100);
	
	/* GAME LOOP */
	while (!done)
	{
		int now = SDL_GetTicks();
		
		handleEvents();
		
		if (b1->contains(mMousePosition))
		{
			b1->setTexture(NULL);
		}
		else
		{
			b1->setTexture(tex);
		}
		
		update();
		render();
				
		// Maintain a stable FPS.
		now -= SDL_GetTicks();
		if (now < MILLISECONDS_PER_FRAME && !done)
		{
			SDL_Delay(MILLISECONDS_PER_FRAME - now);
		}
		
		calculateFps();
		
		++frames;
	}
	
	/* CLEANUP */
	delete tex;
	delete b1;
	delete b2;
//.........这里部分代码省略.........
开发者ID:simonask,项目名称:gl2d,代码行数:101,代码来源:Game.cpp


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