本文整理汇总了C++中screen类的典型用法代码示例。如果您正苦于以下问题:C++ screen类的具体用法?C++ screen怎么用?C++ screen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了screen类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: reward
// Function that displays a screen for the experience and levels
// gained from the previous battle
void reward()
{
display.Clear();
cout << "Previous Level: " << Play1.level << " Previous XP: " << Play1.experience << endl;
cout << "Gained " << Enem1.xpvalue << " experience!!!" << endl;
Play1.setXP(Enem1.xpvalue);
cout << endl << "Current Experience: " << Play1.experience << endl;
display.pause();
};
开发者ID:cepsbow,项目名称:ASBG,代码行数:11,代码来源:asbg.cpp
示例2: setDingy
void setDingy( screen &green_grid, screen &red_grid, bool ship_locations[4][4] ) {
reset_locations( ship_locations );
green_grid.clearGrid();
unsigned char input_direction; //var used to move ship on board
unsigned char row, col; //coordinate variables
row = 0;
col = 0;
green_grid.addLight( row, col ); //lights up coordinate ( 1, A )
while ( 1 ) {
input_direction = getInput( green_grid, red_grid );
if ( input_direction == 0 && row != 0 ) {
green_grid.subLight( row, col );
row--;
}
else if ( input_direction == 1 && row != 3 ) {
green_grid.subLight( row, col );
row++;
}
else if ( input_direction == 2 && col != 0 ) {
green_grid.subLight( row, col );
col--;
}
else if ( input_direction == 3 && col != 3 ) {
green_grid.subLight( row, col );
col++;
}
if ( input_direction == 4 ) {
ship_locations[row][col] = true;
break;
}
green_grid.addLight( row, col );
green_grid.flicker();
}
}
开发者ID:ameyer92,项目名称:Battleship,代码行数:34,代码来源:shipset.cpp
示例3: pre_render_transform
void representation::draw(screen& pscreen, bool skip_take)
{
if(visible && (skip_take || is_in_focus(pscreen.get_box())))
{
if(pscreen.has_camera())
{
pscreen.reset_clip();
}
pre_render_transform(pscreen.get_draw_info());
do_draw();
}
//Es importante que esto siempre esté presente...
glLoadIdentity();
}
开发者ID:TheMarlboroMan,项目名称:libdansdl2,代码行数:16,代码来源:representation.cpp
示例4: draw
void representation::draw(screen& pscreen, const camera& pcamera, bool skip_take)
{
if(visible && (skip_take || is_in_focus(pcamera.get_focus_box())))
{
pscreen.set_camera(pcamera);
pre_render_transform(pcamera.get_draw_info());
do_draw();
}
//Es importante que esto siempre esté presente...
glLoadIdentity();
}
开发者ID:TheMarlboroMan,项目名称:libdansdl2,代码行数:12,代码来源:representation.cpp
示例5: superbots
void conn::game_thread(std::shared_ptr<tcp::socket> socket, bool &gameover, bots & bots, bot::team_id &id,
boost::mutex & state_mutex, bot::field_size &field_width, bot::field_size &field_height,
int &win_width, int &win_height, bool &connected) {
superbots superbots(bots);
boost::asio::streambuf buf;
while(!gameover) {
superbots.ejecutar(5);
for(auto b : bots.team_bots(id)) {
std::stringstream stream;
stream << "move " << b->get_x() << " " << b->get_y() << " " << b->get_next_direction();
send(*socket, stream.str());
}
read_until(*socket, buf, "\n");
std::string data;
std::istream is(&buf);
std::getline(is, data);
std::istringstream stream(data);
std::string command;
stream >> command;
if(command == "welcome") {
stream >> id;
superbots.set_team(id);
stream >> field_width;
stream >> field_height;
bots.set_size(field_width, field_height);
MYscreen.set_screen(win_width, win_height, field_width, field_height);
connected = true;
}
else if(command == "state") {
开发者ID:Sethimu5,项目名称:ejerciciosPRA,代码行数:39,代码来源:conn.cpp
示例6: setTriDingy
void setTriDingy( screen &green_grid, screen &red_grid, bool ship_locations[4][4] ) {
unsigned char input_direction; //var used to move ship on board
unsigned char row, col; //coordinate variables
row = 0;
col = 0;
green_grid.addLight( row, col ); //lights up coordinate ( 1, 1 )
green_grid.addLight( row, col + 1 ); //lights up coordinate ( 2, 1 )
green_grid.addLight( row, col + 2 );
while ( 1 ) {
input_direction = getInput( green_grid, red_grid );
if ( input_direction == 0 && row != 0 ) {
green_grid.subLight( row, col );
green_grid.subLight( row, col + 1 );
green_grid.subLight( row, col + 2 );
row--;
green_grid.addLight( row, col );
green_grid.addLight( row, col + 1 );
green_grid.addLight( row, col + 2 );
}
else if ( input_direction == 1 && row != 3 ) {
green_grid.subLight( row, col );
green_grid.subLight( row, col + 1 );
green_grid.subLight( row, col + 2 );
row++;
green_grid.addLight( row, col );
green_grid.addLight( row, col + 1 );
green_grid.addLight( row, col + 2 );
}
else if ( input_direction == 2 && col != 0 ) {
green_grid.subLight( row, col + 2);
col--;
green_grid.addLight( row, col );
}
else if ( input_direction == 3 && col != 1 ) {
green_grid.subLight( row, col );
col++;
green_grid.addLight( row, col + 2 );
}
else if ( input_direction == 4 ) {
if ( green_grid.collisionCheck( 6 ) == false ) {
ship_locations[row][col] = true;
ship_locations[row][col + 1] = true;
ship_locations[row][col + 2] = true;
break;
}
else {
setDingy( green_grid, red_grid, ship_locations );
setDualDingy( green_grid, red_grid, ship_locations );
row = 0;
col = 0;
green_grid.addLight( row, col ); //lights up coordinate ( 1, 1 )
green_grid.addLight( row, col + 1 ); //lights up coordinate ( 2, 1 )
green_grid.addLight( row, col + 2 ); //lights up coordinate ( 3, 1 )
}
}
green_grid.flicker();
}
}
开发者ID:ameyer92,项目名称:Battleship,代码行数:59,代码来源:shipset.cpp
示例7: resolver
void conn::conecta(std::string server,std::string port){
bot::team_id id = 1000;
boost::asio::io_service io_service;
tcp::resolver resolver(io_service);
auto endpoint_iterator = resolver.resolve({ server, port });
std::shared_ptr<tcp::socket> socket(new tcp::socket(io_service));
boost::asio::connect(*socket, endpoint_iterator);
bot::field_size field_width;
bot::field_size field_height;
int win_width = 500;
int win_height = 500;
bots Mundo;
boost::mutex state_mutex;
SDL_Init(SDL_INIT_VIDEO);
atexit(SDL_Quit);
SDL_WM_SetCaption("Superbots", "Superbots");
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
MYscreen.set_screen(win_width, win_height);
SDL_Event event;
bool gameover = false;
bool connected = false;
boost::thread t = boost::thread([this,socket, &state_mutex, &gameover, &connected, &Mundo, &id, &field_width, &field_height, &win_width, &win_height] () { game_thread(socket, gameover, Mundo, id, state_mutex, field_width, field_height, win_width, win_height, connected); } );
while (!gameover) {
if(connected) {
if (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
gameover = true;
break;
case SDL_KEYDOWN:
switch (event.key.keysym.sym) {
case SDLK_ESCAPE:
case SDLK_q:
gameover = true;
break;
default:
break;
}
break;
case SDL_VIDEORESIZE:
win_width = event.resize.w;
win_height = event.resize.h;
MYscreen.set_screen(win_width, win_height, field_width, field_height);
break;
}
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
{
boost::mutex::scoped_lock lock(state_mutex);
Mundo.for_each_bot([&Mundo] (const bot & the_bot) {
auto t = the_bot.get_team() + 1;
glColor3f(t * 0.2, 1 - t * 0.3, t * 0.1);
const bot::position & pos = the_bot.get_position();
glLoadIdentity();
glTranslatef(pos.first, pos.second, 0);
glBegin(GL_QUADS);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(1.0f, 0.0f, 0.0f);
glVertex3f(1.0f, 1.0f, 0.0f);
glVertex3f(0.0f, 1.0f, 0.0f);
glEnd();
});
}
SDL_GL_SwapBuffers();
}
}
if(Mundo.bot_count().size() != 1) {
std::cout << "Shit!" << std::endl;
}
else {
for(auto inmortal : Mundo.bot_count()) {
std::cout << inmortal.first << " se ha pulido a todos!" << std::endl;
}
//.........这里部分代码省略.........
开发者ID:Sethimu5,项目名称:ejerciciosPRA,代码行数:101,代码来源:conn.cpp
示例8: battle
// CurGame's primary method, this encapsulates the entire battle
// routine, the routine ends as soon as the enemy or the player
// reach 0 or less hit points. Returns a boolean to determine if
// the player died during combat or an attempt to run away.
bool battle()
{
// Initialize battle()'s variables to NULL
// maxhp stores the players original max health so the value
// can be restored if the player survives the encounter
int select=0, maxhp=Play1.health;
bool playDeath=false, enemDeath=false;
// Keep fighting until the player runs or someone dies
do
{
// Clear the display to draw the next frame
display.Clear();
// Display the battle screen
select = battleMenu();
// Check which option was chosen
// The enemy is implemented without AI and will follow
// suit with the player, a simple AI would evaluate
// which of its stats are greater than the player's
switch( select )
{
// Strength based attack
case 1:
enemDeath = playAttRound(1);
playDeath = enemAttRound(1);
display.pause();
break;
// Dexterity based attack
case 2:
enemDeath = playAttRound(2);
playDeath = enemAttRound(2);
display.pause();
break;
// Spellcasting (Intelligence based attack)
case 3:
enemDeath = playAttRound(3);
playDeath = enemAttRound(3);
display.pause();
break;
// Attempt to run away from combat
case 4:
// If they successfully run away
if ( run() )
{
Enem1.xpvalue = 0;
cout << "\nYou ran away successfully!!!\n";
display.pause();
return true;
}
// Or else the enemy gets a free attack on the player
else
{
cout << "\nYou failed to get away, the enemy hits you!\n";
playDeath = enemAttRound( randnum(3, 127) );
display.pause();
}
break;
// Let the user know their input is invalid
default:
cout << "\nPlease enter a correct choice!!!\n";
display.pause();
break;
}
// Check to see if either or both of our competitors have died
if( playDeath && enemDeath )
{
cout << "\n\nYou simultaneously strike each other fatally!!! A true warrior's death...\n";
display.pause();
return false;
}
else if( playDeath && !enemDeath )
{
cout << "\n\nYou died!!!\n";
display.pause();
return false;
}
else if( enemDeath && !playDeath )
{
cout << "\n\nYou have slain the " << Enem1.ename << "!!!\n";
// Reset the players health to maximum after combat
Play1.health=maxhp;
display.pause();
return true;
}
}while( !playDeath && !enemDeath );
};
开发者ID:cepsbow,项目名称:ASBG,代码行数:95,代码来源:asbg.cpp
示例9: mazeMe
bool mazeMe(int row, int column, int plane)
{
int nNewRow, nNewColumn, nNewPlane = 0;
if (not mazeSolved())
{
for (int nIndex = 0; nIndex <= 26; nIndex++)
{
nNewRow = row + aMoves[nIndex].row;
nNewColumn = column + aMoves[nIndex].column;
nNewPlane = plane + aMoves[nIndex].plane;
if (validMove(nNewRow, nNewColumn, nNewPlane))
{
aBoard[nNewRow][nNewColumn][nNewPlane].value = '-';
objScreen.printChar('-',
aBoard[nNewRow][nNewColumn][nNewPlane].x,
aBoard[nNewRow][nNewColumn][nNewPlane].y,
32, 0, 0, 25000);
if (not mazeMe(nNewRow, nNewColumn, nNewPlane))
{
aBoard[nNewRow][nNewColumn][nNewPlane].value = 'B';
objScreen.printChar('B',
aBoard[nNewRow][nNewColumn][nNewPlane].x,
aBoard[nNewRow][nNewColumn][nNewPlane].y,
31, 0, 0, 25000);
}
else nIndex = 27;
}
}
}
return mazeSolved();
}
开发者ID:kjseefried,项目名称:code,代码行数:35,代码来源:3Dmaze.cpp
示例10: createLevel
void createLevel ()
{
scrn.clearScreen();
bricks.clear();
enemies.clear();
bombs.clear();
for (int i = 0; i < 13; i++)
{
for (int j = 0; j < 15; j++)
{
switch ( lvls[NUM_LVL][i][j])
{
case 2:
{
bricks.push_back(brick (calculateCoordinates(j - 1), calculateCoordinates(j), calculateCoordinates(i-1), calculateCoordinates(i), scrn));
}
break;
case 3:
{
enemies.push_back(enemy (calculateCoordinates(j - 1), calculateCoordinates(j), calculateCoordinates(i-1), calculateCoordinates(i), scrn));
}
break;
}
}
}
lvlup = portal (10, 50, 410, 450, scrn);
Main = hero (scrn);
}
开发者ID:bobrusha,项目名称:my_game,代码行数:30,代码来源:main.cpp
示例11: eventsInGame
void eventsInGame(sf::Event &event, sf::RenderWindow &window)
{
switch (event.type)
{
case sf::Event::Closed:
{
window.close();
}
break;
//========================================================================================= Keyboard
case sf::Event::KeyPressed:
{
switch (event.key.code)
{
case (sf::Keyboard::Left):
Main.MoveL(scrn, lvlup);
break;
case (sf::Keyboard::Right):
Main.MoveR(scrn, lvlup);
break;
case (sf::Keyboard::Up):
Main.MoveU(scrn, lvlup);
break;
case (sf::Keyboard::Down):
Main.MoveD(scrn, lvlup);
break;
case (sf::Keyboard::Space):
bombs.push_back(bomb (Main.l, Main.r, Main.b, Main.t));
break;
case (sf::Keyboard::E):
{
scrn.print();
}
break;
case (sf::Keyboard::Escape):
{
window.close();
}
break;
case (sf::Keyboard::A):
{
//NUM_LVL++;
enemies.clear();
//scrn.clearScreen();
}
break;
}
}
}
}
开发者ID:bobrusha,项目名称:my_game,代码行数:50,代码来源:main.cpp
示例12: printArray
void printArray()
{
for (int plane = 0; plane <= 4; plane++)
{
for (int row = 0; row <= 9; row++)
{
for (int column = 0; column <= 9; column++)
{
objScreen.printChar(aBoard[row][column][plane].value,
aBoard[row][column][plane].x,
aBoard[row][column][plane].y);
}
}
}
}
开发者ID:kjseefried,项目名称:code,代码行数:15,代码来源:3Dmaze.cpp
示例13: buildArray
void buildArray()
{
ifstream is;
char file[256];
objScreen.printString("Please input file name: ", 1, 1, 25000);
cin.get(file, 256);
is.open(file);
int x[5] = {20, 32, 44, 56, 68};
int y[5] = {5, 6, 7, 8, 9};
for (int plane = 0; plane <= 4; plane++)
{
for (int row = 0; row <= 9; row++)
{
for (int column = 0; column <= 10; column++)
{
aBoard[row][column][plane].value = is.get();
aBoard[row][column][plane].x = x[plane] + column;
aBoard[row][column][plane].y = y[plane] + row;
}
x[plane]--;
}
}
is.close();
int nIndex = 0;
for (int i = -1; i <= 1; i++)
{
for (int j = -1; j <= 1; j++)
{
for (int k = -1; k <= 1; k++)
{
aMoves[nIndex].row = i;
aMoves[nIndex].column = j;
aMoves[nIndex].plane = k;
nIndex++;
}
}
}
}
开发者ID:kjseefried,项目名称:code,代码行数:45,代码来源:3Dmaze.cpp
示例14: main
int main()
{
bool bCont = true;
char strCont = 'y';
while (bCont)
{
objScreen.clearScreen();
objScreen.moveCursor(0, 0);
cout.flush();
buildArray();
printArray();
if (aBoard[0][0][0].value == ' ')
{
objScreen.printChar('-', aBoard[0][0][0].x, aBoard[0][0][0].y, 32, 0, 0, 25000);
}
if (mazeMe(0, 0, 0))
{
objScreen.printString("Puzzled Solved!", 1, 22, 25000);
}
else
{
objScreen.printString("Puzzle Unsolvable.", 1, 22, 25000);
}
objScreen.moveCursor(0, 23);
cout.flush();
objScreen.printString("Do you want to play another game (y/n)? ", 1, 23, 25000);
cin >> strCont;
if (strCont == 'n')
{
bCont = false;
}
cin.ignore(1000, '\n');
}
return 0;
}
开发者ID:kjseefried,项目名称:code,代码行数:44,代码来源:3Dmaze.cpp
示例15: eventsAfterWin
void eventsAfterWin(sf::Event &event, sf::RenderWindow &window, bool &in_menu, int x1, int y1, int x2, int y2)
{
switch(event.type)
{
case sf::Event::MouseButtonPressed:
{
if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
{
sf::Vector2i mPos = sf::Mouse::getPosition(window);
if ( mPos.x >= x1 && mPos.x <= 500 && mPos.y >= y1 && mPos.y <= y1 + 100 )
{
scrn.setRun(true);
in_menu = true;
}
if ( mPos.x >= x2 && mPos.x <= 500 && mPos.y >= y2 && mPos.y <= y2 + 100)
{
window.close();
}
}
}
}
}
开发者ID:bobrusha,项目名称:my_game,代码行数:23,代码来源:main.cpp
示例16: eventsAfterLosing
void eventsAfterLosing(sf::Event &event, sf::RenderWindow &window, bool &in_menu)
{
switch(event.type)
{
case sf::Event::MouseButtonPressed:
{
if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
{
sf::Vector2i mPos = sf::Mouse::getPosition(window);
if ( mPos.x >= 100 && mPos.x <= 200 && mPos.y >= 250 && mPos.y <= 350 )
{
scrn.setRun(true);
in_menu = true;
}
if ( mPos.x >= 250 && mPos.x <= 350 && mPos.y >= 250 && mPos.y <= 300 )
{
window.close();
}
}
}
}
}
开发者ID:bobrusha,项目名称:my_game,代码行数:23,代码来源:main.cpp
示例17: main
int main ( int argc, char** argv)
{
sf::RenderWindow window(sf::VideoMode(wW, wH), "MyDynablaster", sf::Style::Titlebar);
sf::Clock clock;
//==================================================================================================== Textures for objects
sf::Texture texMainHero;
texMainHero.loadFromFile("main_hero.png");
sf::Sprite sprMainHero;
sprMainHero.setTexture(texMainHero);
sf::Texture texBrick;
texBrick.loadFromFile("brick.png");
sf::Sprite sprBrick;
sprBrick.setTexture(texBrick);
sf::Texture texEnemy;
texEnemy.loadFromFile("enemy.png");
sf::Sprite sprEnemy;
sprEnemy.setTexture(texEnemy);
sf::Texture texBomb;
texBomb.loadFromFile("bomb.png");
sf::Sprite sprBomb;
sprBomb.setTexture(texBomb);
sf::Texture texPortal;
texPortal.loadFromFile("portal.png");
sf::Sprite sprPortal;
sprPortal.setTexture(texPortal);
sf::Texture texFire;
texFire.loadFromFile("fire.png");
sf::Sprite sprFire;
sprFire.setTexture(texFire);
sf::Font font;
if (!font.loadFromFile("font.ttf"))
{
return 3;
}
//-----------------------------------------------------------------------------------------------Boolean variables
bool lvl_is_completed = false;
bool in_menu = true;
bool gamer_lose = false;
// -----------------------------------------------------------------------------------------------Game
while (window.isOpen())
{
sf::Event event;
while ( in_menu)
{
window.clear(sf::Color::White);
sf::Text txt1, txt2;
const int txt1_x = 100, txt1_y=100;
txt1.setFont(font);
txt1.setString("Start game");
txt1.setColor(sf::Color::Black);
txt1.setPosition(txt1_x, txt1_y);
txt1.setCharacterSize(72);
window.draw(txt1);
const int txt2_x = 100, txt2_y=180;
txt2.setFont(font);
txt2.setString("Exit");
txt2.setColor(sf::Color::Black);
txt2.setPosition(txt2_x,txt2_y);
txt2.setCharacterSize(72);
window.draw(txt2);
window.display();
while ( window.pollEvent(event))
{
eventsInMenu( event, window, in_menu, txt1_x, txt1_y, txt2_x, txt2_y);
}
}
while ( window.pollEvent(event) )
{
if(scrn.getRun())
{
eventsInGame(event, window);
}
else
{
if(gamer_lose)
{
eventsAfterLosing (event, window, in_menu);
}
else
{
eventsAfterWin (event, window, in_menu, 100, 150, 100, 250);
}
//.........这里部分代码省略.........
开发者ID:bobrusha,项目名称:my_game,代码行数:101,代码来源:main.cpp
示例18: damage
//-----------------------------------
void bomb::damage(sf::RenderWindow& window, sf::Sprite& sprFire)
{
if (scrn.getArrayElement(calculateIndex(b),calculateIndex(l)+1) != 4)
{
for (int i=0; i <= dst; ++i)
{
if (scrn.getArrayElement(calculateIndex(b), calculateIndex(l)+i) == 2 )
{
if (first)
{
bricks.remove(brick(l+i*step, r+(i*step), b, t, scrn));
scrn.setArrayElement(0, calculateIndex(b), calculateIndex(l)+i);
}
break;
}
if (scrn.getArrayElement(calculateIndex(b), calculateIndex(l)+i) == 3)
{
enemies.remove( enemy ( l + i*step, r + i*step, b, t, scrn) );
scrn.setArrayElement(0, calculateIndex(b), calculateIndex(l) + i);
}
sprFire.setPosition(sf::Vector2f(l + i*step, b));
window.draw(sprFire);
}
}
if (scrn.getArrayElement(calculateIndex(b), calculateIndex(l)-1) != 4)
{
for (int i=0; i <= dst; ++i)
{
if (scrn.getArrayElement(calculateIndex(b), calculateIndex(l) - i) == 2 && first)
{
if(first)
{
bricks.remove(brick( l - i*step, r - i*step, b, t, scrn));
scrn.setArrayElement(0, calculateIndex(b), calculateIndex(l) - i);
}
break;
}
if (scrn.getArrayElement(calculateIndex(b), calculateIndex(l) - i - 1) == 3 )
{
enemies.remove( enemy (l-i*step, r-i*step, b, t, scrn) );
scrn.setArrayElement(0, calculateIndex(b), calculateIndex(l) - i - 1);
}
sprFire.setPosition(sf::Vector2f(l- i*step, b));
window.draw(sprFire);
}
}
if (scrn.getArrayElement(calculateIndex(b)+1, calculateIndex(l)) != 4 )
{
for (int i=0; i <= dst; ++i)
{
if (scrn.getArrayElement(calculateIndex(b)+i, calculateIndex(l)) == 2 && first)
{
if(first)
{
bricks.remove(brick(l, r, b+i*step, t+i*step, scrn));
scrn.setArrayElement(0, calculateIndex(b)+i, calculateIndex(l));
}
break;
}
if (scrn.getArrayElement(calculateIndex(b)+i, calculateIndex(l)) == 3)
{
enemies.remove( enemy (l, r, b+i*step, t+i*step, scrn) );
scrn.setArrayElement(0, calculateIndex(b)+i, calculateIndex(l));
}
sprFire.setPosition(sf::Vector2f(l, b+ i*step));
window.draw(sprFire);
}
}
if (scrn.getArrayElement(calculateIndex(b)-1, calculateIndex(l)) != 4)
{
for (int i = 0; i <= dst; i++)
{
if (scrn.getArrayElement(calculateIndex(b)-i, calculateIndex(l)) == 2)
{
if (first)
{
bricks.remove(brick (l, r, b-i*step, t-i*step, scrn));
scrn.setArrayElement(0, calculateIndex(b)-i, calculateIndex(l));
}
break;
}
if (scrn.getArrayElement(calculateIndex(b)-i, calculateIndex(l)) == 3)
{
enemies.remove (enemy (l, r, b-i*step, t-i*step, scrn));
scrn.setArrayElement (0, calculateIndex(b)-i, calculateIndex(l));
}
sprFire.setPosition(sf::Vector2f(l , b - i*step));
window.draw(sprFire);
}
}
if (first)
{
first = false;
}
return;
}
开发者ID:bobrusha,项目名称:my_game,代码行数:98,代码来源:main.cpp
注:本文中的screen类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论