Ejemplo n.º 1
0
	//Callback invoked by UzeboxCore.Initialize()
	void DisplayLogo(){
	
		#if INTRO_LOGO !=0
			#define LOGO_X_POS 8
			
			InitMusicPlayer(logoInitPatches);
			screenSections[0].tileTableAdress=uzeboxlogo;
					
			//draw logo
			ClearVram();
			WaitVsync(15);		


			#if INTRO_LOGO == 1 
				TriggerFx(0,0xff,true);
			#endif

			DrawMap(LOGO_X_POS,12,map_uzeboxlogo);
			WaitVsync(3);
			DrawMap(LOGO_X_POS,12,map_uzeboxlogo2);
			WaitVsync(2);
			DrawMap(LOGO_X_POS,12,map_uzeboxlogo);

			#if INTRO_LOGO == 2
				SetMasterVolume(0xc0);
				TriggerNote(3,0,16,0xff);
			#endif 
		
			WaitVsync(65);
			ClearVram();
			WaitVsync(20);
		#endif	
	}
Ejemplo n.º 2
0
	//Callback invoked by UzeboxCore.Initialize()
	void DisplayLogo(){
	
		#if INTRO_LOGO !=0
			#define LOGO_X_POS 18
			
			InitMusicPlayer(logoInitPatches);
			SetTileTable(uzeboxlogo);
					
			//draw logo
			ClearVram();
			WaitVsync(15);		


			#if INTRO_LOGO == 1 
				TriggerFx(0,0xff,true);
			#endif

			DrawMap(LOGO_X_POS,12,map_uzeboxlogo);
			WaitVsync(6);
			DrawMap(LOGO_X_POS,12,map_uzeboxlogo2);
			WaitVsync(4);
			DrawMap(LOGO_X_POS,12,map_uzeboxlogo);

			#if INTRO_LOGO == 2
				SetMasterVolume(0xc0);
				TriggerNote(3,0,16,0xff);
			#endif 
		
			WaitVsync(64);
			ClearVram();
			WaitVsync(20);
		#endif	
	}
