Sign in to follow this  
  • entries
    108
  • comments
    319
  • views
    137695

Lucid.Menu++

Sign in to follow this  
Rob Loach

94 views

Have a simple menu system along with a progress bar now....

Note that this is only a demonstration of the simple main menu. It's quite easy to understand as well from the end-programmer side:

// Main.cpp

#include "lucid/base.h"

// The label at the bottom
class CLabelTest : public System::GUI::Label {

void Initialize(){
Text("This is a label.");
SetPosition(0, 0, System::Width, System::Height);
VerticalAlignment(2); // Bottom
HorizontalAlignment(1); // Middle
}

}LabelTest;

// The main menu
class CMenuTest : public System::GUI::Menu {

void Initialize(){
// Add some items to it
AddItem("New Game");
AddItem("Load Game");
AddItem("Highscores");
AddItem("Exit");

// Change look
Items.BackColour(0,150,0,255);
Items.HoverColour(0,200,0,255);

// Location
Width(150);
Height(50);
x(System::Width/2 - Width()/2);
y(20);
}

// When an item was selected
void Select(std::string item){
LabelTest.Text(item); // Change the label text
}

}MenuTest;

// The main game state
class CGameState : public System::State {

void Initialize(){

// Load a font
System::Text::LoadFont("goth","data/bgothl.ttf",16);

// Add the GUI objects
AddGUIObject(&LabelTest);
AddGUIObject(&MenuTest);

}

}GameState;


int main(int argc, char *argv[]){
// Initialize
System::Initialize(400,300,false,&GameState,60,"You Gotta Move It","icon.png");

// Enter the main game loop
System::MainLoop();

return 0;
}





If you don't understand the source, please tell me. I'm trying to make this engine as easy as possible for 2D game creation. It looks pretty good so far.

Once I complete all the required file stuff (highscores, etc), I'll move onto working on the Asteroids clone again. With these new "features" to Lucid, it'll make it so much easier.

In other news, I'm missing the GDC.

Random Interest

Strange Brew
Sign in to follow this  


3 Comments


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now