“无法找到或打开.PDB文件”Visual Studio 2012错误

时间:2015-03-26 14:00:06

标签: c++ windows visual-studio-2012 pdb-files

我正在使用Visual Studio C ++(2012)创建传统游戏Frogger。我使用大学的计算机(运行VS 2012)和家里运行相同的笔记本电脑。

确定要点的确切输出为:

  • ' Frogger.exe' (Win32):已加载' \ vfiler1 \ Home6 \ P14141796 \ Documents \ Visual Studio 2012 \ Projects \ Frogger \ Debug \ Frogger.exe'。符号已加载。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ ntdll.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ kernel32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ KernelBase.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ ProgramData \ Symantec \ Symantec Endpoint Protection \ 12.1.3001.165.105 \ Data \ Definitions \ BASHDefs \ 20150309.013 \ UMEngx86.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' \ vfiler1 \ Home6 \ P14141796 \ Documents \ Visual Studio 2012 \ Projects \ Frogger \ SFML-2.1 \ bin \ sfml-system-d-2.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ msvcr110d.dll'。符号已加载。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ msvcp110d.dll'。符号已加载。 ' Frogger.exe' (Win32):已加载' \ vfiler1 \ Home6 \ P14141796 \ Documents \ Visual Studio 2012 \ Projects \ Frogger \ SFML-2.1 \ bin \ sfml-graphics-d-2.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' \ vfiler1 \ Home6 \ P14141796 \ Documents \ Visual Studio 2012 \ Projects \ Frogger \ SFML-2.1 \ bin \ sfml-window-d-2.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ opengl32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ msvcrt.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ advapi32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ sechost.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ rpcrt4.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ sspicli.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ cryptbase.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ gdi32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ user32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ lpk.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ usp10.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ glu32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ ddraw.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ dciman32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ setupapi.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ cfgmgr32.dll'。无法找到或打开PDB文件。 ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ oleaut32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ ole32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ devobj.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ dwmapi.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ winmm.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ imm32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ msctf.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ uxtheme.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ nvoglv32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ shell32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ shlwapi.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ version.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ gdi32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已卸载' C:\ Windows \ SysWOW64 \ gdi32.dll'
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ wintrust.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ crypt32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ msasn1.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ ntmarta.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ Wldap32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ powrprof.dll'。无法找到或打开PDB文件。 线程0x1644已退出,代码为0(0x0)。
  • ' Frogger.exe' (Win32):已卸载' C:\ Windows \ SysWOW64 \ powrprof.dll' 线程0x79c已退出,代码为0(0x0)。 线程0x15b8已退出,代码为0(0x0)。 线程0x1460已退出,代码为0(0x0)。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ dinput.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ hid.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ ole32.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已卸载' C:\ Windows \ SysWOW64 \ ole32.dll'
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ apphelp.dll'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已加载' C:\ Windows \ SysWOW64 \ cmd.exe'。无法找到或打开PDB文件。
  • ' Frogger.exe' (Win32):已卸载' C:\ Windows \ SysWOW64 \ cmd.exe'
    • 线程0x180已退出,代码为-805306369(0xcfffffff)。
    • 线程0xb74已退出,代码为-805306369(0xcfffffff)。
    • 线程0xcf8已退出,代码为-805306369(0xcfffffff)。
    • 线程0x490已退出,代码为-805306369(0xcfffffff)。
    • 程序' [5440] Frogger.exe'已退出代码-805306369(0xcfffffff)
  • '流程没有响应,已被终止'。

我只想弄清楚我能做些什么,这是错误的 - 似乎没有一个PDB文件可以找到。我确定它很简单,但如果你愿意发表一个建议,那么我可以阻止它在将来发生。

Header.h文件如下:

#ifndef HEADER_H
#define HEADER_H
using namespace std;

#include <iostream>
#include <iomanip>
#include <string.h>
#include <iso646.h>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>

sf::Color Orange(255,128,0,255);
sf::Color Grey(170,170,170,255);
sf::Color Tarmac(53,46,46,255);
sf::Color E1(79,101,106,255);
sf::Color E2(90,46,87,255);
sf::Color E3(130,115,60,255);
sf::Color E4(130,87,60,255);
sf::Color E5(45,77,78,255);
sf::Color E6(129,81,111,255);
char cConf;
bool bAlive;