void MainWindow::refresh()
{
    //qDebug()<<"REFRESH";

    DrawMap();      //KARTE loeschen und neu zeichnen

    if(ui->schubsenden->isChecked())
    {
        schubsenden();  //Aktuelle Schubwerte über XbeeCom senden
    }



    if(ui->sim->isChecked())
    {
        qDebug() << "start sim";
        z.schub[0]=y.schub[0];
        z.schub[1]=y.schub[1];
        z.sim();
        x.xList.prepend(z.xList.at(0));
        x.yList.prepend(z.yList.at(0));
        y.xList.prepend(x.xList.at(0));
        y.yList.prepend(x.yList.at(0));
        y.Ausrichtung.prepend(z.start_ausrichtung);
        y.start();
    }

    if(ui->pos_rechne->isChecked())
    {

        x.wrapper();  //Positionsbestimmung
    }

    if(ui->flug->isChecked())
    {
        y.xList.prepend(x.xList.at(0));
        y.yList.prepend(x.yList.at(0));        
        y.start(); //Regelung und Weg
    }
    if(ui->hoehe->isChecked())
    {
       y.zList.prepend(x.zList.at(0));
       y.hoehensteuerung(); //Hoehensteuerung
    }
    if (y.ziel==true)
    {
        ui->flug->setCheckState(Qt::Unchecked);
        y.ziel=false;
    }


    DrawMap();      //KARTE loeschen und neu zeichnen
}
Ejemplo n.º 4
0
void Game::Display()
{
	if (state == INIT) return;

	glClearColor(56.0/255.0, 123.0/255.0, 177.0/255.0, 0.0);	// set Background color
	glClear( GL_COLOR_BUFFER_BIT );
	glLoadIdentity();

	double teddy_x = 0, teddy_y = 0;	// character centered view 일 때 시점 계산하는 변수
	double teddy_status = kuma->getMovingStatus();
	if(teddy_moving == true) {
		switch(kuma->getDest()) {
		case Teddy::up:
			teddy_y = teddy_status / MAX_TILE_MOVESTATE - 1.0;
			break;
		case Teddy::down:
			teddy_y = -teddy_status / MAX_TILE_MOVESTATE + 1.0;
			break;
		case Teddy::left:
			teddy_x = -teddy_status / MAX_TILE_MOVESTATE + 1.0;
			break;
		case Teddy::right:
			teddy_x = teddy_status / MAX_TILE_MOVESTATE - 1.0;
			break;
		}
	}
	gluLookAt( eye_x + (static_view == false)*(FIGURE_SIZE * (cursor_x - MAP_WIDTH/2.0 + teddy_x)),
		eye_y + (static_view == false)*(FIGURE_SIZE * (cursor_y - MAP_WIDTH/2.0 + teddy_y)),
		eye_z,
		0.0 + (static_view == false)*(FIGURE_SIZE * (cursor_x - MAP_WIDTH/2.0 + teddy_x)),
		0.0 + (static_view == false)*(FIGURE_SIZE * (cursor_y - MAP_WIDTH/2.0 + teddy_y)),
		0.0,
		0.0, 0.0, 1.0 );

	if(state == START) {
		DrawMap();
		kuma->Draw();
	}
	else if(state == END) {
		DrawMap();
		kuma->Draw(true);
	}

	Write_score();
	Write_combo();

	glutSwapBuffers();
}
Ejemplo n.º 5
0
DBThread::DBThread()
 : database(std::make_shared<osmscout::Database>(databaseParameter)),
   locationService(std::make_shared<osmscout::LocationService>(database)),
   mapService(std::make_shared<osmscout::MapService>(database)),
   daylight(true),
   painter(NULL),
   iconDirectory(),
   pendingRenderingTimer(this),
   currentImage(NULL),
   currentCoord(0.0,0.0),
   currentAngle(0.0),
   currentMagnification(0),
   finishedImage(NULL),
   finishedCoord(0.0,0.0),
   finishedMagnification(0),
   dataLoadingBreaker(std::make_shared<QBreaker>()),
   renderError(false)
{
  osmscout::log.Debug() << "DBThread::DBThread()";

  QScreen *srn=QApplication::screens().at(0);

  dpi=(double)srn->physicalDotsPerInch();

  pendingRenderingTimer.setSingleShot(true);

  connect(this,SIGNAL(TriggerInitialRendering()),
          this,SLOT(HandleInitialRenderingRequest()));

  connect(&pendingRenderingTimer,SIGNAL(timeout()),
          this,SLOT(DrawMap()));

  connect(this,SIGNAL(TileStatusChanged(const osmscout::TileRef&)),
          this,SLOT(HandleTileStatusChanged(const osmscout::TileRef&)));

  //
  // Make sure that we always decouple caller and receiver even if they are running in the same thread
  // else we might get into a dead lock
  //

  connect(this,SIGNAL(TriggerDrawMap()),
          this,SLOT(DrawMap()),
          Qt::QueuedConnection);

  osmscout::MapService::TileStateCallback callback=[this](const osmscout::TileRef& tile) {TileStateCallback(tile);};

  callbackId=mapService->RegisterTileStateCallback(callback);
}
Ejemplo n.º 6
0
	void Map::Draw()
	{
		Cull();
		DrawMap(0);
		//DrawMap(1);
		//DrawMap(2);
	}
