0

私は最近、ライブラリ SFML を Visual Studio 2012 C++ で使い始めました。

カスタムフォントの使用を開始するまではすべて正常に機能していましたが、これらのメッセージがポップアップして何も機能しませんでした:

'Graphics test.exe' (Win32): Loaded 'C:\Users\Oliver Bolt\Documents\Visual Studio 2012\Projects\Graphics test\Debug\Graphics test.exe'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Program Files\AVAST Software\Avast\snxhk.dll'. Cannot find or open the PDB file.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\opengl32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\glu32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ddraw.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dciman32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp110d.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr110d.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nvinit.dll'. Cannot find or open the PDB file.
'Graphics test.exe' (Win32): Loaded 'C:\Program Files (x86)\NVIDIA Corporation\coprocmanager\_etoured.dll'. Cannot find or open the PDB file.
'Graphics test.exe' (Win32): Loaded 'C:\Program Files (x86)\NVIDIA Corporation\coprocmanager\Nvd3d9wrap.dll'. Cannot find or open the PDB file.
'Graphics test.exe' (Win32): Loaded 'C:\Program Files (x86)\NVIDIA Corporation\coprocmanager\nvdxgiwrap.dll'. Cannot find or open the PDB file.
'Graphics test.exe' (Win32): Loaded 'C:\PROGRA~2\OPTIMI~1\OPTPRO~1.DLL'. Module was built without symbols.
'Graphics test.exe' (Win32): Unloaded 'C:\PROGRA~2\OPTIMI~1\OPTPRO~1.DLL'
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ig7icd32.dll'. Cannot find or open the PDB file.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\igdusc32.dll'. Cannot find or open the PDB file.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\version.dll'
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dinput.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\hid.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wintrust.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ole32.dll'
The thread 0xed8 has exited with code 0 (0x0).
The thread 0x131c has exited with code 0 (0x0).
The thread 0x105c has exited with code 0 (0x0).
The thread 0x19e8 has exited with code 0 (0x0).
The thread 0xeb4 has exited with code 0 (0x0).
The thread 0x187c has exited with code 0 (0x0).
The thread 0x1c78 has exited with code 0 (0x0).
The thread 0x480 has exited with code 0 (0x0).
The thread 0x1244 has exited with code 0 (0x0).
The program '[4124] Graphics test.exe' has exited with code 0 (0x0).

これらのエラーの原因となったプログラム:

#include <SFML\System.hpp>
#include <SFML\Graphics.hpp>
#include <ctime>
#include <sstream>

using namespace sf;
using namespace std;

int main()
{
    VideoMode videoMode(320, 240);
    RenderWindow window(videoMode, "Plus or minus");

    Font font;
    if (!font.loadFromFile("TOMB.TTF"))
    {
        return EXIT_FAILURE;
    }

    Text title("Plus Or Minus", font, 20);
    title.setPosition(10, 10);
    title.setColor(Color::White);

    Text question("What is your guess ?",font,20);
    question.setPosition(5,30);
    question.setColor(Color::White);

    Text enter("", font, 20);
    enter.setPosition(5, 50);
    enter.setColor(Color::Green);
    String textEntered;
    int numEntered = 0;

    Text status("", font, 16);
    status.setPosition(100, 50);
    status.setColor(Color::Yellow);
    stringstream out("");

    Text won("You have discovered\n the secret number\n in less than 10 tries,\n well played !", font, 20);
    won.setPosition(5, 70);
    won.setColor(Color::Green);

    Text lost("You have failed to\n discover the secret\n number in less than\n 10 tries, better \nluck next time!", font, 20);
    lost.setPosition(5, 70);
    lost.setColor(Color::Red);

    srand(static_cast<unsigned int> (time(NULL)));

    int secretNumber = rand() % 100;

    bool isGameOn = true;
    bool playerWon = false;
    int tryNumber = 0;

    while (window.isOpen())
    {
        window.clear();
        window.draw(title);
        if (isGameOn)
        {
            window.draw(question);
            window.draw(enter);
            window.draw(status);
        }
        else
        {
            if (playerWon)
            {
                window.draw(won);
            }
            else
            {
                window.draw(lost);
            }
        }

        window.display();

        Event event;
        while (window.pollEvent(event))
        {
            if ((event.type == Event::Closed) || ((event.type == Event::KeyPressed) && (event.key.code == Keyboard::Escape)))
            {
                window.close();
            }

            if (event.type == Event::TextEntered)
            {
                char c = static_cast<char> (event.text.unicode);
                if (c >= '0' && c <= '9')
                {
                    textEntered += event.text.unicode;
                    enter.setString(textEntered);
                }
                else if (c == '\r')
                {
                    tryNumber++;

                    stringstream in(enter.getString());
                    in >> numEntered;

                    if (numEntered > secretNumber)
                    {
                        out << tryNumber;
                        out << ". ";
                        out << numEntered;
                        out << ": Minus" << endl;
                        status.setString(out.str());
                    }
                    if (numEntered < secretNumber)
                    {
                        out << tryNumber;
                        out << ". ";
                        out << numEntered;
                        out << ": Plus" << endl;
                        status.setString(out.str());
                    }
                    if (numEntered == secretNumber)
                    {
                        playerWon = true;
                        status.setString("");
                        isGameOn = false;
                    }
                    if (tryNumber > 10)
                    {
                        playerWon = false;
                        status.setString("");
                        isGameOn = false;
                    }
                    textEntered = "";
                }
            }
        }
        return EXIT_SUCCESS;
    }
}

私は周りを検索しましたが、この問題に対する答えが実際には見つかりませんでした。誰かがこれを解決するのを手伝ってくれたら本当に感謝しています! :)

よろしくお願いします

フリーサイレンティ

4

1 に答える 1

1

ループreturnの最後にステートメントがあります。while (window.isOpen()) { ... }したがって、ループは 1 回だけ実行されます。

于 2013-10-03T16:31:01.927 に答える