class EnemyTraffic {
friend int main();
friend void vDrawFrog();

private:
sf::VideoMode vm;

void vDefineScreen() {
sf::VideoMode vm = sf::VideoMode::getDesktopMode();
}

public:
bool bLeft;

sf::RectangleShape Enemy1;
sf::RectangleShape Enemy2;
sf::RectangleShape Enemy3;
sf::RectangleShape Enemy4;
sf::RectangleShape Enemy5;
sf::RectangleShape Enemy6;
sf::RectangleShape Enemy7;
sf::RectangleShape Enemy8;
sf::RectangleShape Enemy9;
sf::RectangleShape Enemy10;
sf::RectangleShape Enemy11;
sf::RectangleShape Enemy12;
sf::FloatRect Enemy1Border;
sf::FloatRect Enemy2Border;
sf::FloatRect Enemy3Border;
sf::FloatRect Enemy4Border;
sf::FloatRect Enemy5Border;
sf::FloatRect Enemy6Border;
sf::FloatRect Enemy7Border;
sf::FloatRect Enemy8Border;
sf::FloatRect Enemy9Border;
sf::FloatRect Enemy10Border;
sf::FloatRect Enemy11Border;
sf::FloatRect Enemy12Border;
bool bEnemy1Success, bEnemy2Success, bEnemy3Success, bEnemy4Success, bEnemy5Success, bEnemy6Success, bEnemy7Success, bEnemy8Success, bEnemy9Success, bEnemy10Success, bEnemy11Success, bEnemy12Success;
sf::RectangleShape arrShape[12];
float arrDivision[3];
float arrDivision2[4];

void vCreateEnemies() {
    arrShape[0] = Enemy1;
    arrShape[1] = Enemy2;
    arrShape[2] = Enemy3;
    arrShape[3] = Enemy4;
    arrShape[4] = Enemy5;
    arrShape[5] = Enemy6;
    arrShape[6] = Enemy7;
    arrShape[7] = Enemy8;
    arrShape[8] = Enemy9;
    arrShape[9] = Enemy10;
    arrShape[10] = Enemy11;
    arrShape[11] = Enemy12;
}

void vInitialiseDivisor() {
    arrDivision[0] = 2.f;
    arrDivision[1] = 4.f;
    arrDivision[2] = 1.35f;

    arrDivision2[0] = 7.f;
    arrDivision2[1] = 3.f;
    arrDivision2[2] = 2.f;
    arrDivision2[3] = 1.35f;
}


void vInitialiseSuccess () {
    bEnemy1Success = false;
    bEnemy2Success = false;
    bEnemy3Success = false;
    bEnemy4Success = false;
    bEnemy5Success = false;
    bEnemy6Success = false;
    bEnemy7Success = false;
    bEnemy8Success = false;
    bEnemy9Success = false;
    bEnemy10Success = false;
    bEnemy11Success = false;
    bEnemy12Success = false;
}


void vDrawEnemies() {
    for (int i = 0; i < 12; i++)
    {
        arrShape[i].setSize(sf::Vector2f(EnemyStream.vm.width / 18.f, EnemyStream.vm.height / 18.f));
        if (arrShape[i].getSize() != (sf::Vector2f(EnemyStream.vm.width / 18.f, EnemyStream.vm.height / 18.f))) {
            std::cout << "There was a problem setting the size for Enemy number " << [i] << std::endl;
        }
        arrShape[i].setOrigin(arrShape[i].getSize().x / 2.f,  arrShape[i].getSize().y / 2.f);
        if (arrShape[i].getOrigin() != (arrShape[i].getSize().x / 2.f, arrShape[i].getSize().y / 2.f)) {
            std::cout << "There was a problem setting the origin" << std::endl;
        }
        switch ((i % 3 == 0) & (i % 4)) {
        case 0: arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[0]),(EnemyStream.vm.height / arrDivision2[0]));
        case 1: arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[0]),(EnemyStream.vm.height / arrDivision2[1]));
        case 2: arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[0]),(EnemyStream.vm.height / arrDivision2[2]));
        case 3: arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[0]),(EnemyStream.vm.height / arrDivision2[3]));
        default: std::cout << "Error! Something went wrong with setting the first horizontal positions of the enemies!" << std::endl;
        }
        switch ((i % 3 == 1) & (i % 4)) {
        case 0: arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[1]),(EnemyStream.vm.height / arrDivision2[0]));
        case 1: arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[1]),(EnemyStream.vm.height / arrDivision2[1]));
        case 2: arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[1]),(EnemyStream.vm.height / arrDivision2[2]));
        case 3: arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[1]),(EnemyStream.vm.height / arrDivision2[3]));
        default: std::cout << "Error! Something went wrong with setting the second horizontal positions of the enemies!" << std::endl;
        }
        switch ((i % 3 == 2) & (i % 4)) {
        case 0: arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[2]),(EnemyStream.vm.height / arrDivision2[0]));
        case 1: arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[2]),(EnemyStream.vm.height / arrDivision2[1]));
        case 2: arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[2]),(EnemyStream.vm.height / arrDivision2[2]));
        case 3: arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[2]),(EnemyStream.vm.height / arrDivision2[3]));
        default: std::cout << "Error! Something went wrong with setting the third horizontal positions of the enemies!" << std::endl;
        }
        switch (i % 6) {
        case 0: arrShape[i].setFillColor(E1);
        case 1: arrShape[i].setFillColor(E2);
        case 2: arrShape[i].setFillColor(E3);
        case 3: arrShape[i].setFillColor(E4);
        case 4: arrShape[i].setFillColor(E5);
        case 5: arrShape[i].setFillColor(E6);
        default: std::cout << "Error! Something went wrong with setting the colours of the enemies!" << std::endl;
        }
    }

        /*else if ((i%3 == 1) & (i%4 == 1)) {
            arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[1]), EnemyStream.vm.height / arrDivision2[0]);
        }
        else if ((i%3 == 2) & (i%4 == 2)) {
            arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[2]), EnemyStream.vm.height / arrDivision2[0]);
        }
        else if ((i%3 == 0) & (i%4 == 3)) {
            arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[0]), EnemyStream.vm.height / arrDivision2[1]);
        }
        else if (i == 4) {
            arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[1]), EnemyStream.vm.height / arrDivision2[1]);
        }
        else if (i == 5) {
            arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[2]), EnemyStream.vm.height / arrDivision2[1]);
        }
        else if (i == 6) {
            arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[0]), EnemyStream.vm.height / arrDivision2[2]);
        }
        else if (i == 7) {
            arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[1]), EnemyStream.vm.height / arrDivision2[2]);
        }
        else if (i == 8) {
            arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[2]), EnemyStream.vm.height / arrDivision2[2]);
        }
        else if (i == 9) {
            arrShape[i].setPosition(0.f+(EnemyStream.vm.width / arrDivision[0]), EnemyStream.vm.height / arrDivision2[0]);
        }
        arrShape[i].setFillColor(E1);
    }
Enemy1.setSize(sf::Vector2f(EnemyStream.vm.width / 18.f, EnemyStream.vm.height / 18.f));
Enemy1.setOrigin(Enemy1.getSize().x / 2.f, Enemy1.getSize().y / 2.f);
Enemy1.setPosition(0.f+(EnemyStream.vm.width / 2.f), EnemyStream.vm.height / 7.f);
Enemy1.setFillColor(E1);

Enemy2.setSize(sf::Vector2f(EnemyStream.vm.width / 18.f, EnemyStream.vm.height / 18.f));
Enemy2.setOrigin(Enemy2.getSize().x / 2.f, Enemy2.getSize().y / 2.f);
Enemy2.setPosition(0.f+(EnemyStream.vm.width / 4.f), EnemyStream.vm.height / 7.f);
Enemy2.setFillColor(E2);

Enemy3.setSize(sf::Vector2f(EnemyStream.vm.width / 18.f, EnemyStream.vm.height / 18.f));
Enemy3.setOrigin(Enemy3.getSize().x / 2.f, Enemy3.getSize().y / 2.f);
Enemy3.setPosition(0.f+(EnemyStream.vm.width / 1.35f), EnemyStream.vm.height / 7.f);
Enemy3.setFillColor(E3);

Enemy4.setSize(sf::Vector2f(EnemyStream.vm.width / 18.f, EnemyStream.vm.height / 18.f));
Enemy4.setOrigin(Enemy4.getSize().x / 2.f, Enemy4.getSize().y / 2.f);
Enemy4.setPosition(0.f+(EnemyStream.vm.width / 2.f), EnemyStream.vm.height / 3.f);
Enemy4.setFillColor(E4);

Enemy5.setSize(sf::Vector2f(EnemyStream.vm.width / 18.f, EnemyStream.vm.height / 18.f));
Enemy5.setOrigin(Enemy5.getSize().x / 2.f, Enemy5.getSize().y / 2.f);
Enemy5.setPosition(0.f+(EnemyStream.vm.width / 4.f), EnemyStream.vm.height / 3.f);
Enemy5.setFillColor(E5);

Enemy6.setSize(sf::Vector2f(EnemyStream.vm.width / 18.f, EnemyStream.vm.height / 18.f));
Enemy6.setOrigin(Enemy6.getSize().x / 2.f, Enemy6.getSize().y / 2.f);
Enemy6.setPosition(0.f+(EnemyStream.vm.width / 1.35f), EnemyStream.vm.height / 3.f);
Enemy6.setFillColor(E6);

Enemy7.setSize(sf::Vector2f(EnemyStream.vm.width / 18.f, EnemyStream.vm.height / 18.f));
Enemy7.setOrigin(Enemy7.getSize().x / 2.f, Enemy7.getSize().y / 2.f);
Enemy7.setPosition(0.f+(EnemyStream.vm.width / 2.f), EnemyStream.vm.height / 2.f);
Enemy7.setFillColor(E1);

Enemy8.setSize(sf::Vector2f(EnemyStream.vm.width / 18.f, EnemyStream.vm.height / 18.f));
Enemy8.setOrigin(Enemy8.getSize().x / 2.f, Enemy8.getSize().y / 2.f);
Enemy8.setPosition(0.f+(EnemyStream.vm.width / 4.f), EnemyStream.vm.height / 2.f);
Enemy8.setFillColor(E2);

Enemy9.setSize(sf::Vector2f(EnemyStream.vm.width / 18.f, EnemyStream.vm.height / 18.f));
Enemy9.setOrigin(Enemy9.getSize().x / 2.f, Enemy9.getSize().y / 2.f);
Enemy9.setPosition(0.f+(EnemyStream.vm.width / 1.35f), EnemyStream.vm.height / 2.f);
Enemy9.setFillColor(E3);

Enemy10.setSize(sf::Vector2f(EnemyStream.vm.width / 18.f, EnemyStream.vm.height / 18.f));
Enemy10.setOrigin(Enemy10.getSize().x / 2.f, Enemy10.getSize().y / 2.f);
Enemy10.setPosition(0.f+(EnemyStream.vm.width / 2.f), EnemyStream.vm.height / 1.35f);
Enemy10.setFillColor(E4);

Enemy11.setSize(sf::Vector2f(EnemyStream.vm.width / 18.f, EnemyStream.vm.height / 18.f));
Enemy11.setOrigin(Enemy11.getSize().x / 2.f, Enemy11.getSize().y / 2.f);
Enemy11.setPosition(0.f+(EnemyStream.vm.width / 4.f), EnemyStream.vm.height / 1.35f);
Enemy11.setFillColor(E5);

Enemy12.setSize(sf::Vector2f(EnemyStream.vm.width / 18.f, EnemyStream.vm.height / 18.f));
Enemy12.setOrigin(Enemy12.getSize().x / 2.f, Enemy12.getSize().y / 2.f);
Enemy12.setPosition(0.f+(EnemyStream.vm.width / 1.35f), EnemyStream.vm.height / 1.35f);
Enemy12.setFillColor(E6);*/
}
void vDefineEnemyBorders () {
    sf::FloatRect Enemy1Border = Enemy1.getGlobalBounds();
    sf::FloatRect Enemy2Border = Enemy2.getGlobalBounds();
    sf::FloatRect Enemy3Border = Enemy3.getGlobalBounds();
    sf::FloatRect Enemy4Border = Enemy4.getGlobalBounds();
    sf::FloatRect Enemy5Border = Enemy5.getGlobalBounds();
    sf::FloatRect Enemy6Border = Enemy6.getGlobalBounds();
    sf::FloatRect Enemy7Border = Enemy7.getGlobalBounds();
    sf::FloatRect Enemy8Border = Enemy8.getGlobalBounds();
    sf::FloatRect Enemy9Border = Enemy9.getGlobalBounds();
    sf::FloatRect Enemy10Border = Enemy10.getGlobalBounds();
    sf::FloatRect Enemy11Border = Enemy11.getGlobalBounds();
    sf::FloatRect Enemy12Border = Enemy12.getGlobalBounds();
}
void vMove () {
    sf::Clock Rota;
    float TimeElapsed = Rota.getElapsedTime().asSeconds();

    if (TimeElapsed > 0.05)
    {
        if (EnemyStream.bLeft) {
            Enemy1.move(-8.f,0.f);
            Enemy2.move(-8.f,0.f);
            Enemy3.move(-8.f,0.f);
            Enemy4.move(8.f,0.f);
            Enemy5.move(8.f,0.f);
            Enemy6.move(8.f,0.f);
            Enemy7.move(-8.f,0.f);
            Enemy8.move(-8.f,0.f);
            Enemy9.move(-8.f,0.f);
            Enemy10.move(8.f,0.f);
            Enemy11.move(8.f,0.f);
            Enemy12.move(8.f,0.f);
        }
        else {
            Enemy1.move(8.f,0.f);
            Enemy2.move(8.f,0.f);
            Enemy3.move(8.f,0.f);
            Enemy4.move(-8.f,0.f);
            Enemy5.move(-8.f,0.f);
            Enemy6.move(-8.f,0.f);
            Enemy7.move(8.f,0.f);
            Enemy8.move(8.f,0.f);
            Enemy9.move(8.f,0.f);
            Enemy10.move(-8.f,0.f);
            Enemy11.move(-8.f,0.f);
            Enemy12.move(-8.f,0.f);
        }
        if (Enemy3.getPosition().x < -100.f) {
            EnemyStream.bLeft = false;
        }
        if (Enemy2.getPosition().x > (EnemyStream.vm.width + 100)) {
            EnemyStream.bLeft = true;
        }

        Rota.restart();
    }
}
}EnemyStream;


