本文整理汇总了C++中Floor::init方法的典型用法代码示例。如果您正苦于以下问题:C++ Floor::init方法的具体用法?C++ Floor::init怎么用?C++ Floor::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floor
的用法示例。
在下文中一共展示了Floor::init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, const char * argv[]) {
char command;
char dir;
char race;
string s;
Floor* f;
bool end = false;
int score;
ifstream in("welcome.txt"); // welcome page
while (getline(in, s)) {
cout << s << endl;
}
while (true) { // determine if whitespace is pressed
cin >> command;
if (command == 'c') {
break;
}
if (command == 'q') {
return 0;
}
}
f = new Floor(25, 79); // choose race
f->init(argv[1]);
cout << "please choose your race" << endl;
cout << "h: human" << endl;
cout << "d: dwarf" << endl;
cout << "e: evlves" << endl;
cout << "o: orc" << endl;
cout << "i: ironman" << endl;
while (true) {
cin >> race; // specify race
if (race == 'q') return 0;
else if (race == 'h' || race == 'e' || race == 'd' || race == 'o' ||
race == 'i') break;
else cout << "no such race" << endl;
}
switch(race) { // spawn pc and stair
case 'h':
character = new Human;
f->newGame(character);
break;
case 'e':
character = new Elves;
f->newGame(character);
break;
case 'd':
character = new Dwarf;
f->newGame(character);
break;
case 'o':
character = new Orc;
f->newGame(character);
break;
case 'i':
character = new Ironman;
f->newGame(character);
break;
}
f->enemyMove();
f->notifyTd();
cout << *f;
while (true) {
if (character->getHp() <= 0) { // determine if PC is dead
ifstream in("lose.txt");
while(getline(in, s)) {
cout << s << endl;
}
score = character->getGold();
if (character->getRace() == "human") {
score += score / 2;
}
cout << "Your Score is: " << score << endl;
end = true;
}
cin >> command;
if (end == true) { // wait for r or q after previous game
while (command != 'r' && command != 'q') {
cin >> command;
}
end = false;
}
switch(command) {
case 'n': // move
cin >> dir;
switch(dir) {
case 'w':
f->pcMove(0);
break;
case 'o':
f->pcMove(1);
break;
//.........这里部分代码省略.........
示例2: initApp
void ColoredCubeApp::initApp()
{
D3DApp::initApp();
audio->playCue(MAIN_TRACK);
srand(time(0));
left = Vector3(1,0,0);
right = Vector3(-1,0,0);
forward = Vector3(0,0,-1);
back = Vector3(0,0,1);
up = Vector3(0,1,0);
down = Vector3(0,-1,0);
zero = Vector3(0,0,0);
whiteBox.init(md3dDevice, 1.0f, WHITE);
redBox.init(md3dDevice, 1.0f, RED);
blueBox.init(md3dDevice, 1.0f, BLUE);
greenBox.init(md3dDevice, 1.0f, GREEN);
crimBox.init(md3dDevice, 0.8f, CRIMSON);
dRedBox.init(md3dDevice, 0.8f, DARKRED);
dBlueBox.init(md3dDevice, 0.25f, DARKBLUE);
line.init(md3dDevice, 10.0f, GREEN);
////// New Stuff added by Steve //////
gLine.init(md3dDevice, 10.0f, GREEN);
rLine.init(md3dDevice, 10.0f, RED);
bLine.init(md3dDevice, 10.0f, BLUE);
xLine.init(&rLine, Vector3(0,0,0), 10);
xLine.setPosition(Vector3(0,0,0));
yLine.init(&gLine, Vector3(0,0,0), 10);
yLine.setPosition(Vector3(0,0,0));
yLine.setRotationZ(ToRadian(90));
zLine.init(&bLine, Vector3(0,0,0), 10);
zLine.setPosition(Vector3(0,0,0));
zLine.setRotationY(ToRadian(90));
numberOfObstacles = 50;
float obstacleScale = 2.5f;
float playerScale = 2.67f;
Vector3 oScale(obstacleScale, obstacleScale, obstacleScale);
Vector3 pScale(playerScale, playerScale, playerScale);
playerBox.init(md3dDevice, playerScale, WHITE);
player.init(&playerBox, sqrt(playerScale * 2.0f), Vector3(0, 2, 0), Vector3(0, 0, 0), 10, pScale, audio);
player.linkInput(input);
int posZ = 0;
int posX = 0;
int chance = 0;
int r = 0;
float floorSpeed = floor.getSpeed();
for (int i=0; i<numberOfObstacles; ++i)
{
Box* box = new Box();
box->init(md3dDevice, obstacleScale, GREEN);
obstacleBoxes.push_back(box);
Obstacle o;
o.init(box, sqrt(5.0f), Vector3(0,0,200), Vector3(0,0,-1), 0, Vector3(oScale));
o.setInActive();
obstacles.push_back(o);
}
///Set obstacle cluster variables
clusterSize = 1;
clusterSizeVariation = 3;
clusterSeparation = 100;
cubeSeparation = 30;
lineJiggle = 3;
cubeJiggle = 3;
clusterJiggle = 10;
floorMovement = 0.0f;
//Other floor variables
floorClusterCounter = 0;
floorClusterThreshold = 7;
floorSpeedIncrease = 5;
//New spectrum HUD by Andy
specHudBox[0].init(md3dDevice, .5f, 1.0f, 1.0f, RED, YELLOW);
specHudBox[1].init(md3dDevice, .5f, 1.0f, 1.0f, YELLOW, GREEN);
specHudBox[2].init(md3dDevice, .5f, 1.0f, 1.0f, GREEN, CYAN);
specHudBox[3].init(md3dDevice, .5f, 1.0f, 1.0f, CYAN, BLUE);
specHudBox[4].init(md3dDevice, .5f, 1.0f, 1.0f, BLUE, MAGENTA);
specHudBox[5].init(md3dDevice, .5f, 1.0f, 1.0f, MAGENTA, RED);
cursorBox.init(md3dDevice, .15f, 1.0f, .75f, BLACK, BLACK);
Vector3 specPos = Vector3(11.0f, 25.0f, -5.0f);
spectrum[0].init(&specHudBox[0], 1.0f,specPos + Vector3(0.0f,0.0f,0.0f), Vector3(0.0f,0.0f,0.0f), 0, Vector3(0.0f,0.0f,0.0f));
spectrum[1].init(&specHudBox[1], 1.0f,specPos + Vector3(2.0f,0.0f,0.0f), Vector3(0.0f,0.0f,0.0f), 0, Vector3(0.0f,0.0f,0.0f));
spectrum[2].init(&specHudBox[2], 1.0f,specPos + Vector3(4.0f,0.0f,0.0f), Vector3(0.0f,0.0f,0.0f), 0, Vector3(0.0f,0.0f,0.0f));
spectrum[3].init(&specHudBox[3], 1.0f,specPos + Vector3(6.0f,0.0f,0.0f), Vector3(0.0f,0.0f,0.0f), 0, Vector3(0.0f,0.0f,0.0f));
spectrum[4].init(&specHudBox[4], 1.0f,specPos + Vector3(8.0f,0.0f,0.0f), Vector3(0.0f,0.0f,0.0f), 0, Vector3(0.0f,0.0f,0.0f));
spectrum[5].init(&specHudBox[5], 1.0f,specPos + Vector3(10.0f,0.0f,0.0f), Vector3(0.0f,0.0f,0.0f), 0, Vector3(0.0f,0.0f,0.0f));
cursor.init(&cursorBox,1.0f,specPos + Vector3(-.80f, -1.0f, 0.0f), Vector3(0.0f,0.0f,0.0f), 0, Vector3(0.0f,0.0f,0.0f));
gameObject1.init(&whiteBox, sqrt(2.0f), Vector3(-10,0,0), Vector3(0,0,0), 0,Vector3(2,2,2));
gameObject2.init(&redBox, sqrt(2.0f), Vector3(4,0,0), Vector3(0,0,0), 0,Vector3(2,2,2));
gameObject3.init(&redBox, sqrt(2.0f), Vector3(-4,0,0), Vector3(0,0,0), 0,Vector3(2,2,2));
//.........这里部分代码省略.........