Ejemplo n.º 7
0
global func DrawIslands(iX, iY, iWidth, iHeight)
{
 DrawMap(iX, iY, iWidth, iHeight, "map new { overlay { algo=bozo; turbulence=100; loosebounds=1; a=10; } & overlay { algo=rndchecker; turbulence=1000; a=1; mat=Earth; tex=Rough; overlay { algo=random; mat=Earth; tex=Smooth; }; overlay InEarth { grp=1; invert=1;overlay { algo=bozo; a=6; turbulence=1000; } & overlay { algo=rndchecker; a=2;turbulence=1000; mat=Rock; tex=Rough; };}; InEarth & overlay { mat=Gold; tex=Rough; }; InEarth & overlay { mat=Coal; tex=Swirl; };};overlay { algo=poly;point { x=0px; y=0px; };point { x=1px; y=0px; };point { x=1px; y=100%; };point { x=0px; y=100%; };}; overlay { algo=poly;point { x=99%; y=0px; };point { x=100%; y=0px; };point { x=100%; y=100%; };point { x=99%; y=100%; };}; overlay { algo=poly;point { x=0%; y=0px; };point { x=100%; y=0px; };point { x=100%; y=1%; };point { x=0%; y=1%; };};overlay { algo=poly;point { x=0%; y=99%; };point { x=100%; y=99%; };point { x=100%; y=100%; };point { x=0%; y=100%; };}; };");
 for(var x=0; x < iWidth; x++)
   for(var y=0; y < iHeight; y++)
     DrawMaterialQuad (MaterialName(GetMaterial(x+iX, y+iY)), LandscapeWidth()-x-iX, y+iY, LandscapeWidth()-x-iX, y+iY+1, LandscapeWidth()-x-iX+1, y+iY+1, LandscapeWidth()-x-iX+1, y+iY);
}
Ejemplo n.º 8
0
//自绘界面
void CRadarMapCtrl::OnCustomDraw(CDC *pDC)
{
	DrawBg();

	DrawCoordinate();

	if(m_map_bkgrdMap.bReady)
	{
		DrawMap();
	}
	if(m_map_warningResult.objNum>0)
	{
		DrawWarningResult();
	}
	if(m_map_warningObjects.size()>0
		&& (m_state==RDPlayBack))
	{
		PlayBackWaringObject();
	}
	
	if(m_zoomInBtn != NULL)
		m_zoomInBtn->Draw(&m_dcMemory);	
	if(m_zoomOutBtn != NULL)
		m_zoomOutBtn->Draw(&m_dcMemory);
	
	DrawState(pDC);
	
	//最后统一拷贝到PDC中,双缓冲
	CRect   rect;   
	GetClientRect(&rect);   
	pDC->BitBlt(0,0,rect.Width(),rect.Height(),&m_dcMemory,0,0,SRCCOPY);

}
Ejemplo n.º 9
0
int main (void)
{

    StartCurses();
    DrawMenu();

    Level lvl;
    TowerList tList;            // Tower List
    UnitList uList;             // Unit List
    UnitList sQueue;            // Spawn queue
    PathList pList;             // Path list
    UnitList PDUL;

    // Initializing variables
    TowerInitialize(&tList);
    UnitInitialize(&uList);
    UnitInitialize(&sQueue);
    UnitInitialize(&PDUL);
    PathInitialize(&pList);
    ReadStandardUnits(&PDUL);

    ReadFile(1, &tList, &pList, &lvl);

    DrawAvailableUnits(&lvl,&PDUL);
    refresh();
    DrawMap(&tList,&pList);
    PrintArrows(&pList);
    PrintUnitSelection();
    ClearMap();
    LeaderBoard();
    getchar();

    EndCurses();
}
Ejemplo n.º 10
0
void CSignalView::OnPaint()
{
    //CPaintDC dc(this); // device context for painting
    GetClientRect(&m_SignalRect);

    if(!m_bUpdateLocal)
    {
        CDC *pDC = GetDC();
        CDC MemDC;
        MemDC.CreateCompatibleDC(NULL);
        CBitmap Memmap;
        Memmap.CreateCompatibleBitmap(pDC , m_SignalRect.Width(),m_SignalRect.Height());
        CBitmap *pOldMap = MemDC.SelectObject(&Memmap);
        ReDrawmap(&MemDC);
        pDC->BitBlt(0,0,m_SignalRect.Width(),m_SignalRect.Height(),&MemDC,0,0,SRCCOPY);
        ReleaseDC(pDC);
        MemDC.SelectObject(pOldMap);
        Memmap.DeleteObject();
        MemDC.DeleteDC();
        m_bUpdateLocal = false;
    }
    else
    {
        CDC *pDC = GetDC();
        if (pDC != NULL)
        {
            DrawMap(pDC, m_NewSignalData.GetData(), m_NewSignalData.GetDataSize());
            ReleaseDC(pDC);
        }
        else
            ReleaseDC(pDC);
        m_bUpdateLocal = TRUE;
    }
    CWnd::OnPaint();
}
Ejemplo n.º 11
0
void RDMarkerBar::setMarker(Marker marker,int msecs)
{
  if(marker>=RDMarkerBar::MaxSize) {
    return;
  }
  marker_pos[marker]=msecs;
  DrawMap();
}
Ejemplo n.º 12
0
void    Canvas::OnUpdate(QPainter &painter)
{
  DrawMap(painter);
  DrawSnakeBody(painter);
  //DrawSnakeTongue(painter, QPoint(12, 10), RIGHT);
  DrawSnakeHead(painter);
  if (_die)
    _t.stop();
}
Ejemplo n.º 13
0
/**
*@brief Draws the main game in inventory
*/
int StateInventory()
{
		SDL_RenderClear(GetRenderer());	
		SDL_SetRenderTarget(GetRenderer(),game->mainSceneTexture);
		SDL_RenderClear(GetRenderer());
		SDL_SetRenderTarget(GetRenderer(),NULL);
		DrawMap(1,0,0,game->mainSceneTexture);
		DrawMap(2,0,0,game->mainSceneTexture);
		DrawMap(3,0,0,game->mainSceneTexture);
		DrawMap(0,0,0,game->mainSceneTexture);
		SetCamera(*game->camera,hotBox);
		DrawEntities();
		DrawMainScene();
		DrawSpecialLayer(map);
		DrawInventory(playerData->inventory);
		NextFrame();
		return 0;
}
Ejemplo n.º 14
0
int main()
{

	std::vector< Coord > path;
	
	Point *start = new Point( 5, 1, 0, nullptr );
	Point *end = new Point( 5, 15, 0, nullptr );

	glfwInit();
	DrawPath( path );
	GLFWwindow *wind = glfwCreateWindow( 800, 600, "A* Pathfinding", nullptr, nullptr );

	glfwMakeContextCurrent( wind );
	Reshape( wind, 800, 600 );

	glfwSetWindowSizeCallback( wind, Reshape );
	glfwSetCursorPosCallback( wind, mousePosCallBack );
	glfwSetMouseButtonCallback( wind, mouseClickCallBack );

	srand( time(nullptr) );

	for( int y = 0; y < walls.size(); y++ )
	{

		for( int x = 0; x < walls[y].size(); x++ )
		{

			walls[x][y] = 1;

		}

	}

	while( !glfwWindowShouldClose( wind ) )
	{

		glClear( GL_COLOR_BUFFER_BIT );
		glLoadIdentity();

		glTranslatef( 0.0f, 0.0f, -1.0f );

		path = AStar( walls, *start, *end );
		DrawMap();
		DrawPath( path );

		std::this_thread::sleep_for( std::chrono::milliseconds(17) );

		//ResetKeys();
		glfwPollEvents();
		glfwSwapBuffers( wind );

	}

	glfwTerminate();

}
Ejemplo n.º 15
0
void DrawXm(int x)
{	
	float j=(manX+manY)*8;
	for(int i=(manX-manY+9)*16;i>=(x-manY+9)*16;i--)
	{
		DrawMap(manX,manY);
		Iw2DDrawImage(man,CIwFVec2(i,j));
		Iw2DSurfaceShow();
		j=j-0.5;
	}
}
Ejemplo n.º 16
0
void DrawYm(int y)
{
	int i=(manX-manY+9)*16;
	for(float j=(manX+manY)*8;j>=(manX+y)*8;j--)
	{
		j=j+0.5;
		DrawMap(manX,manY);
		Iw2DDrawImage(man,CIwFVec2(i,j));
		Iw2DSurfaceShow();
		i++;
	}
}
Ejemplo n.º 17
0
void DrawYp(int y)
{
	int i=(manX-manY+9)*16;
	for(float j=(manX+manY)*8;j<=(manX+y)*8;j++)
	{
		j=j-0.5;
		DrawMap(manX,manY);
		Iw2DDrawImage(man,CIwFVec2(i,j));
		Iw2DSurfaceShow();
		i--;
	}
}
Ejemplo n.º 18
0
int main(int argc, char* argv[])
{
	if (Initialize(600, 480, argv) != 0)
	{
		return 1;
	}
	SDL_SetRenderDrawBlendMode(g_renderer, SDL_BLENDMODE_ADD);

	ModInfo* info = GetModInfo("mods/libhydorah.so");
	if (info == NULL)
		return 1;

	printf("Found mod:\n\t%s - %s\n", info->name, info->description);

	Mod* mod = CreateMod(info);

	TextureList* textures = NULL;

	Map* map = CreateMapFromFile("maps/test.map", &textures);
	Editor* editor = CreateEditor(map);

	int running = 1;
	while (running)
	{
		SDL_Event event;
		while (SDL_PollEvent(&event))
		{
			if (event.type == SDL_QUIT)
				running = 0;
			
			HandleEditorEvents(editor, &event);
		}

		SDL_RenderClear(g_renderer);

		DrawMap(map, g_renderer);

		DrawEditor(editor, g_renderer);

		SDL_RenderPresent(g_renderer);
	}

	DestroyMap(map);
	DestroyTextureList(textures);
	DestroyEditor(editor);
	DestroyMod(mod);

	Cleanup(g_window, g_renderer);

	return 0;
}
Ejemplo n.º 19
0
/**
*@brief Draws the main game
*/
int StateGame()
{
		SDL_RenderClear(GetRenderer());	
		SDL_SetRenderTarget(GetRenderer(),game->mainSceneTexture);
		SDL_RenderClear(GetRenderer());
		SDL_SetRenderTarget(GetRenderer(),NULL);
		DrawMap(1,game->camera->x,game->camera->y,game->mainSceneTexture);
		DrawMap(2,game->camera->x,game->camera->y,game->mainSceneTexture);
		DrawMap(3,game->camera->x,game->camera->y,game->mainSceneTexture);
		DrawMap(0,0,0,game->mainSceneTexture);
		ThinkEntities();
		UpdateMap();
		UpdateEntities();
		DrawEntities();
		DrawMainScene();
		DrawSpecialLayer(map);
		UpdateGUI();
		SetCamera(*game->camera,hotBox);
		if(playerEnt->room->script != NULL)
			RunScript(playerEnt->room->script);
		NextFrame();
	return 0;
}
Ejemplo n.º 20
0
/**
 * Called by the assembler initialization routines, should not be called directly.
 */
