Thread: Inventory, text game

  1. #31
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    I got these errors:
    PHP Code:
    157 c:/mydocu~1/c__~1/test.cpp
     
    (Each undeclared identifier is reported only 
    158 c
    :/mydocu~1/c__~1/test.cpp
     
    `MSGmsg' undeclared (first use this function)
    158 c:/mydocu~1/c__~1/test.cpp
     
    `MSGmsg' undeclared (first use this function)
    158 c:/mydocu~1/c__~1/test.cpp
     `MSGmsg' 
    undeclared (first use this function)
    158 c:/mydocu~1/c__~1/test.cpp
     
    `MSGmsg' undeclared (first use this function)
    158 c:/mydocu~1/c__~1/test.cpp
     
    `MSGmsg' undeclared (first use this function)
    206 c:/mydocu~1/c__~1/test.cpp
     `done' 
    undeclared (first use this function)
    206 c:/mydocu~1/c__~1/test.cpp
     
    `done' undeclared (first use this function) 
    *EDIT*
    I used PHP tags so its easier to read
    This war, like the next war, is a war to end war.

  2. #32
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    Originally posted by Blizzarddog
    I got these errors:
    PHP Code:
    157 c:/mydocu~1/c__~1/test.cpp
     
    (Each undeclared identifier is reported only 
    158 c
    :/mydocu~1/c__~1/test.cpp
     
    `MSGmsg' undeclared (first use this function)
    158 c:/mydocu~1/c__~1/test.cpp
     
    `MSGmsg' undeclared (first use this function)
    158 c:/mydocu~1/c__~1/test.cpp
     `MSGmsg' 
    undeclared (first use this function)
    158 c:/mydocu~1/c__~1/test.cpp
     
    `MSGmsg' undeclared (first use this function)
    158 c:/mydocu~1/c__~1/test.cpp
     
    `MSGmsg' undeclared (first use this function)
    206 c:/mydocu~1/c__~1/test.cpp
     `done' 
    undeclared (first use this function)
    206 c:/mydocu~1/c__~1/test.cpp
     
    `done' undeclared (first use this function) 
    *EDIT*
    I used PHP tags so its easier to read
    Runs spotless on my compiler.

  3. #33
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    Well, thats in a console app, otherwise, theres an error inthe resource file
    This war, like the next war, is a war to end war.

  4. #34
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    Hoo, wait up, what are you trying to compile? Post code plz.

  5. #35
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    that thing that RoD posted
    This war, like the next war, is a war to end war.

  6. #36
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    Code:
    /*	Steven Billington
    */
    
    /*	Here we set the libraries to be used in the program, and
    	trim some of the excess off of windows
    */
    
    #define WIN32_LEAN_AND_MEAN
    #pragma comment(lib, "opengl32.lib")
    #pragma comment(lib, "glu32.lib")
    #pragma comment(lib, "glaux.lib")
    
    
    /*	Include all needed headers for the project. Windows brings in
    	everything needed for the basic application, and the other three
    	bring in OpenGL related functions.
    */
    
    #include <windows.h>
    #include <gl/gl.h>
    #include <gl/glu.h>
    #include <gl/glaux.h>
    
    
    /*	These are our global variables. These are ok in this program,
    	but i wouldn't reccomend making a habit out of using global
    	variables. 
    
    	angle:	Holds current angle of rotating triangle
    	g_HDC:	Global Device Context
    */
    
    float angle = 0.0f;		
    HDC g_HDC;	
    			
    
    /*	Function:	SetupPixelFormat
    	
    	Purpose:	This function gets the setup for the pixel format,
    				go figure right?
    */
    
    void SetupPixelFormat(HDC hDC)
    {
    	int nPixelFormat;	/*	Pixel format index*/
    
    	static PIXELFORMATDESCRIPTOR pfd = {
    		sizeof(PIXELFORMATDESCRIPTOR),				//size of structure
    		1,											//version, always set to one
    		PFD_DRAW_TO_WINDOW |						//support window
    		PFD_SUPPORT_OPENGL |						//support opengl
    		PFD_DOUBLEBUFFER,							//support double buffering
    		PFD_TYPE_RGBA,								//RGBA color mode
    		32,											//32bit color mode
    		0,0,0,0,0,0,								//ignore color bits, not used
    		0,											//no alpha buffer
    		0,											//ignore shift bit
    		0,											//no accumulation buffer
    		0,0,0,0,									//ignore accumulation buffers
    		16,											//16 bit zbuffer size
    		0,											//no stencil buffer
    		0,											//no auxiliary buffer
    		PFD_MAIN_PLANE,								//main drawing plane
    		0,											//reserved
    		0,0,0 };									//layer masks ignored
    
    	/*	Choose best matching pixel format, return index*/
    	nPixelFormat = ChoosePixelFormat(hDC,&pfd);
    
    	/*	Set pixel format to device context*/
    	SetPixelFormat(hDC,nPixelFormat,&pfd);
    }
    
    /*	Function:	WndProc
    
    	Purpose:	This is our Windows Procedure Event Handler
    */
    
    LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    	static HGLRC hRC;						//rendering context
    	static HDC hDC;							//device context
    	char string[] = "Hello World!";			//display text
    	int width, height;						//window width, height
    
    	switch(message)
    	{
    		case WM_CREATE:						//window is being created
    
    			hDC = GetDC(hwnd);				//get current windows device context
    			g_HDC = hDC;
    			SetupPixelFormat(hDC);			//call your pixel format setup function
    
    			//create rendering context and make it current
    			hRC = wglCreateContext(hDC);
    			wglMakeCurrent(hDC,hRC);
    
    			return 0;
    			break;
    
    		case WM_CLOSE:						//window is closing
    
    			//deselect rendering context and delete it
    			wglMakeCurrent(hDC,NULL);
    			wglDeleteContext(hRC);
    
    			//send WM_QUIT to messagr queue
    			PostQuitMessage(0);
    
    			return 0;
    			break;
    
    		case WM_SIZE:
    
    			height = HIWORD(lParam);	//get height and width
    			width = LOWORD(lParam);
    
    			if (height == 0)			//don't want a divide by 0
    			{
    				height = 1;
    			}
    
    			//reset the viewport to new dimensions
    			glViewport(0,0,width,height);
    			glMatrixMode(GL_PROJECTION);		//set projection matrix
    			glLoadIdentity();					//reset proj matrix
    
    			//calculate aspect ratio of window
    			gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,1.0f,1000.0f);
    
    			glMatrixMode(GL_MODELVIEW);			//set modelview matrix
    			glLoadIdentity();					//reset mdeolv matrix
    
    			return 0;
    			break;
    
    		default:
    			break;
    
    
    	}
    
    	return (DefWindowProc(hwnd,message,wParam,lParam));
    }
    
    /*	Function:	WinMain
    
    	Purpose:	Do i need to state this? Ok, its the main function.
    */
    
    int APIENTRY WinMain(HINSTANCE hInstance,
                         HINSTANCE hPrevInstance,
                         LPSTR     lpCmdLine,
                         int       nCmdShow)
    {
     	WNDCLASSEX  windowClass;		//window class
    	HWND		hwnd;				//window handle
    	MSG			msg;				//message
    	bool		done;				//flag saying when app is complete
    
    	/*	Fill out the window class structure*/
    	windowClass.cbSize = sizeof(WNDCLASSEX);
    	windowClass.style = CS_HREDRAW | CS_VREDRAW;
    	windowClass.lpfnWndProc = WndProc;
    	windowClass.cbClsExtra = 0;
    	windowClass.cbWndExtra = 0;
    	windowClass.hInstance = hInstance;
    	windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    	windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
    	windowClass.hbrBackground = NULL;
    	windowClass.lpszMenuName = NULL;
    	windowClass.lpszClassName = "MyClass";
    	windowClass.hIconSm = LoadIcon(NULL, IDI_WINLOGO);
    
    	/*	Register window class*/
    	if (!RegisterClassEx(&windowClass))
    	{
    		return 0;
    	}
    
    	/*	Class registerd, so now create window*/
    	hwnd = CreateWindowEx(NULL,						//extended style
    						  "MyClass",				//class name
    						  "A Real OGL Win App",		//app name
    						  WS_OVERLAPPEDWINDOW |		//window style
    						  WS_VISIBLE |
    						  WS_SYSMENU |
    						  WS_CLIPCHILDREN |
    						  WS_CLIPSIBLINGS,
    						  100,100,					//x/y coords
    						  400,400,					//width,height
    						  NULL,						//handle to parent
    						  NULL,						//handle to menu
    						  hInstance,				//application instance
    						  NULL);					//no extra parameter's
    
    	/*	Check if window creation failed*/
    	if (!hwnd)
    	{
    		return 0;
    	}
    
    	ShowWindow(hwnd,SW_SHOW);		//displays window
    	UpdateWindow(hwnd);				//update window
    
    	done = false;					//inititalize condition variable
    
    	//main message loop
    	while(!done)
    	{
    		PeekMessage(&msg,hwnd,NULL,NULL,PM_REMOVE);
    
    		if (msg.message == WM_QUIT)
    		{
    			done = true;
    		}
    
    		else
    		{
    			//do rendering here
    			//clear screen and depth buffer
    			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    			glLoadIdentity();		//reset modelview matrix
    
    			angle = angle + 0.1f;		//increase rotation angle counter
    
    			if (angle >= 360.0f)		//reset angle counter
    			{
    				angle = 0.0f;
    			}
    
    			glTranslatef(0.0f,0.0f,-5.0f);			//move back 5 units
    			glRotatef(angle,0.0f,0.0f,1.0f);		//rotate along z-axis
    
    			glColor3f(1.0,0.0f,0.0f);				//set color to red
    			glBegin(GL_TRIANGLES);					//draw the triangle
    				glVertex3f(0.0f,1.0f,0.0f);
    				glVertex3f(0.0f,0.0f,0.0f);			
    				glVertex3f(1.0f,0.0f,0.0f);
    			glEnd();
    
    			SwapBuffers(g_HDC);						//bring back buffer to foreground
    
    			TranslateMessage(&msg);
    			DispatchMessage(&msg);
    
    		}
    
    	}
    
    
    	return msg.wParam;;
    }
    ^ This? What kind of project are you running it in then?

  7. #37
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    In a dev C++ wiindows app
    This war, like the next war, is a war to end war.

  8. #38
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    And what the f is pragma?
    This war, like the next war, is a war to end war.

  9. #39
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    Then i don't understand much of the errors, you have all the
    headers and libs? Check it in the dir

  10. #40
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    I copied it
    This war, like the next war, is a war to end war.

  11. #41
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    #Pragma's are compiler directive's.
    I'm not sure about if you can compile OpenGL programs under
    DEV++. I suggest look at the DEV forums.

  12. #42
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    I've done it before, Dev came with those type of programs
    This war, like the next war, is a war to end war.

  13. #43
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    Do keep in mind that the program RoD posted is developed
    for a specific compiler, probably the one he has, and might
    not work with DEV, ask RoD his compiler

  14. #44
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    Yea, okay.. are you on 24/7, travis?
    This war, like the next war, is a war to end war.

  15. #45
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    Originally posted by Blizzarddog
    are you on 24/7, travis?
    Nearly

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with my text adventure game.
    By Haggarduser in forum Game Programming
    Replies: 15
    Last Post: 10-26-2007, 01:53 AM
  2. New Project, text game, design stage.
    By Shamino in forum Game Programming
    Replies: 9
    Last Post: 05-23-2007, 06:39 AM
  3. Text adventure engine idea. thoughts?
    By suzakugaiden in forum Game Programming
    Replies: 16
    Last Post: 01-15-2006, 05:13 AM
  4. My Memory Game
    By jazy921 in forum C Programming
    Replies: 0
    Last Post: 05-05-2003, 05:13 PM
  5. My Pre-Alpha Version Rpg Text Game
    By knight543 in forum C++ Programming
    Replies: 1
    Last Post: 04-06-2002, 06:02 AM