Why build from the source anyway?

Well, this is a good question. LOGL::GLib might not have exactly what you want,
but it might be a good base for you to branch off of. Since this is quite plausible,
it's really very nice to be able to change the source behind the library to suit the
game that you're creating.

How can I do it?

First, you'll need a copy of the source. The link to the latest source files is here:
http://loglglib.codeplex.com/SourceControl/list/changesets
Coincidentally, it's the same as the "Source Code" tab above this page.

Once you've the source extracted onto your computer, you'll need to open up
a project. If you're on a UNIX based system, this process will be different,
since you probably don't have Microsoft's Visual Studio installed. Just load up
all of the source/header files into the IDE of your choice and link to:

libGLEW.so, libGLU.so, and libGL.so

Note: If you're using Code::Blocks, you can skip this part by creating an SDL
project from the project menu. The only thing you'll need to do then is add the
source.

Moving back to Windows, once a project is open (either Win32 or console),
you'll need to link to a few libraries.
openGL32.lib, glu32.lib, SDL.lib, and glew32.lib

Note: This assumes you have both GLEW and SDL installed.

It's generally a good rule to just build from the game template:

#ifdef __APPLE__
    #include <glew.h>
#else
    #include <GL/glew.h>
#endif

#include "Game.h" /* Make sure that your project knows where Game.h is in the source. */

using namespace LOGL_GLib;
using namespace LOGL_GLib::Common;
using namespace LOGL_GLib::Input;
using namespace LOGL_GLib::Content;
using namespace LOGL_GLib::Math;
using namespace LOGL_GLib::Utilities;

class TestGame : public Game
{
public:
	TestGame();

	virtual GLvoid Initialize();
	virtual GLvoid LoadContent();
	virtual GLvoid Update();
	virtual GLvoid Draw();
	virtual GLvoid UnloadContent();
};

TestGame::TestGame()
{
}

GLvoid TestGame::Initialize()
{
	Game::Initialize();

       /* Initialization code here... */
}

GLvoid TestGame::LoadContent()
{
       /* Load any content for your game here... */

       Game::LoadContent();
}

GLvoid TestGame::Update()
{
	/* Check if we need to exit. */
	if(Keyboard::IsKeyDown(Key_Escape))
		Exit();

        /* Update logic goes here... */

	Game::Update();
}

GLvoid TestGame::Draw()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();

        /* Draw code goes here... */

	Game::Draw();
}

GLvoid TestGame::UnloadContent()
{
        /* Free up any indebted resources here... */

        Game::UnloadContent();
}

GLint main()
{
	TestGame myGame;
	myGame.Run();

        return myGame.ExitCode;
}

Last edited Mar 5, 2011 at 7:18 AM by LorgonJortle, version 3

Comments

No comments yet.