我是初学者,我正在尝试编写我的第一个游戏。我正在关注前段时间制作的教程。这是我的代码:
#include <windows.h>
//Callback function
LRESULT CALLBACK window_callback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
//Create Window Class
WNDCLASS window_class = {};
window_class.style = CS_HREDRAW | CS_VREDRAW;
window_class.lpszClassName = L"Game Window Class";
window_class.lpfnWndProc = window_callback;
//Register Class
RegisterClass(&window_class);
//Create Window
CreateWindow(window_class.lpszClassName, "My First Game!", WS_OVERLAPPEDWINDOW | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 1280, 720, 0, 0, hInstance, 0);
};
当我尝试编译代码时,它给了我这两个错误:
E0167 argument of type "const char *" is incompatible with parameter of type "LPCWSTR"
C2664 'HWND CreateWindowExW(DWORD,LPCWSTR,LPCWSTR,DWORD,int,int,int,int,HWND,HMENU,HINSTANCE,LPVOID)': cannot convert argument 3 from 'const char [15]' to 'LPCWSTR'
我究竟做错了什么?