Okay... but my other nickname is some how CNP... Cut 'n Paste because i was to busy to answer my dad when he asked me what && is, what cpp programmer doesn't know what && is?
Okay... but my other nickname is some how CNP... Cut 'n Paste because i was to busy to answer my dad when he asked me what && is, what cpp programmer doesn't know what && is?
This war, like the next war, is a war to end war.
I kinda like the idea of writing an Engine for ungifted c++
programmers. Is there much need for a Console App Engine?
A beginning one?Originally posted by Blizzarddog
what cpp programmer doesn't know what && is?
Nah, a dos engine is fairly simple. It needs a coord system, etc. Gimme your email and i'll send you mine if you want.
I knew what it was when i first picked up a cpp book when i was 13, about 1/5 year ago. And i need it so that i can actually start a real game... I dont know any thing about the windows programming.
This war, like the next war, is a war to end war.
If your serious about game programming, you should learn opengl or directx....at first i didn't know any winapi, and it was really confusing and intimidating as to where and when to start, been i've been in opengl for a few weeks now, and i'm getting prepared to build a game engine and do my first FPS, ever. Dive in, the water will be warm soon enough!
Hey rod, your not talking about your Caverns game, are you?
the one like this:
Code:cin >> name; /* Store users name*/ cout <<"Hello "<< name <<" , do u think you can escape the caverns?\n\n"; cout <<"Your objective is to stay alive and aquire 100 points.\n\n"; cout <<"Both of these tasks are possible, and with a little "; cout <<"logic u will succeed.\n\n"; cout <<"You may see controls at any time by pressing (I)\n\n"; getch(); /* Wait for key push and continue.*/ do/* Start loop*/ { /* Check user position.*/ if (User_Location_Y == 25) { cout <<"You cannot continue in this direction\n"; User_Location_Y--; getch(); } else if (User_Location_Y == -25) { cout <<"You cannot continue in this direction\n"; User_Location_Y++; getch(); } else if (User_Location_X == 25) { cout <<"You cannot continue in this direction\n"; User_Location_X--; getch(); } else if (User_Location_X == -25) { cout <<"You cannot continue in this direction\n"; User_Location_X++; } /* This decrements by 1 every loop, when it hits 0 game ends.*/ end_game--; if (end_game == 0) { system("cls"); cout <<"You have used all your energy, GAME OVER!\n"; return 0; } /* This displays every loop.*/ system("cls"); cout <<"North (1)\nSouth (2)\nEast (3)\nWest (4)\n\n"; cin >>input; cout <<"\n"; /* Key for user initiated exit.*/ if (input == 'Q' || input == 'q') { system("cls"); return 0; }
This war, like the next war, is a war to end war.
not in my last post no. What you have there is my really, really old engine, i improved some stuff since then but caverns is an abandoned newbie project.
I'm talking bout a 3d opengl graphics engine that my FPS (and prolly a few others as i improve) will be based off.
when I start a windows project a window looks like this:
where exactly do i use textout and stuff?Code:#include <windows.h> /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char szClassName[ ] = "WindowsApp"; int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { HWND hwnd; /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof(WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor(NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use light-gray as the background of the window */ wincl.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH); /* Register the window class, if fail quit the program */ if(!RegisterClassEx(&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "Windows App", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 544, /* The programs width */ 375, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); /* Make the window visible on the screen */ ShowWindow(hwnd, nFunsterStil); /* Run the message loop. It will run until GetMessage( ) returns 0 */ while(GetMessage(&messages, NULL, 0, 0)) { /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage( ) gave */ return messages.wParam; } /* This function is called by the Windows function DispatchMessage( ) */ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) /* handle the messages */ { case WM_DESTROY: PostQuitMessage(0); /* send a WM_QUIT to the message queue */ break; default: /* for messages that we don't deal with */ return DefWindowProc(hwnd, message, wParam, lParam); } return 0; }
This war, like the next war, is a war to end war.
Run this:
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;; }
I was talking about the text game you were gonna send me in the email.
This war, like the next war, is a war to end war.
i was going to send it to trav he asked what was involved in it, but ya thats the really old version.
my dev c++ has an error in it.. it always gets a error in the resource file when i try to do a project... can i do that just by using a regular C++ file?
This war, like the next war, is a war to end war.
it should compile fine, make sure you have those three opengl libraries installed on your computer. If not you can get them at www.opengl.org
Nah, not really required, i'm going to write my own OpenGLOriginally posted by RoD
Nah, a dos engine is fairly simple. It needs a coord system, etc. Gimme your email and i'll send you mine if you want.
Engine soon and i know what's involved.