SFMLとこのチュートリアルを使用して簡単な2Dゲームを作成しようとしています。チュートリアルの現在の進捗状況をコード化する方法は次のとおりです。イベントクラスの列挙型EventTypeに問題があります。メンバー変数名はTypeです。
#include "stdafx.h"
#include "SplashScreen.h"
void SplashScreen::Show(sf::RenderWindow & renderWindow)
{
sf::Image image;
if(image.LoadFromFile("images/SplashScreen.png") != true)
{
return;
}
sf::Sprite sprite(image);
renderWindow.Draw(sprite);
renderWindow.Display();
sf::Event event;
while(true)
{
while(renderWindow.GetEvent(event))
{
if( event.Type == sf::Event::EventType::KeyPressed
|| event.Type == sf::Event::EventType::MouseButtonPressed
|| event.Type == sf::Event::EventType::Closed )
{
return;
}
}
}
}
これは私のstdafx.hです:
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#ifndef STDAFX_H
#define STDAFX_H
#include <stdio.h>
// TODO: reference additional headers your program requires here
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/Audio.hpp>
#include <map>
#include <iostream>
#include <cassert>
#endif //STDAFX_H
イベントの自動補完が機能しているので、Event.hppが含まれているようです。MouseButtonPressedおよび他のすべての列挙値はsf::Event::EventType::
、コードブロックのスコープの後に表示されます。Event.hppファイルもチェックしましたが、正しいです。コンパイラが私をいじっている理由がわかりません。
スコープを削除して「event.Type==KeyPressed」とだけ記述しようとすると、コンパイラは「Keypressedはこのスコープで宣言されていません」と表示します。Ubuntu12.04でコードブロック10.05を実行します。
何が悪いのか知っていますか?
編集:これは私のEvent.hppです