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

Lucid.EasyToUse++

Sign in to follow this  
Rob Loach

95 views

I just reworked some of the base functions to Lucid to make it easier to use. Someone asked how to move a image around with the mouse so I took the challenge and did it up: Download "You Gotta Move It". You just move the image around by dragging the mouse, so I don't really see the point in why I uploaded it... Ah well.

The source was very easy to write up using Lucid. Took about three minutes to write and (in my opinion) is very easy to understand:

#include "lucid/base.h"  // Include Lucid

// Setup the main game state
class MainGameState : public System::State{
private:
System::Graphics::Sprite YouGottaMoveIt;
bool MovingIt;
public:
void Enter(){
YouGottaMoveIt.Load("test.bmp");
YouGottaMoveIt.TransColour(255,0,255);
}
void Draw(){
YouGottaMoveIt.Draw();
}
void Update(){
if(MovingIt){
YouGottaMoveIt.x(System::Input::MouseX());
YouGottaMoveIt.y(System::Input::MouseY());
}
}

void KeyDown(int value){
switch(value){
case SDLK_ESCAPE:
System::Going = false;
break;
}
}
void MouseButtonDown(int button){
if(button == SDL_BUTTON_LEFT){
if(System::Input::MouseInBounds(&YouGottaMoveIt)){
MovingIt = true;
}
}
}
void MouseButtonUp(int button){
if(button == SDL_BUTTON_LEFT){
MovingIt = false;
}
}
}GameState;

int main(int argc, char *argv[]){

System::Initialize(400,300,false,&GameState,60,"You Gotta Move It");
System::MainLoop();

return 0;
}


If you don't understand that source, I'll have to slap you. I don't know where I'm going with Lucid. I should be doing things with Ogre, Direct3D and OpenGL. Maybe I'll just recreate a bunch of classics and then move on. Could continue work on that asteroids clone.

Random Interest



Ummmmm..... Yeah.
Sign in to follow this  


2 Comments


Recommended Comments

Yes, you NEED to finish asteroids before you move on. Please don't develop the same pattern as we all do and stop halfway through a project to work on something better... You'll never get anything done [sad]

Share this comment


Link to comment

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