class FrogCharacter {
    friend int main();

private:
    sf::VideoMode vm;
    void vDefineScreen() {
        sf::VideoMode vm = sf::VideoMode::getDesktopMode();
    }

public:
bool bOnScreen;
bool bOnBase;
sf::RectangleShape frogAlive;
sf::FloatRect frogAliveBox;
sf::Event action;
sf::FloatRect HomeBaseBox1;
sf::FloatRect HomeBaseBox2;
sf::FloatRect HomeBaseBox3;
sf::RectangleShape HomeBase1;
sf::RectangleShape HomeBase2;
sf::RectangleShape HomeBase3;
sf::RectangleShape Start;

void vDrawFrog(sf::RectangleShape) {
    frogAlive.setSize(sf::Vector2f(frog1.vm.width / 20.f, frog1.vm.height / 18.f));
    frogAlive.setOrigin(frogAlive.getSize().x / 2.f, frogAlive.getSize().y / 2.f);
    frogAlive.setPosition(frog1.vm.width / 2.f, (frog1.vm.height - frogAlive.getSize().y));
    frogAlive.setFillColor(sf::Color::Green);
    frogAlive.setOutlineColor(sf::Color::Yellow);
    frogAlive.setOutlineThickness(5.f);
}
void vDefineFrogBase() {
    sf::FloatRect frogAliveBox = frogAlive.getGlobalBounds();
}
void vMoveFrog () {
    if (action.type == sf::Event::KeyPressed&&action.key.code == sf::Keyboard::Left)
    {
        frogAlive.move(-3.f,0.f);
    }
    if (action.type == sf::Event::KeyPressed&&action.key.code == sf::Keyboard::Right)
    {
        frogAlive.move(3.f,0.f);
    }
    if (action.type == sf::Event::KeyPressed&&action.key.code == sf::Keyboard::Up)
    {
        frogAlive.move(0.f,-3.f);
    }
    if (action.type == sf::Event::KeyPressed&&action.key.code == sf::Keyboard::Down)
    {
        frogAlive.move(0.f,3.f);
    }
}
void vFrogBase () {
    HomeBase1.setSize(sf::Vector2f(frog1.vm.width / 17.5f, frog1.vm.height / 16.f));
    HomeBase1.setOrigin(HomeBase1.getSize().x / 2.f, HomeBase1.getSize().y / 2.f);
    HomeBase1.setPosition(0.f+(frog1.vm.width / 2.f), frog1.vm.width / 2.f);
    HomeBase1.setFillColor(Orange);

    HomeBase2.setSize(sf::Vector2f(frog1.vm.width / 17.5f, frog1.vm.height / 16.f));
    HomeBase2.setOrigin(HomeBase2.getSize().x / 2.f, HomeBase2.getSize().y / 2.f);
    HomeBase2.setPosition(0.f+(frog1.vm.width / 4.f), frog1.vm.height / 15.f);
    HomeBase2.setFillColor(sf::Color::Yellow);

    HomeBase3.setSize(sf::Vector2f(frog1.vm.width / 17.5f, frog1.vm.height / 16.f));
    HomeBase3.setOrigin(HomeBase3.getSize().x / 2.f, HomeBase3.getSize().y / 2.f);
    HomeBase3.setPosition(0.f+(frog1.vm.width / 1.35f), frog1.vm.height / 15.f);
    HomeBase3.setFillColor(sf::Color::Red);

    Start.setSize(sf::Vector2f(float(vm.width), vm.height / 10.f));
    Start.setOrigin(Start.getSize().x / 2.f, Start.getSize().y / 2.f);
    Start.setPosition(0.f+(vm.width / 2.f), vm.height - (Start.getSize().y / 2.f));
    Start.setFillColor(sf::Color::Yellow);
}
void vBaseBorder () {
    HomeBaseBox1 = HomeBase1.getGlobalBounds();
    HomeBaseBox2 = HomeBase2.getGlobalBounds();
    HomeBaseBox3 = HomeBase3.getGlobalBounds();
}
void vFrogIntersection () {
if ((frogAliveBox.intersects(HomeBaseBox1)) | (frogAliveBox.intersects(HomeBaseBox2)) | (frogAliveBox.intersects(HomeBaseBox3)))
{
    cout << "Well done! You passed a level!" << endl;
    frogAlive.setPosition(frog1.vm.width / 2.f,(frog1.vm.height - frogAlive.getSize().y));
}
}

}frog1;

