I'm working on a school project and they say I have to use a struct for these variables. After I create an instance of the struct I can't access the members?? Any ideas or help is appreciated!
Ps. My project format is Win32 Console Application
This is my code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
//header file
#ifndef GAMEWINDOW_H_INCLUDED
#define GAMEWINDOW_H_INCLUDED
#include "Global.h"
struct GAMEWINDOW
{
HWND hWnd;
int width, height;
bool windowed;
// other game variables go here
};
#endif
then for main in cpp file
1 2 3 4 5 6 7 8 9 10 11 12 13
#include "Global.h"
void main()
{
//this is how I declare it
GAMEWINDOW gamewindow;
//what i want to do but won't allow access to it and nothing pops up when i put the full stop
gamewindow.width = 1024;
}
Please note global.h just contains a whole bunch of libraries and an include for the GameWindow.h