我在这个项目中没有UNICODE.这是一个WinAPI项目,变量"input"是一个字符串流,默认值为"0".为什么第一个id语句运行而不是第二个,即使字符串本身为"0"?
void calc::AddToInput(int number)
{
MessageBox(NULL, input.str().c_str(), "Input", NULL); //Shows "0"
if(input.str().c_str() != "0") //Runs even though it shouldn't
{
input << number;
}
else if(input.str().c_str() == "0") //Doesn't run though it should
{
input.str("");
input << number;
}
}
Run Code Online (Sandbox Code Playgroud) 我最近开始研究 C++ Win32 API 来制作 2D 游戏,作为我今年毕业的最后一个项目。我已经学习了一门全年的 C++ 控制台编程课程,因此我对该语言有很好的了解。
在过去的三天里,我每天花费大约 6-8 个小时在 Google 和图书馆上试图找到任何可以让我开始做这件事的东西,但没有任何结果。我查看了一些基本窗口的代码,对我来说这看起来像是外星语言。
这里有人知道一个好的起点在哪里吗?
非常感谢您的帮助,因为如果我不成功,我的整个教育,即在学校的所有 2300 个小时都将被浪费。现在只觉得无望。直到 11 月中旬我们的第二门编程课程才会开始使用 WinAPI,我不能浪费 2 个月的时间无所事事。该项目的截止日期是一月中旬...
请不要向我推荐 DirectX、SDL、SDML、OpenGL、Allergo 或任何其他图形库。
我的老师告诉我关于使用图像,你可以制作某种窗口区域用于碰撞等。这是可以实现的吗?
我尝试编译VS2012项目时遇到以下错误:
错误LNK2019:未解析的外部符号"public:int __thiscall map :: GetBlockRef(int,int)"(?GetBlockRef @ map @@ QAEHHH @ Z)在函数"public:void __thiscall map :: LoadLevel(int)"中引用(? LoadLevel @图@@ QAEXH @ Z)
错误LNK1120:1个未解析的外部
我已经检查了各种网站的类似问题,但找不到任何.问题是在void map :: LoadLevel(int)中调用int map :: GetBlockRef(int,int).
为什么我不能调用GetBlockRef()?
map.h
#ifndef MAP_H
#define MAP_H
#include <windows.h>
#include <vector>
#include "Block.h"
using namespace std;
class map
{
public:
map();
int GetGridCoord(int);
int GetBlockRef(int, int); //Declared correctly
void LoadLevel(int);
vector<block>blocks;
vector<int>blockRef;
};
#endif
Run Code Online (Sandbox Code Playgroud)
map.cpp
#include "Map.h"
map::map()
{
for(int i = 0; i < 196; i++) …Run Code Online (Sandbox Code Playgroud)