#endif

Main.cpp文件也在下面:

#ifndef MAIN_CPP
#define MAIN_CPP
#include <Header.h>

int main() {

    cout << "There are four levels, one of which is a practice please enter 'y' to confirm that you have read this. " << endl;
    cin >> cConf;

    if (cConf == 'y') {
    frog1.vDrawFrog(frog1.frogAlive);
    EnemyStream.vInitialiseDivisor();
    EnemyStream.vCreateEnemies();
    EnemyStream.vDrawEnemies();
    EnemyStream.vDefineEnemyBorders();
    EnemyStream.vMove();
    frog1.vDrawFrog(frog1.frogAlive);
    frog1.vDefineFrogBase();
    frog1.vFrogBase();
    frog1.vBaseBorder();

    sf::VideoMode vm = sf::VideoMode::getDesktopMode();
    sf::RenderWindow frogger(vm, "Frogger", sf::Style::Fullscreen);

    frogger.setFramerateLimit(60);

    while (frogger.isOpen()) {
        sf::Event action;

        if ((bAlive) & (!frog1.bOnBase)) {
            while (frogger.pollEvent(action)) {
                if (action.type == sf::Event::KeyPressed&&action.key.code == sf::Keyboard::Escape) {
                    frogger.close();
                    break;
                }
                frog1.vMoveFrog();
            }
            break;
        }

        frog1.vFrogIntersection();
        break;

        sf::Font Intro;
        if (!Intro.loadFromFile("../Seagram tfb.ttf")) {
            cerr << "Problem! This font file couldn't be loaded... " << endl;
            break;
        }

        sf::Text Instructions;
        Instructions.setFont(Intro);
        Instructions.setString("You have 3 lives following the practice run... ");
        Instructions.setCharacterSize(20);
        Instructions.setColor(Orange);
        Instructions.setPosition(1.f,1.f);
        Instructions.setStyle(sf::Text::Bold);

        if (frog1.bOnBase) {
            frogger.draw(Instructions);
        }
        frogger.clear(Tarmac);
        frogger.draw(frog1.Start);
        frogger.draw(EnemyStream.Enemy1);
        frogger.draw(EnemyStream.Enemy2);
        frogger.draw(EnemyStream.Enemy3);
        frogger.draw(EnemyStream.Enemy4);
        frogger.draw(EnemyStream.Enemy5);
        frogger.draw(EnemyStream.Enemy6);
        frogger.draw(EnemyStream.Enemy7);
        frogger.draw(EnemyStream.Enemy8);
        frogger.draw(EnemyStream.Enemy9);
        frogger.draw(EnemyStream.Enemy10);
        frogger.draw(EnemyStream.Enemy11);
        frogger.draw(EnemyStream.Enemy12);
        frogger.draw(frog1.HomeBase3);
        frogger.draw(frog1.HomeBase2);
        frogger.draw(frog1.HomeBase1);
        frogger.draw(frog1.frogAlive);
        if ((frog1.frogAliveBox.intersects(EnemyStream.Enemy1Border)) | (frog1.frogAliveBox.intersects(EnemyStream.Enemy2Border)) | (frog1.frogAliveBox.intersects(EnemyStream.Enemy3Border)) | (frog1.frogAliveBox.intersects(EnemyStream.Enemy4Border)) | (frog1.frogAliveBox.intersects(EnemyStream.Enemy5Border)) | (frog1.frogAliveBox.intersects(EnemyStream.Enemy6Border)) | (frog1.frogAliveBox.intersects(EnemyStream.Enemy7Border)) | (frog1.frogAliveBox.intersects(EnemyStream.Enemy8Border)) | (frog1.frogAliveBox.intersects(EnemyStream.Enemy9Border)) | (frog1.frogAliveBox.intersects(EnemyStream.Enemy10Border)) | (frog1.frogAliveBox.intersects(EnemyStream.Enemy11Border)) | (frog1.frogAliveBox.intersects(EnemyStream.Enemy12Border))) {
    break;
}
        frogger.display();
    }



    for (int frog = 3; frog >= 0; frog--) {
        cout << "Starting..." << endl;

        if (frog == 3) {
            cout << "Three levels left!" << endl;
        }
        else if (frog == 2) {
            cout << "Two levels left!" << endl;
            frog1.frogAlive.setOutlineColor(Orange);
        }
        else if (frog == 1) {
            cout << "Last level!" << endl;
            frog1.frogAlive.setOutlineColor(sf::Color::Red);
        }
        else {
            cout << "Please close this screen now. " << endl;
            system("pause");
            return 4011;
            sf::RenderWindow frog(sf::VideoMode(800,100), "Frogger", sf::Style::Close);

            sf::Event query;

            while (frog.isOpen()) {
            while (frog.pollEvent(query)) {
                if (query.type == sf::Event::Closed) {
                    frog.close();
                }


            sf::Font End;
            if (!End.loadFromFile("../varsity_regular.ttf")) {
                cerr << "Problem! This font file couldn't be loaded... " << endl;
            }

            frog.clear(Tarmac);

            sf::Text EndGame;
            EndGame.setFont(End);
            EndGame.setString("SO, THAT'S ALL FOR NOW FOLKS! ");
            EndGame.setCharacterSize(50);
            EndGame.setColor(sf::Color::Green);
            EndGame.setPosition(1.f,1.f);
            EndGame.setStyle(sf::Text::Bold);

            sf::Text DropShadow;
            DropShadow.setFont(End);
            DropShadow.setString("SO, THAT'S ALL FOR NOW FOLKS! ");
            DropShadow.setCharacterSize(50);
            DropShadow.setColor(sf::Color::Yellow);
            DropShadow.setPosition(5.f,5.f);
            DropShadow.setStyle(sf::Text::Bold);

            frog.draw(DropShadow);
            frog.draw(EndGame);

            frog.display();
        }
    }
}
}
    }

    else {
        system("pause");
        return 2989;
    }
}
#endif

如果堆叠溢出社区中的任何人可以给我任何可能的想法,我会感激不尽。

感谢您一看

- 非常迷茫的学生

0 个答案:

没有答案