Hey!
Sorry to bother you again![]()
This time, I'm attempting to make a really small game engine. It'll be using SDL for those who really wanna look into the code...
Anyway, first, here's my code:
And here go the questions on the errors...Code:/* This is the main file to link to when developing with the Stupid Game Engine. NOTE: This 'Game Engine' is not meant for any hardcore game development. It is meant to be a simple library to link to in the event that you may want to create a *simple* game or rendering of something using the OpenGL 3d Library. Author: FlyingIsFun1217 Website: None, this is too insignificant... Date: 5-7-07 */ // First, the headers needed to use OpenGL and SDL... DUH!... #include <GL/gl.h> #include <GL/glx.h> #include "SDL.h" #include <cstdlib> // Second, the headers needed for things *besides* OpenGL... #include <X11/X.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <iostream> void fatalError(char *message) { fprint(stderr, "SGE: %s\n", message); exit(1); } const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo(); if (!videoInfo) { fatalError("Could not collect video information."); } class SGE { public: SGE(); ~SGE(); void InitializeVideo(char ScreenMode, int SreenSizeX, int ScreenSizeY, int bitsPerPixel); void UninitializeVideo(); private: char SM; int SSX; int SSY; int BPP; }; SGE::SGE() { } SGE::~SGE() { } void SGE::InitializeVideo(char ScreenMode, int ScreenSizeX, int ScreenSizeY, int bitsPerPixel) { // Collect values from user for creation of the window... SM = ScreenMode; SSX = ScreenSizeX; SSY = ScreenSizeY; BPP = bitsPerPixel; // Create a pointer that references to the backbuffer... SDL_Surface *ScreenSurface; // Initialize SDL with parameters given by user... SDL_Init (SDL_INIT_VIDEO); if (SDL_Init(SDL_INIT_VIDEO) != 0) { fatalError("Could not initialize SDL Video."); exit(1); atexit(SDL_Quit); if (SM == windowed) { ScreenSurface = SDL_SetVideoMode (SSY, SSX, BPP); } else if (SM == fullscreen) { SDL_SetVideoMode (SSX, SSY, BPP, SDL_FULLSCREEN); } } void SGE::UninitializeVideo() { SDL_Quit(); exit(0); }
1. First error: 'fprint was not declared in this scope'. WHAT?!?! Isn't including iostream all I need??? (Line 25)
2. Second error: 'expected unqualified-id before 'if'' on the if (!videoInfo). Not quite sure what that means, actually...
3. Third error: 'windowed' and 'fullscreen' are undeclared. I understand this one, and have even found that you can use getchar() to return the value, but how would I put it in the if, else if statements like I had set up?
4. Line 81, the '}' after the if statement with windowed, all it says is 'error: at this point in file'
5. Line 92, exit(0) at end in UninitializeVideo function, it tells that 'a function-definition is not allowed here before '{' token. Huh?
6. Line 94, it says that it 'expected: '}' at end of input'. Didn't I put one in? I see one!
Sorry if you think that I am ranting, raving, trying to cheat by getting others' help, whatever. I just want to see how I would theoretically make an extremely simple game engine, and will be my basis for learning SDL, a little OpenGL, different functions like occlusion culling, etc.
Thanks for all of your help!
FlyingIsFun1217



LinkBack URL
About LinkBacks









Thanks