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


C++ drawMap函数代码示例

本文整理汇总了C++中drawMap函数的典型用法代码示例。如果您正苦于以下问题:C++ drawMap函数的具体用法?C++ drawMap怎么用?C++ drawMap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: playGame

bool playGame(Affichage A, Damier *map, Snake *snake, Sound sound)
{
	int end = 0;
	bool win = FALSE;
	Position newPos = initPosition();
	Input input = initInput();
	Chrono chrono = initChrono();
	Timer timer = initTimer();
	
	
	setProiesToMap(map);
	
	drawTile(A, TILE_TITLE);
	drawTextChrono(chrono, A);
	drawMap(A, *map, newPosition(MAXCASES/2 + 3,MAXCASES/2), *snake);

	startChrono(&chrono);
	while (1)
	{
		
		setTimer(&timer);
		newPos = updatePositions(map, snake, &input);
		
		if (input.end)
			break;

		if (testPosMap(newPos))
		{
			end = addPositionSnake(map, snake, newPos, sound);
			if (end)
			{
				win = FALSE;
				break;
			}
		}
		
		setPositionsToMap(map, snake);
		drawChrono(chrono, A);
		drawMap(A, *map, newPos, *snake);
		
		if(endChrono(chrono))
		{
			win = FALSE;
			break;
		}
		
		if (endGame(map))
		{
			win = TRUE;
			break;
		}
		
		reguleFPS(&timer);
	}
	
	deleteChrono(&chrono);
	return win;
}
开发者ID:idr77,项目名称:SnakeGame,代码行数:58,代码来源:game.c

示例2: drawMap

 /**
  * \brief   Draws the base map, voronoi points and critical points, lines
  *          and regions on to image. Should be only used for testing the 
  *          output for Topological Mapper.
  * \param   image OpenCV image we are drawing output on 
  */
 void TopologicalMapper::drawOutput(cv::Mat &image) {
   VoronoiApproximator::drawOutput(image);
   drawMap(image, 2 * map_resp_.map.info.width);
   drawConnectedComponents(image, 2 * map_resp_.map.info.width);
   drawCriticalPoints(image, 2 * map_resp_.map.info.width);
   drawMap(image, 3 * map_resp_.map.info.width);
   drawRegionGraph(image, 3 * map_resp_.map.info.width);
   drawMap(image, 4 * map_resp_.map.info.width);
   drawPointGraph(image, 4 * map_resp_.map.info.width);
 }
开发者ID:YuqianJiang,项目名称:bwi_common,代码行数:16,代码来源:topological_mapper.cpp

示例3: display

void display(void)
{
	// Clear the color buffer, restore the background
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	// Load the identity matrix, clear all the previous transformations
	glLoadIdentity();
	// Set up the camera
	mot_MoveCamera();
	// Collisions with blocks
	doMagic();
	mot_SetCamera();
	// Set light position
	vect_Vector eyePos = mot_GetEyePos(), targetPos = mot_GetTargetPos(), pos;
	pos = vect_Substract(targetPos, eyePos);
	vect_Normalize(&pos);
	pos = vect_Multiply(pos, -1);
	pos = vect_Add(pos, eyePos);
	lightPos[0] = pos.x;
	lightPos[1] = pos.y;
	lightPos[2] = pos.z;
	glLightfv(GL_LIGHT0, GL_POSITION, lightPos);

	drawMap(Map);

	drawGuides();

	// Swap buffers in GPU
	glutSwapBuffers();
}
开发者ID:OriginalNexus,项目名称:Timix,代码行数:29,代码来源:MapCreator.c

示例4: display

//Main display function
void display(void)
{

	glClearColor(0.2f, 0.3f, 1.0f, 0.9f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glColor3f(0.0f, 0.0f, 0.0f);

	glPushMatrix();
	glMatrixMode(GL_MODELVIEW);
	glViewport(0, (WINDOW_HEIGHT / 3) * 2, WINDOW_WIDTH, WINDOW_HEIGHT - (WINDOW_HEIGHT / 3) * 2);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0.0, (GLdouble)WINDOW_WIDTH, (WINDOW_HEIGHT / 3) * 2, (GLdouble)WINDOW_HEIGHT, -1.0, 1.0);

	//draw the user interface **NOT THE MINI MAP**
	drawUI();

	glPopMatrix();
	glPushMatrix();
	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);

	//draw the actual world, with lighting
	theWorld.Draw(continuousRendering);
	glDisable(GL_LIGHTING);
	glPopMatrix();

	//draw the mini map interface 
	drawMap();
	glutSwapBuffers();
}
开发者ID:rhilsabeck,项目名称:OpenGL_3D_World,代码行数:32,代码来源:main.cpp

示例5: drawHUD

