本文整理汇总了C++中ship类的典型用法代码示例。如果您正苦于以下问题:C++ ship类的具体用法?C++ ship怎么用?C++ ship使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ship类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: checkIfAtMoonMenu
//********************************************************************************************
// void checkIfAtMoonMenu()
// This method is used to start the game at your home base of the moon
// This can be changed.
//********************************************************************************************
int checkIfAtMoonMenu(ship &s,planet &j,planet &e,planet &m,planet &g,planet &M,planet &S,planet &n,planet &p,planet &c)
{
int input = 0;
system("cls");
cout << "Welcome to the Moon, your home base " << "Planet Description goes here?? Maybe?." << endl << endl;
cout << ":::Space News::: " << endl;
cout << "Planet " << "Iron" << "\t" << "Price" << "\t" << "Sugar" << "\t" << "Price" << "\t" << "Rice" << "\t" << "Price" << endl;
// cout << "Jupiter " << << "\t" << j.getIronQuantityDesired() << "\t" << j.getSugar() << "\t" << j.getSugarPrice() << "\t" << j.getRice() << "\t" << j.getRicePrice() << endl;
// cout << "Earth " << << "\t" << e.getIronQuantityDesired() << "\t" << e.getSugar() << "\t" << e.getSugarPrice() << "\t" << e.getRice() << "\t" << e.getRicePrice() << endl;
// cout << "Ganymede " << g.getIronQuantity() << "\t" << g.getIronQuantityDesired() << "\t" << g.getSugar() << "\t" << g.getSugarPrice() << "\t" << g.getRice() << "\t" << g.getRicePrice() << endl;
// cout << "Mars " << m.getIronQuantity() << "\t" << m.getIronQuantityDesired() << "\t" << m.getSugar() << "\t" << m.getSugarPrice() << "\t" << m.getRice() << "\t" << m.getRicePrice() << endl;
// cout << "Saturn " << S.getIronQuantity() << "\t" << S.getIronQuantityDesired() << "\t" << S.getSugar() << "\t" << S.getSugarPrice() << "\t" << S.getRice() << "\t" << S.getRicePrice() << endl;
// cout << "Neptune " << n.getIronQuantity() << "\t" << n.getIronQuantityDesired() << "\t" << n.getSugar() << "\t" << n.getSugarPrice() << "\t" << n.getRice() << "\t" << n.getRicePrice() << endl;
// cout << "Pluto " << p.getIronQuantity() << "\t" << p.getIronQuantityDesired() << "\t" << p.getSugar() << "\t" << p.getSugarPrice() << "\t" << p.getRice() << "\t" << p.getRicePrice() << endl;
// cout << "Ceres " << c.getIronQuantity() << "\t" << c.getIronQuantityDesired() << "\t" << c.getSugar() << "\t" << c.getSugarPrice() << "\t" << c.getRice() << "\t" << c.getRicePrice() << endl;
//cout << "Jupiter" << j.getIronQuantity() << "\t" << j.getIronQuantityDesiredQuantity() << "\t" << j.getSugar() << "\t" << j.getSugarPrice() << "\t" << j.getRice() << "\t" << j.getRicePrice() << endl;
cout << endl;
// cout << "\nRice: " << p.getRice() << endl;
//cout << "\nFuel: " << p.getFuel() << endl;
cout << "1. Check Mail Box: -- Not Functional... " << endl;
cout << "2. Repair Ship: -- Not Functional... " << endl;
cout << "3. Upgrade Ship: -- Not Functional... " << endl;
cout << "4. Pick Up Passengers: -- Not Functional... " << endl;
cout << "5. Talk to people listen to space news... -- not functional... " << endl;
cout << "6. Leave Space Station... -- This works!" << endl;
cout << endl;
cout << "You have " << "Rice - " << s.getRice() << " Iron - " << s.getIron() << " Sugar - " << s.getSugar() << endl;
cout << "SpaceBucks - " << s.getFunds() << " Fuel - " << s.getFuel() << " Cargo Max - " << s.getCARGO_MAX() << endl;
cout << "What do you want to do?";
cin >> input;
return input;
}
开发者ID:Alfredof10,项目名称:C_Space,代码行数:40,代码来源:main.cpp
示例2: checkIfAtPlanetMenu
//********************************************************************************************
// int checkIfAtPlanetMenu()
// This method is used when you get to a planet to generate the buy and sell option
// as of right now the planet.getPlanetName() is giving errors so it is left blank
//********************************************************************************************
int checkIfAtPlanetMenu(ship &s,planet &p)
{
int input = 0;
system("cls");
cout << "Welcome to --Fix Planet Name--... " << "Planet Description goes here?? Maybe?." << endl << endl;
cout << "\nIron: " << p.getIronQuantity() << endl;
cout << "\nSugar: " << p.getSugarQuantity() << endl;
cout << "\nRice: " << p.getRiceQuantity() << endl;
cout << "\nFuel: " << p.getFuel() << endl;
cout << "1. Buy Iron: " << endl;
cout << "2. Buy Sugar: " << endl;
cout << "3. Buy Rice: " << endl;
cout << "4. Sell Iron: " << endl;
cout << "5. Sell Sugar: " << endl;
cout << "6. Sell Rice: " << endl;
cout << "7. Buy Fuel: " << endl;
cout << "8. Exit planet" << endl;
cout << "You have " << "Rice - " << s.getRice() << " Iron - " << s.getIron() << " Sugar - " << s.getSugar() << endl;
cout << "SpaceBucks - " << s.getFunds() << " Fuel - " << s.getFuel() << " Cargo Max - " << s.getCARGO_MAX() << endl;
cout << "What do you want to do?";
cin >> input;
return input;
}
开发者ID:Alfredof10,项目名称:C_Space,代码行数:30,代码来源:main.cpp
示例3: vector3i
void gun_shell::check_collision_voxel(ship& s, const vector3f& oldrelpos, const vector3f& newrelpos)
{
// positions are relative to bbox of s.
matrix4f obj2voxel = s.get_model().get_base_mesh_transformation().inverse();
vector3f oldvoxpos = obj2voxel * oldrelpos, newvoxpos = obj2voxel * newrelpos;
vector3f diffvoxpos = newvoxpos - oldvoxpos;
// now iterate in 8 steps between oldvoxpos to newvoxpos,
// transform both to voxel coordinates (0...N)
// and determine voxel number by pos.
// if coordinate is invalid, no hit, otherwise check voxel state (volume > 0.25 or similar)
// if the voxel is filled.
vector3f voxel_size_rcp = s.get_model().get_voxel_size().rcp();
const vector3i& vres = s.get_model().get_voxel_resolution();
vector3i vidxmax = vres - vector3i(1, 1, 1);
vector3f voxel_pos_trans = vector3f(vres) * 0.5f;
int lastvn = -1;
log_debug("check collision voxel");
for (unsigned k = 0; k <= 10; ++k) {
float kf = k/10.0f;
vector3f voxpos = oldvoxpos + diffvoxpos * kf;
vector3i v = vector3i(voxpos.coeff_mul(voxel_size_rcp) + voxel_pos_trans);
v = v.max(vector3i(0,0,0)).min(vidxmax);
int vn = (v.z * vres.y + v.y)*vres.x + v.x;
if (vn != lastvn) {
lastvn = vn;
log_debug("voxel hit k="<<k<<" voxpos="<<voxpos<<" v="<<v<<" vn="<<vn);
const model::voxel* vox = s.get_model().get_voxel_by_pos(v);
if (vox) {
// we hit a part of the object!
log_debug("..... Object hit! .....");
// first compute exact real word position of impact
vector3 impactpos = s.get_pos()
+ s.get_orientation().rotate(s.get_model().
get_base_mesh_transformation() * voxpos);
// move gun shell pos to hit position to
// let the explosion be at right position
position = impactpos;
log_debug("Hit object at real world pos " << impactpos);
log_debug("that is relative: " << s.get_pos()-impactpos);
// now damage the ship
if (s.damage(impactpos, int(damage_amount))) { // fixme, crude
gm.ship_sunk(&s);
} else {
s.ignite();
}
#if 0
//spawn some location marker object for testing
//at exact impact position
gm.spawn_particle(new marker_particle(impactpos));
#endif
gm.add_event(new event_shell_explosion(get_pos()));
kill(); // grenade is used and dead
return; // no more checks
}
}
}
}
开发者ID:salamanderrake,项目名称:dangerdeep,代码行数:57,代码来源:gun_shell.cpp
示例4: draw_screen
static void draw_screen( void )
{
static ship s;
/* Clear the color and depth buffers. */
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glError();
/* We don't want to modify the projection matrix. */
glMatrixMode( GL_MODELVIEW );
glError();
glLoadIdentity( );
glError();
/* Move down the z-axis. */
glTranslatef( 0.0, 0.0, -15.0 ); glError();
glPushMatrix(); glError();
/* Rotate. */
//glRotatef( 100 * tim_x.read(), 1.0, 0.0, 0.0 );
//glRotatef( 100 * tim_y.read(), 0.0, 1.0, 0.0 );
// glRotatef( 100 * tim_c.read(), 0.0, 0.0, 1.0 );
glTranslatef( 5 * tim_x.read(), 5 * tim_y.read(), 0 );
glError();
glBegin( GL_LINES );
#define BRICK_CNT 40//actually sqrt(brick count)
for( int x=-BRICK_CNT;x<BRICK_CNT;++x )
{
for( int y=-BRICK_CNT;y<BRICK_CNT;++y)
{
draw_rect(x,y,1,1,y==0,true);
}
}
glEnd();
glError();
glPopMatrix();
glError();
glRotatef( 100 * tim_x.read(), 1.0, 0.0, 0.0 );
glRotatef( 100 * tim_y.read(), 0.0, 1.0, 0.0 );
s.draw();
/*
* Swap the buffers. This this tells the driver to
* render the next frame from the contents of the
* back-buffer, and to set all rendering operations
* to occur on what was the front-buffer.
*/
SDL_GL_SwapBuffers( );
}
开发者ID:rsaxvc,项目名称:vertifall,代码行数:54,代码来源:main.cpp
示例5: parseMovement
//***********************************************************************************
// int parseStringX()
// This is a simple function to parse and return the coodinates you want to goto
//
//
//**********************************************************************************
void parseMovement(string strX,string strY,ship &s)
{
int x;
int y;
double hypot=0.0;
x = atoi(strX.c_str());
y = atoi(strY.c_str());
if (x == 0)
{
s.setX(s.getX());
}
if (y == 0)
{
s.setY(s.getY());
}
if (x <= POSITIVE_XLIMIT && x >= NEGATIVE_XLIMIT && y <= POSITIVE_YLIMIT && y >= NEGATIVE_YLIMIT)
{
// calculate data for hypotenuese (sp?) and get units for fuel subtraction
double xc = x-s.getX();
double yc = y-s.getY();
double xcsq = xc*xc;
double yxsq = yc*yc;
double hypot = abs(sqrt(xcsq+yxsq));
// error checking for input
outfile.open("errorLog.txt", ios::app);
outfile << "The time is: " << asctime(localtm) << " " << "Hypotenoose: " << hypot << endl;
outfile.close();
// ------
s.setX(x); //
s.setY(y);
s.setFuel(s.getFuel()-hypot);
}
} // end of method
开发者ID:Alfredof10,项目名称:C_Space,代码行数:54,代码来源:main.cpp
示例6: A
void SpriteCharacterGame::GetKeys(ship a_ship)
{
Vector3 A(1, 0, 0);
Vector3 B(0, -1, 0);
Vector3 C(0, 0, 1);
Vector3 D(0, 0, -1);
if(HELP_Keypresses(SDL_SCANCODE_W)) a_ship.Moveship(A);
if(HELP_Keypresses(SDL_SCANCODE_S)) a_ship.Moveship(B);
if(HELP_Keypresses(SDL_SCANCODE_A)) a_ship.Moveship(C);
if(HELP_Keypresses(SDL_SCANCODE_D)) a_ship.Moveship(D);
if(HELP_Keypresses(SDL_SCANCODE_SPACE));
if(HELP_Keypresses(SDL_SCANCODE_ESCAPE));
}
开发者ID:NavinNoteBrohier,项目名称:SDL2-AI-Assignment,代码行数:16,代码来源:SpriteGameRoutines.cpp
示例7: hud_observer_init
/**
* Initialize observer hud stuff
*/
void hud_observer_init(ship *shipp, ai_info *aip)
{
// setup the pseduo ship and ai
memcpy(&Hud_obs_ai, aip, sizeof(ai_info));
// (we used to do a memcpy here, but that doesn't work any longer, so let's just assign the values we need)
Hud_obs_ship.clear();
strcpy_s(Hud_obs_ship.ship_name, shipp->ship_name);
Hud_obs_ship.team = shipp->team;
Hud_obs_ship.ai_index = shipp->ai_index;
Hud_obs_ship.flags = shipp->flags;
Hud_obs_ship.flags2 = shipp->flags2;
Hud_obs_ship.ship_info_index = shipp->ship_info_index;
Hud_obs_ship.objnum = shipp->objnum;
Hud_obs_ship.wingnum = shipp->wingnum;
Hud_obs_ship.alt_type_index = shipp->alt_type_index;
Hud_obs_ship.callsign_index = shipp->callsign_index;
memcpy(&Hud_obs_ship.np_updates, shipp->np_updates, MAX_PLAYERS * sizeof(np_update));
Hud_obs_ship.ship_max_hull_strength = shipp->ship_max_hull_strength;
Hud_obs_ship.ship_max_shield_strength = shipp->ship_max_shield_strength;
memcpy(&Hud_obs_ship.weapons, &shipp->weapons, sizeof(ship_weapon));
HUD_config.is_observer = 1;
HUD_config.show_flags = HUD_observer_default_flags;
HUD_config.show_flags2 = HUD_observer_default_flags2;
HUD_config.popup_flags = 0x0;
HUD_config.popup_flags2 = 0x0;
// shutdown any playing static animations
hud_init_target_static();
}
开发者ID:DahBlount,项目名称:Freespace-Open-Swifty,代码行数:34,代码来源:hudobserver.cpp
示例8: check_collision_precise
void gun_shell::check_collision_precise(ship& s, const vector3& oldrelpos,
const vector3& newrelpos)
{
// transform positions to s' local bbox space
quaternion qco = s.get_orientation().conj();
vector3f oldrelbbox = vector3f(qco.rotate(oldrelpos));
vector3f newrelbbox = vector3f(qco.rotate(newrelpos));
// now the model::get_min/get_max values can be used to compute the axis aligned bbox
float tmin = 0.0f, tmax = 1.0f;
// clip the line oldrelbbox->newrelbbox with the bbox
vector3f d = newrelbbox - oldrelbbox;
const vector3f& b = oldrelbbox;
vector3f bmin = s.get_model().get_min();
vector3f bmax = s.get_model().get_max();
if (fabs(d.x) > 1e-5) {
float t0 = (bmin.x - b.x) / d.x;
float t1 = (bmax.x - b.x) / d.x;
float ta = std::min(t0, t1);
float tb = std::max(t0, t1);
tmax = std::min(tmax, tb);
tmin = std::max(tmin, ta);
}
if (fabs(d.y) > 1e-5) {
float t0 = (bmin.y - b.y) / d.y;
float t1 = (bmax.y - b.y) / d.y;
float ta = std::min(t0, t1);
float tb = std::max(t0, t1);
tmax = std::min(tmax, tb);
tmin = std::max(tmin, ta);
}
if (fabs(d.z) > 1e-5) {
float t0 = (bmin.z - b.z) / d.z;
float t1 = (bmax.z - b.z) / d.z;
float ta = std::min(t0, t1);
float tb = std::max(t0, t1);
tmax = std::min(tmax, tb);
tmin = std::max(tmin, ta);
}
if (tmin <= tmax) {
//log_debug("shell hit object?!");
vector3f d = newrelbbox - oldrelbbox;
check_collision_voxel(s, oldrelbbox + d * tmin, oldrelbbox + d * tmax);
if (alive_stat == dead) return; // no more checks after hit
}
}
开发者ID:salamanderrake,项目名称:dangerdeep,代码行数:47,代码来源:gun_shell.cpp
示例9: hasConflictWith
bool ship::hasConflictWith(ship s) {
point p;
if(isVertical) {
for(int i = origin.y; i < (origin.y + length); i++) {
p.x = origin.x;
p.y = i;
if(s.containsPoint(p)) {
return true;
}
}
}else if(!isVertical) {
for(int i = origin.x; i < (origin.x + length); i++) {
p.x = i;
p.y = origin.y;
if(s.containsPoint(p)) {
return true;
}
}
}
return false;
}
开发者ID:ShaneHub,项目名称:Battleship,代码行数:21,代码来源:ship.cpp
示例10: drawHUD
//***********************************************************************************
// void drawHUD()
// This is a simple function to draw out the text description of where you are
//
//
//**********************************************************************************
int drawHUD(int mx, int my, ship &s)
{
string asciiPos;
string stringX;
string stringY;
int eight=8;
int input=0;
cout << "The Moon (m), your home base is located at: ";
//SetConsoleTextAttribute(hOut, FOREGROUND_GREEN);
cout << mx << ", " << my << " - You are located at: " << s.getX() << ", " << s.getY();
//SetConsoleTextAttribute(hOut, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
cout << "\nStatus - Fuel: " << s.getFuel() << " Spacebucks: " << s.getFunds() << endl;
cout << "Cargo Hold: Rice: " << s.getRice() << " IRON: " << s.getIron() << " SUGAR: " << s.getSugar() << endl;
//cout << "What do you want to do? (1 +x 2 -x 3 +y 4 -y -- 8 is quit) ";
cout << "Where do you want to move? (XX,YY -- 8 is quit) ";
cin >> asciiPos;
// error cehcking for input
outfile.open("inputLog.txt", ios::app);
outfile << "The time is: " << asctime(localtm) << " " << "asciiPos: " << asciiPos << endl;
outfile.close();
// ---------------
if (asciiPos == "8"){
exit(0);
}
stringX=asciiPos.substr(0,2);
stringY=asciiPos.substr(3,5);
parseMovement(stringX,stringY,s);
//parseStringY(stringY,s.getY());
if (atoi(asciiPos.c_str()) == eight)
{
input=8;
}
else
{
// Input is coming in a format of XX,YY a five char string
// it is beingsplit assuming that the input is two chars comma and two more
// each value is being assigned to the x,y value - which is strange because I think
// the x,y value is opposite anyway. =P
// s.setX(atoi(stringX.c_str())); // must cast the string into an integer so that you can repostion your ship
//s.setY(atoi(stringY.c_str())); // ditto
}
return input;
}
开发者ID:setr,项目名称:C_Space,代码行数:57,代码来源:main.cpp
示例11: main
//.........这里部分代码省略.........
//change music after 90 seconds
if(tmMusic.getTicks()>90000) {
newBGM();
tmMusic.start();
}
//score acceleration
if(tmTimeAlive.getTicks()>30000) iScoreAccel=13;
else if(tmTimeAlive.getTicks()>15000) iScoreAccel=6;
else if(tmTimeAlive.getTicks()>7500) iScoreAccel=3;
else if(tmTimeAlive.getTicks()>0) iScoreAccel=1;
//score timing
if(tmScore.getTicks()>250) {
iScore+=iScoreAccel;
tmScore.start();
}
//1up timing
if(tmTimeAlive.getTicks()>45000) {
tmTimeAlive.start();
iLife++;
//don't let player have too many lives
//if 1up is allowed, play sound
if(iLife>5)iLife=5;
else if(Mix_PlayChannel(-1,chGain,0)==-1) return 1;
}
//while there's science to do
while(SDL_PollEvent(&event)) {
//ship controls
myship.handleInput();
//other controls
if(event.type==SDL_KEYDOWN) {
switch(event.key.keysym.sym) {
case SDLK_ESCAPE:
quitGame=true;
quitOver=true;
quitAll=true;
break;
case SDLK_x:
if(useBomb()==false) return 1;
break;
default:
;
}
}
//if the window gets X'd
if(event.type == SDL_QUIT) {
quitGame = true;
quitOver=true;
quitAll=true;
}
}
//update screen data
myship.move(tmDelta.getTicks()); //update ship's position
tmDelta.start(); //restart change of time timer
printb(0,0,sfBG,sfScreen); //print background
myship.show(); //print position to screen
if(diedRecently==true) printb(120,0,sfDeathOverlay,sfScreen,NULL);
开发者ID:PocketEngi,项目名称:shutengu,代码行数:67,代码来源:shutengu.cpp
示例12: Shop
// added by Soren Haurburg
//void Planet::Shop(int &money, int &fuel, Commodity &shipIron, Commodity &shipSugar, Commodity &shipRice, int CARGO_MAX)
void planet::Shop(ship &s)
{
// HANDLE hStdout;
// hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
// SetConsoleActiveScreenBuffer(hStdout);
char pressedKey = '0';
while(pressedKey != 'E' && pressedKey != 'e')
{
system("cls");
// SetConsoleTextAttribute(hStdout, FOREGROUND_GREEN | FOREGROUND_RED);
cout << "\n\t\t\tWelcome to " << *planetName << endl;
int n=0; for (n=0;n < 24; n++) { printf("\n"); }
// SetConsoleTextAttribute(hStdout, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE);
cout << "\tYou have the follwing..." << endl;
cout << "\t\tIron: " << s.getIron() << "Sugar: " << s.getSugar() << "Rice: " << s.getRice() << endl;
cout << "\t\tMoney: " << s.getFunds() << "Fuel: " << s.getFuel() << "Cargo Space left: " << s.getCARGO_MAX()-(s.getIron()+s.getRice()+s.getSugar()) << endl;
cout << "\n\tHere are your available actions on planet " << /*planetName*/ "Jupiter" << ":" << endl;
if (ironDesiredQuantity>ironQuantity)
{
cout << "\n\t\t\t1. "<< *planetName << "will Buy Iron for: " << ((ironDesiredQuantity/ironQuantity) * ironQuantity) << endl;
}
else
{
cout << "\t\t\t5. " << *planetName << "will sell Iron for: " << ((ironQuantity/ironDesiredQuantity) * ironQuantity) << endl;
}
/*cout << "\n\t\t\t1. Buy Iron for: " << Iron.getBuyValue() << endl;
cout << "\t\t\t2. Buy Sugar for: " << Sugar.getBuyValue() << endl;
cout << "\t\t\t3. Buy Rice for: " << Rice.getBuyValue() << endl;
cout << "\t\t\t4. Buy Fuel for: " << fuelPrice << endl;
cout << "\t\t\t5. Sell Iron for: " << Iron.getSellValue() << endl;
cout << "\t\t\t6. Sell Sugar for: " << Sugar.getSellValue() << endl;
cout << "\t\t\t7. Sell Rice for: " << Rice.getSellValue() << endl;
cout << "\t\t\tU. Buy Upgrades" << endl;
*/
cout << "\t\t\tE. Exit " << "Planet Name Here";
cin >> pressedKey;
switch(pressedKey)
{
case '1':
buyCommodity(s, "Iron");
break;
case '2':
// buyCommodity(s, Sugar);
break;
case '3':
// buyCommodity(s, Rice);
break;
case '4':
// buyFuel(s);
break;
case '5':
sellCommodity(s, "Iron");
break;
case '6':
// sellCommodity(s, Sugar);
break;
case '7':
// sellCommodity(s, Rice);
break;
case 'U':
// upgradeShip(s);
break;
case 'u':
// upgradeShip(s);
break;
case 'E':
//leaving planet
break;
case 'e':
//leaving planet
break;
default:
cout << "Please pick one of the available options. " << endl;
break;
}// end of switch
}
}
开发者ID:bsansone,项目名称:C_Space,代码行数:85,代码来源:planet.cpp
示例13: checkIfAtPlanet
//***********************************************************************************
// void checkIfAtPlanet()
// This fucntion checks to see if you have arrived at a planet, then it'd put you
// in the store.
//
//**********************************************************************************
void checkIfAtPlanet(ship &s,planet &jupiter,planet &earth,planet &mars,planet &ganymede,planet &moon,planet &saturn,planet &neptune,planet &pluto,planet &ceres)
{
short input = 0;
//**********************************************************************************
// 1. Jupiter
//**********************************************************************************
if (s.getX()==jupiter.getX() && s.getY()==jupiter.getY())
{
jupiter.Shop(s);
}
// end of jupiter if
//**********************************************************************************
// 2. Earth
//**********************************************************************************
if (s.getX()==earth.getX() && s.getY()==earth.getY())
{
earth.Shop(s);
}
// end of earth if
//**********************************************************************************
// 3. Mars
//**********************************************************************************
if (s.getX()==mars.getX() && s.getY()==mars.getY())
{
mars.Shop(s);
}
// end of mars if
//**********************************************************************************
// 4. Ganymede
//**********************************************************************************
if (s.getX()==ganymede.getX() && s.getY()==ganymede.getY())
{
ganymede.Shop(s);
}
//**********************************************************************************
// 5. Saturn
//**********************************************************************************
if (s.getX()==saturn.getX() && s.getY()==saturn.getY())
{
saturn.Shop(s);
}
//**********************************************************************************
// 6. Pluto
//**********************************************************************************
if (s.getX()==pluto.getX() && s.getY()==pluto.getY())
{
pluto.Shop(s);
}
//**********************************************************************************
// 7. Ceres
//**********************************************************************************
if (s.getX()==ceres.getX() && s.getY()==ceres.getY())
{
ceres.Shop(s);
}
//**********************************************************************************
// 8. Neptune
//**********************************************************************************
if (s.getX()==neptune.getX() && s.getY()==neptune.getY())
{
neptune.Shop(s);
}
//**********************************************************************************
// 9. Moon -- different from planet
//**********************************************************************************
if (s.getX()==moon.getX() && s.getY()==moon.getY())
{
do
{ // begin do loop
input = checkIfAtMoonMenu(s,jupiter,earth,mars,ganymede,moon,saturn,neptune,pluto,ceres);
//.........这里部分代码省略.........
开发者ID:Alfredof10,项目名称:C_Space,代码行数:101,代码来源:main.cpp
示例14: handle_key_down
static void handle_key_down( SDL_keysym* keysym )
{
switch( keysym->sym ) {
case SDLK_ESCAPE:
quit_tutorial( 0 );
break;
case SDLK_SPACE:
s.expand();
s.expand();
s.expand();
s.expand();
s.expand();
s.expand();
s.expand();
s.expand();
s.expand();
s.expand();
break;
default:
break;
}
}
开发者ID:rsaxvc,项目名称:vertifall,代码行数:25,代码来源:main.cpp
注:本文中的ship类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论