Compiling With Code Blocks

Code::blocks is a good IDE for c++ on Linux.

1. File > Project...
2. choose Empty project and click to Go
3. choose nel as name for the project (we use it for make an user-template for NeL) and click to next
4. For options of compiler i'm let them with default... click to finish
5. Now we must setting up build options so click on the menu Project > Build options..
6. With "nel" selected at left click on "linker settings" tab
7. click to "Add" for adding libraries nelmisc, nel3d, nelligo, nellogic, nelnet, nelgeorges, nelsound, nelpacs, pthread, librd. I'm not realy sure that all nel library is necessary but we will make an user-template so..

8. Now click "release" at left and select "Compiler settings" tab (at right), click to "#defines" tab and add "NL_RELEASE" (without quotes :p ) and for "debug" add "NL_DEBUG". Validate your options.
9. Click to "New file", name it main.cpp and paste this :

 #include <nel/misc/types_nl.h>
 #include <nel/3d/u_driver.h>
 #include <nel/3d/u_text_context.h>
 using namespace std;
 using namespace NLMISC;
 using namespace NL3D;
 // The 3d driver
 UDriver        *Driver = NULL;
 // This variable is used to display text on the screen
 UTextContext   *TextContext = NULL;
 // true if you want to exit the main loop
 bool            NeedExit = false;
 int main(int argc, char **argv)
 {
     // Create a driver
     Driver = UDriver::createDriver();
     nlassert(Driver);
     // Create the window with config file values
     Driver->setDisplay (UDriver::CMode(640, 480, 32));
     // Create a Text context for later text rendering
     TextContext = Driver->createTextContext ("data/n019003l.pfb");
     nlassert(TextContext);
     while ((!NeedExit) && Driver->isActive())
     {
         // Clear all buffers
         Driver->clearBuffers (CRGBA (0, 0, 0));
         // Display a text on the screen
         TextContext->setHotSpot (UTextContext::TopLeft);
         TextContext->setColor (CRGBA(255, 255, 255, 255));
         TextContext->setFontSize (14);
         TextContext->printfAt (0.01f, 0.99f, "Hello, World!");
         // Swap 3d buffers
         Driver->swapBuffers ();
         // Pump user input messages
         Driver->EventServer.pump();
         // Manage the keyboard
         if (Driver->AsyncListener.isKeyDown (KeySHIFT)
             && Driver->AsyncListener.isKeyDown (KeyESCAPE))
         {
             // Shift Escape -> quit
             NeedExit = true;
         }
     }
 }

 

10. Save, and now on the menu select File>Save project as user-template... name it NeL and ok.
Now whene you will make an new project with NeL you could choose File > New > Project, choose user-template at left...

Don't forget to copy and paste the "n019003l.pfb" file ( yourneldirectory/snowballs2/client/data/n019003l.pfb) in yor project release or debug directory !