void drawHUD(ViewCamera& currentView, PlayerController* player, GameWorld* world, GameRenderer* render)
{
	if(player && player->getCharacter()) {
		drawMap(currentView, player, world, render);
		drawPlayerInfo(player, world, render);
	}
}
开发者ID:LeonardKoenig,项目名称:openrw,代码行数:7,代码来源:DrawUI.cpp

示例6: updateEvents

void LabEngine::doMap() {
	static uint16 amigaMapPalette[] = {
		0x0BA8, 0x0C11, 0x0A74, 0x0076,
		0x0A96, 0x0DCB, 0x0CCA, 0x0222,
		0x0444, 0x0555, 0x0777, 0x0999,
		0x0AAA, 0x0ED0, 0x0EEE, 0x0694
	};

	_graphics->_fadePalette = amigaMapPalette;

	updateEvents();
	loadMapData();
	_graphics->blackAllScreen();
	_interface->attachButtonList(&_mapButtonList);
	drawMap(_roomNum, _roomNum, _maps[_roomNum]._pageNumber, true);
	_event->mouseShow();
	_graphics->screenUpdate();
	processMap(_roomNum);
	_event->mouseHide();
	_interface->attachButtonList(nullptr);
	_graphics->fade(false);
	_graphics->blackAllScreen();
	_graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1, 0);
	freeMapData();
	_event->mouseShow();
	_graphics->screenUpdate();
}
开发者ID:Cruel,项目名称:scummvm,代码行数:27,代码来源:map.cpp

示例7: drawMap

void cOutput::drawFrameUnitSelection(Uint32 ticks)
{
    drawMap();
    drawEntities();
    if(pUnitSelectionInputs->doDrawRect){ drawSelectionRectangle(&(pUnitSelectionInputs->DrawRect)); }

    if(selectedNumber > 0)
    {
        drawUnitHud(ticks);
    }
    else if(selectedBuildings > 0)
    {
        ///TODO
        //drawBuildingHud();
    }

    if(drawAoe != -1)
    {
        applyDrawAoe((pMousePosition->X)/TILE_WIDTH,(pMousePosition->Y)/TILE_HEIGHT,drawAoe);
    }
    // Draw the cursor
    cSurface::Draw(mScreen,cursorGraphic[pUnitSelectionInputs->cursorType],pMousePosition->X+CURSOR_OFFSET_X,pMousePosition->Y+CURSOR_OFFSET_Y);

    //Show the new screen
    SDL_Flip(mScreen);
}
开发者ID:DaJulian,项目名称:proJectRTS,代码行数:26,代码来源:cOutput.cpp

示例8: setup

void setup(void) {
  Serial.begin(9600);
  pinMode(JOYSTICK_BUTTON, INPUT);
  pinMode(RATING_LED_0, OUTPUT);
  pinMode(RATING_LED_1, OUTPUT);
  pinMode(RATING_LED_2, OUTPUT);
  pinMode(RATING_LED_3, OUTPUT);
  pinMode(RATING_LED_4, OUTPUT);

  digitalWrite(JOYSTICK_BUTTON, HIGH);

  tft.initR(INITR_REDTAB);

  Serial.print("Initializing SD card...");
  if (!SD.begin(SD_CS)) {
    Serial.println("failed!");
    return;
  }
  Serial.println("OK!");

  drawMap();

  // test out reading blocks from the SD card
  if (!card.init(SPI_HALF_SPEED, SD_CS)) {
      Serial.println("Raw SD Initialization has failed");
      while (1) {};  // Just wait, stuff exploded.
  }

  verticalMidpoint = getVertical();
}
开发者ID:adamjford,项目名称:assignment2,代码行数:30,代码来源:assignment2.cpp

示例9: navigateToWaypoint

void navigateToWaypoint(float xtarget, float ytarget)
{
    while(!atTarget(xtarget, x) || (!atTarget(ytarget, y)))
    {
        float distance = calcDistance(xtarget, ytarget);
        float angle = calcAngle(xtarget, ytarget);

        float driveDistance = 0; //initialise
        if (distance < stepDistance)
        {
            driveDistance = distance;
        }
        else
        {
            driveDistance = stepDistance;
        }

        // co-ordinate system is different so cos and sin are swapped - take from current location not origin
        float tempWaypointX = x + (driveDistance * cos(angle));
        float tempWaypointY = y + (driveDistance * sin(angle));


        driveToWaypoint(tempWaypointX, tempWaypointY);
        monteCarlo();

        eraseDisplay();
        drawMap();
        drawParticles();
        wait1Msec(100);

    }

    PlayTone(784, 15);
}
开发者ID:giovannic,项目名称:robotics,代码行数:34,代码来源:expMC.c

示例10: ABPointMake

