I am trying to make a simple label that will show a string inside it. Basically I want it to sit at co-ord 5,5 on the form and be transparent.
I found the msdn page for labels, and the member list.
But I just can't figure out how to implement it.
I have my window set up and working:
(by the way, it is a very simple game I am making, using bitmap drawing as basic sprites). My intention is to use the label for the score.
current label code:
I am getting errors like:
Which leads me to believe I might have it in the wrong namespace or something. Also, do I not have to set the parent's handle or something?
I need a bit of help because the windows API confuses me. I normally program php or game mods so I can get a bit confused working at this lower level.
I found the msdn page for labels, and the member list.
But I just can't figure out how to implement it.
I have my window set up and working:
Code:
//prototype
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
//the window class
void RegisterMyWindow(HINSTANCE hInstance){
WNDCLASSEX wcex;
wcex.cbSize = sizeof(wcex);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = 0;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = BLACK; //black
wcex.lpszMenuName = NULL;
wcex.lpszClassName = L"SpaceShooterClass";
wcex.hIconSm = 0;
RegisterClassEx(&wcex);
}
//create the window
BOOL InitialiseMyWindow(HINSTANCE hInstance, int nCmdShow){
HWND hwnd;
hwnd = CreateWindow(L"SpaceShooterClass", L"Space Shooter", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT, GAME_WIDTH, GAME_HEIGHT, NULL, NULL, hInstance, NULL);
if(!hwnd) return FALSE;
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
ghwnd = hwnd;
return TRUE;
}
(by the way, it is a very simple game I am making, using bitmap drawing as basic sprites). My intention is to use the label for the score.
current label code:
Code:
//score lable, for the HUD
void makeScoreLabel(){
Label scoreLabel;
scoreLabel->BorderStyle = System::Windows::Forms::BorderStyle::None; //no border
scoreLabel->Text = L"Score:"; //content
//scoreLabel->AutoSize = true;
scoreLabel->Left = 5; //position
scoreLabel->Top = 5;
}
I am getting errors like:
vs2008 said:'Label' : undeclared identifier
syntax error : missing ';' before identifier 'scoreLabel'
'scoreLabel' : undeclared identifier
left of '->BorderStyle' must point to class/struct/union/generic type
Which leads me to believe I might have it in the wrong namespace or something. Also, do I not have to set the parent's handle or something?
I need a bit of help because the windows API confuses me. I normally program php or game mods so I can get a bit confused working at this lower level.