void InitConsole(void){

#if INTRO_LOGO ==1 
	InitMusicPlayer(initPatches);	
	SetTileTable(uzeboxlogo);
	SetFontTable(uzeboxlogo);
	
	//draw logo
	ClearVram();
	WaitVsync(15);

	TriggerFx(0,0xff,true);
	DrawMap(LOGO_X_POS,12,map_uzeboxlogo);
	WaitVsync(3);
	DrawMap(LOGO_X_POS,12,map_uzeboxlogo2);
	WaitVsync(2);
	DrawMap(LOGO_X_POS,12,map_uzeboxlogo);
	WaitVsync(40);

	ClearVram();
	WaitVsync(20);
#endif
}
Ejemplo n.º 21
0
// 게임 데이터 초기화 함수
void PrepareGame() {
  srand(time(0)*clock());
  map_id = rand()%number_of_maps;
  int i;
  for(i = 0; i<number_of_players; ++i) {
    player[i].life = 5;
    player[i].fruit = 0;
    player[i].state = NORMAL;
    player[i].item = NOTHING;
    player[i].tick = 0;
    player[i].pos = PickARandPos();
    player[i].dir = STOP;
    player[i].item_use = 0;
  }
  for(i = 0; i<number_of_enemies; ++i) {
    enemy[i].state = NORMAL;
    enemy[i].tick = 0;
    enemy[i].pos = PickARandPos();
    enemy[i].dir = rand()%4+1;
  }
  for(i = 0; i<number_of_fruits; ++i) {
    fruit[i].pos = PickARandPos();
    fruit[i].state = NORMAL;
  }
  for(i = 0; i<number_of_items; ++i) {
    item[i].pos = PickARandPos();
    item[i].state = NORMAL;
  }
  for(i = 0; i<10; ++i) {
    bomb[i].state = DEAD;
    bomb[i].dir = STOP;
  }
  for(i = 0; i<40; ++i) {
    effect[i].state = DEAD;
    effect[i].dir = STOP;
  }
  game_quit = 0;
  game_win = 0;
  start_time = clock();
  next_second = clock()*2;
  fruit_remain = number_of_fruits;

  clear();
  refresh_object = 1;
  refresh_time = 1;
  refresh_message = 1;
  refresh_status = 1;
  DrawStatusFrame();
  DrawMap(map_id);
}
Ejemplo n.º 22
0
void GameMain() {
	DrawMap();
	//自キャラ移動
	int key = GetJoypadInputState(DX_INPUT_KEY_PAD1);
	float mv = 80.0f * g_frametime; //移動量計算
	if (key & PAD_INPUT_UP)		g_hy -= mv;
	if (key & PAD_INPUT_DOWN)	g_hy += mv;
	if (key & PAD_INPUT_LEFT)	g_hx -= mv;
	if (key & PAD_INPUT_RIGHT)	g_hx += mv;
	DrawGraph(g_hx, g_hy, g_heroimg, TRUE);
	//Zキーをチェックして画面を切り替え
	if (IsAKeyTrigger(key) == TRUE) {
		g_gamestate = GAME_OVER;
		g_timerstart = g_lasttime; //タイマーセット
	}
}
/**
 *  Zeichnet die MapPreview
 */
