我正在使用Visual Studio 2010运行Windows 7.包含OpenGL的版本(#include)是版本1.1,我想使用合理的当前版本 - 某种版本3或4.
到达那个州我需要做什么?http://www.opengl.org/sdk/上的OpenGL SDK页面似乎表示您不允许下载SDK,并且http://www.opengl.org/wiki/Getting_Started上的OpenGL wiki 说您应该已经拥有它,如果您没有它,它会指向您可以下载图形卡制造商的DLL的网站.但是我肯定不需要为我将要使用的每个显卡构建一个不同版本的游戏.
StackOverflow似乎也没有任何东西,至少没有以我能遵循的方式表达.我只想要一个我可以运行的安装程序的下载链接,这将为我提供一个合理的最新OpenGL API ...我该去哪里获取它?
更新: OpenGL似乎具有某种类型的同义词习惯用法,它不涉及拥有SDK - 即包含.DLL,.lib和头文件.我正在使用DirectX.(事实上,DirectX SDK甚至包含文档!)
假设我有一个抽象基类Parent和子类Child1和Child2.如果我有一个函数,接受家长*,是有办法(或许与RTTI?)在运行时,以确定它是否是一个Child1*或*CHILD2的功能实际收到?
到目前为止,我在RTTI的经验是,当foo是Parent*时,typeid(foo)返回typeid(Parent*),而不管foo是其成员的子类.
是否有一个C函数可以执行相当于find_first_not_of,接收要搜索的字符串和一组字符并返回字符串中不属于该字符集的第一个字符?
假设代码看起来像这样模糊:
bool LoadGame() {
vector<string> SaveFile = LoadFromSaveFile();
Data = SaveFile.begin();
LoadCharacters(&Data);
// containing LoadOneCharacter(&Data) calls
LoadLocations(&Data);
// >> LoadOneLocation(&Data) calls
// etc.
}
Run Code Online (Sandbox Code Playgroud)
有没有办法在LoadCharacters(),LoadLocations()等内部检查Data当前是否指向SaveFile :: end(),而不将SaveFile :: end()传递给LoadGame()调用的所有函数?
(如果只是取消引用end()和更多引发异常而不是生成未定义的行为!)
尝试将一个新的 C++ 项目与 SFML 链接起来,我做了以下事情:
我从http://www.sfml-dev.org/tutorials/2.0/start-vc.php复制了示例 main() 。
当我尝试构建程序时,我收到 15 个 LNK2019 未解决的外部错误:
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::String(char const *,class std::locale const &)" (__imp_??0String@sf@@QAE@PBDABVlocale@std@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::~String(void)" (__imp_??1String@sf@@QAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" …Run Code Online (Sandbox Code Playgroud) 假设:
std::string ToShow,NumStr;
Run Code Online (Sandbox Code Playgroud)
以下显示"This is 19 ch00":
ToShow = "This is nineteen ch";
ToShow.resize(ToShow.length()+0);
NumStr = "00";
ToShow += NumStr;
mvaddstr(15,0,ToShow.c_str());
Run Code Online (Sandbox Code Playgroud)
以下显示"这是19 ch":
ToShow = "This is nineteen ch";
ToShow.resize(ToShow.length()+1);
NumStr = "0";
ToShow += NumStr;
mvaddstr(16,0,ToShow.c_str());
Run Code Online (Sandbox Code Playgroud)
在第二种情况下,operator + =不将字符串"0"添加到ToShow的末尾.有谁知道为什么?