BAGamesCommand BAGame::enemyRound(){
    // store information
  ABPoint playerCursor = ABPointMake(6, 4);
  ABPoint selectedTargetTile = ABPointMake(-1, -1);
  bool targetLocked = false;
  bool cursorFlip = true;

  while(true){
    if (!arduboy.nextFrame()) continue;
    if (arduboy.everyXFrames(10)) cursorFlip = !cursorFlip;

    // handle input
    globalInput.updateInput();

    if(globalInput.pressed(B_BUTTON)){
       playSoundSuccess();
       return BAGamesCommandNext;
    }

    // clear screen
    arduboy.clear();

    // Draw map of enemy
    drawMap(player, true);

    arduboy.display();
  }
}
开发者ID:yinkou,项目名称:BattleshipAdvanced-Arduboy,代码行数:28,代码来源:BAGame.cpp

示例11: startGame

void startGame(LifeMap& gameMap) {
    int step;
        
    for(step = 0; gameMap.isChange(); step++) {
        gamePlay::showGamePlayInfo(step, gameMap);
        drawMap(gameMap);
        TCODConsole::root->flush();

        gameMap.nextStep();
        Sleep(delay);

        TCOD_key_t key = TCODConsole::checkForKeypress();
        if(key.c == 'p') {
            gamePlay::showPause();
            TCODConsole::waitForKeypress(true);
        }
        else {
            if(key.vk == TCODK_ESCAPE)
                break;
        }
    }
    
    if(!gameMap.isChange()) {
        gamePlay::showFinish();
        TCODConsole::waitForKeypress(true);
    }

    gamePlay::showScore(step-1, gameMap);
    while(TCODConsole::waitForKeypress(true).vk != TCODK_ESCAPE) {}
}
开发者ID:GromHoll,项目名称:ColorLife,代码行数:30,代码来源:main.cpp

示例12: drawMap

int Model::step() {

	drawMap();
	int res;
	while (1) {
		for(vector<PlayerPtr>::iterator it=players.begin()+1; it!=players.end(); ++it) {
			if((res = players.begin()->get()->turn()) != GAME_RUNNING) 
				return res;
			
			if((res = it->get()->turn()) != GAME_RUNNING)	 //Each player implements his own turn() method (ai or real)
				if (res != GAME_NO_WAY)
					return res;								
				
			drawMap();
		}
	}
}
开发者ID:filiroman,项目名称:run_game,代码行数:17,代码来源:model.cpp

示例13: drawImage

void LEditor::draw()
{
    drawImage(background, 0, 0);

    drawMap();

    SDL_Flip(screen);
}
开发者ID:zassyne,项目名称:C_SDL_game,代码行数:8,代码来源:LEditor.cpp

示例14: SDL_BlitSurface

void App::updateDisplay()
{
	//Apply the image
	SDL_BlitSurface(bgIMG, NULL, mainWin.gScreenSurface, NULL);
	drawMap();
	//Update the surface
	SDL_UpdateWindowSurface(mainWin.gWindow);
}
开发者ID:milkoc,项目名称:SI_Pathfinder,代码行数:8,代码来源:App.cpp

示例15: main

task main() {
	clearDebugStream();
	nMotorEncoder[LEFT_WHEEL] = 0;
	nMotorEncoder[RIGHT_WHEEL] = 0;

	bPlaySounds = true;
	set_starting_position(84.0, 30.0, 0.0);

	drawMap();

	StartTask(vehicle_compute_position);
	//StartTask(vehicle_draw_position);

	navigate_to_waypoint(104, 30);
	drawParticles();
	navigate_to_waypoint(124, 30);
	drawParticles();
	navigate_to_waypoint(144, 30);
	drawParticles();
	navigate_to_waypoint(180, 30);
	drawParticles();
	navigate_to_waypoint(180, 54);
	drawParticles();
	navigate_to_waypoint(164, 54);
	drawParticles();
	navigate_to_waypoint(126, 54);
	drawParticles();
	// Moved left
	// Going up
	navigate_to_waypoint(126, 74);
	drawParticles();
	navigate_to_waypoint(126, 94);
	drawParticles();
	navigate_to_waypoint(126, 104);
	drawParticles();
	navigate_to_waypoint(126, 124);
	drawParticles();
	navigate_to_waypoint(126, 144);
	drawParticles();
	navigate_to_waypoint(126, 168);
	drawParticles();
	navigate_to_waypoint(126, 148);
	drawParticles();
	navigate_to_waypoint(126, 126);
	drawParticles();
	// From here, move in 20 cm ranges
	navigate_to_waypoint(30, 54);
	drawParticles();
	navigate_to_waypoint(84, 54);
	drawParticles();
	navigate_to_waypoint(84, 30);
	drawParticles();

  StopTask(vehicle_compute_position);
  //StopTask(vehicle_draw_position);

  wait10Msec(60000); // wait 1MIN
}
开发者ID:xdanx,项目名称:dandroid,代码行数:58,代码来源:MCL.c


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