void ctrlIngameMinimap::Draw_()
{
    DrawMap(minimap);

    // Mittleren Punkt berechnen und dort hinscrollen
    Position middlePt = (gwv.GetLastPt() + gwv.GetFirstPt()) / 2;

    // Koordinaten korrigieren
    DrawPoint middle_corrected(MakeMapPoint(middlePt, minimap.GetMapSize()));

    // Scroll-Auswahl-Bild holen
    glArchivItem_Bitmap* image = LOADER.GetMapImageN(23);

    // Position (relativ zum angezeigten Anfang der Karte) berechnen
    DrawPoint pos = middle_corrected * DrawPoint(GetCurMapSize()) / DrawPoint(minimap.GetMapSize()) + DrawPoint(2, 2);

    // Scroll-Auswahl-Bild an den Rändern verkleinern, damit es nicht über die Karte "überlappt"
    DrawPoint srcOffset(0, 0);
    Extent drawSize(image->getWidth(), image->getHeight());

    DrawPoint originOffset = pos - image->GetOrigin();

    // überlappung am linken Rand?
    if(originOffset.x < 0)
    {
        srcOffset.x = -originOffset.x;
        drawSize.x += originOffset.x;
        pos.x = image->getNx();
    }
    // überlappung am oberen Rand?
    if(originOffset.y < 0)
    {
        srcOffset.y = -originOffset.y;
        drawSize.y += originOffset.y;
        pos.y = image->getNy();
    }
    // überlappung am rechten Rand?
    DrawPoint overDrawSize = pos - image->GetOrigin() + DrawPoint(image->GetSize()) - DrawPoint(GetCurMapSize());
    if(overDrawSize.x >= 0)
        drawSize.x -= overDrawSize.x;
    // überlappung am unteren Rand?
    if(overDrawSize.y >= 0)
        drawSize.y -= overDrawSize.y;

    // Zeichnen
    image->DrawPart(Rect(GetMapDrawArea().getOrigin() + pos, drawSize), srcOffset);
}
//main
int main()
{
Beginning: /* Label */
	printf("\n");

	player.x = 2, player.y = 5;
	target.x = 3, target.y = 0;
	enemy1.x = 0, enemy1.y = 1;
	enemy2.x = 5, enemy2.y = 3;

		/* Game Loop */
	while (1)
	{
		DrawMap();

		char input;
		printf("Enter a choice: l(Left), r(Right), u(Up), d(Down) and e(Exit)\n");
		scanf_s(" %c", &input);
		
		if (input=='e')
			goto Exit;
		else
		{
			HandlePlayer(input);
			HandleEnemy();
		
			system("cls");

			if ((player.x==enemy1.x && player.y==enemy1.y) ||		/* colliding with an enemy */
				(player.x==enemy2.x && player.y==enemy2.y))
			{
				score();
				printf("Sorry, you failed...\n Your score is: %d\n", score1);
				goto Beginning;
			}
			else if (player.x==target.x && player.y==target.y)		/* Target reached */
			{
				score();
				printf("Congratulation, you won...\n Your score is: %d\n", score1);
				goto Beginning;
			};
		};
	};

Exit:	/* Label */
    printf("\n");
};
Ejemplo n.º 25
0
/*界面初始化,数据初始化*/
void Init(void)
{
  int i,j;
  char *Msg[]=
  {
    "Player1 key:",
    "  UP----w",
    "  DOWN--s",
    "  LEFT--a",
    "  RIGHT-d",
    "  DO----space",
    "",
    "Player2 key:",
    "  UP----up",
    "  DOWN--down",
    "  LEFT--left",
    "  RIGHT-right",
    "  DO----ENTER",
    "",
    "exitgame:ESC",
    NULL,
  };
  /*先手方为1号玩家*/
  gPlayOrder = CHESS_1;
  /*棋盘数据清零, 即棋盘上各点开始的时候都没有棋子*/
  for(i=0;i<19;i++)
    for(j=0;j<19;j++)
      gChessBoard[i][j]=CHESS_NULL;
  /*光标初始位置*/
  gCursor.x=gCursor.y=8;
  /*画棋盘*/
  textmode(C40);    /*将屏幕设成文本模式*/
  DrawMap();
  /*显示操作键说明*/
  i=0;
  textcolor(YELLOW);
  while(Msg[i]!=NULL)
  {
    gotoxy(25,3+i);
    cputs(Msg[i]);
    i++;
  }
  /*显示先下棋方*/
  ShowOrderMsg(gPlayOrder);
  /*光标移至棋盘的左上角点处*/
  gotoxy(gCursor.x+MAPX_O,gCursor.y+MAPY_O);
}
Ejemplo n.º 26
0
void Init_All()
{
  Init_Graphics();
  InitSpriteList();
  Init_Audio();
  InitSoundList();
  atexit(CleanUpAll);
  LoadFonts();
  InitMessages();
  LoadMouse(Cyan,Gold,DarkViolet);
  InitEntityList();
  ResetAllParticles();
  DrawSplashScreen();
  LoadContent();
  NewMap(32, 48,0,15);
  DrawMap();
}
Ejemplo n.º 27
0
void MapGridCtrl::OnPaint(wxPaintEvent& /*unused*/)
{
	// This line must come first, to avoid an endless succession of paint messages.
	// OnPaint handlers must always create a wxPaintDC.

	wxAutoBufferedPaintDC dc(this);

	DrawBackground(dc);

	if (m_maps.empty())
		return;

	int width, height;
	GetClientSize(&width, &height);

	const int size = MINIMAP_SIZE + MINIMAP_MARGIN;

	// simple tile mapping algorithm
	int start_scrn_x = -(m_pos.x % size);
	int start_scrn_y = -(m_pos.y % size);
	int start_grid_x = m_pos.x / size;
	int start_grid_y = m_pos.y / size;
	int end_grid_x = std::min(start_grid_x + (width + 2 * size - 1) / size, m_size.x);
	int end_grid_y = std::min(start_grid_y + (height + 2 * size - 1) / size, m_size.y);

	if (start_grid_x < 0) {
		start_scrn_x += size * -start_grid_x;
		start_grid_x = 0;
	}

	if (start_grid_y < 0) {
		start_scrn_y += size * -start_grid_y;
		start_grid_y = 0;
	}

	for (int y = start_grid_y, scrn_y = start_scrn_y; y < end_grid_y; ++y, scrn_y += size) {
		for (int x = start_grid_x, scrn_x = start_scrn_x; x < end_grid_x; ++x, scrn_x += size) {
			const int idx = y * m_size.x + x;
			if (idx >= int(m_grid.size()))
				break;
			DrawMap(dc, *m_grid[idx], scrn_x, scrn_y);
		}
	}
}
Ejemplo n.º 28
0
//
//  函数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:    处理主窗口的消息。
//
//  WM_COMMAND  - 处理应用程序菜单
//  WM_PAINT    - 绘制主窗口
//  WM_DESTROY  - 发送退出消息并返回
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // 分析菜单选择: 
            switch (wmId)
            {
            case IDM_ABOUT:
                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                break;
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
        break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);
            // TODO: 在此处添加使用 hdc 的任何绘图代码...
			DrawMap(hWnd);
            EndPaint(hWnd, &ps);
        }
        break;
	case WM_KEYDOWN:
		OnKeyDown(hWnd, wParam);
		break;
	case WM_KEYUP:
		OnKeyUp(hWnd, wParam);
		break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}
Ejemplo n.º 29
0
int OpenGLSceneGen::DrawGLScene(GLvoid)				// Here's Where We Do All The Drawing
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	// Clear Screen And Depth Buffer

    //DrawBackgroundArea();

    if (drawMap)
    {
        //if(World.State()!=sMap)
        DrawMap();
        //else
        //	DrawBigMap();
    }
    else
        DrawTextDisplay();

    DrawTextLines();

    return 1;
}
Ejemplo n.º 30
0
void StageDraw()
{
    DrawMap(map, 0);
    DrawEnemy(map);
    DrawItem(map);
    DrawBomb(map);
    DrawEffect(map);
    DrawPlayer(map);
    
#if !MAP_EDIT_MODE
    DrawTextureObject(res.player_right, 0, 0);
    FontPrintf(32, 16, "x %d", life);
    
    DrawTextureObject(res.font_stage, 128, 16);
    FontPrintf(128 + 16 * 5, 16, "%d", stageNum + 1);

    DrawTextureObject(res.font_score, 128 + 16 * 5 + 32, 16);
    FontPrintf(128 + 16 * 5 + 32 + 16 * 5 + 16 , 16, "%d", score);
    PrintWindow("fps: %d", engineFps);
#endif    
}