Advertisement Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Entries in this blog


basic GUI design

I lacked time this week, but I managed somehow to design a simple GUI system :typedef void(*guiFunction)(void);typedef void(*guiFunctionKeycode)(char);typedef void(*guiFunctionObject)(guiObject&);class guiObject{public: guiObject(); virtual ~guiObject(); bool initialize(Game& g); void event(const sf::Event& ev); virtual void draw(sf::RenderWindow& dest) = 0; virtual void update(double dt) = 0; static void default_function(); static void default_functionKeycode(char code); static void default_functionObject(guiObject& obj); guiFunction onMouseOver = default_function; guiFunction onMouseNotOver = default_function; guiFunction onLeftClick = default_function; guiFunction onLeftHold = default_function; guiFunction onLeftRelease = default_function; guiFunction onRightClick = default_function; guiFunction onRightHold = default_function; guiFunction onRightRelease = default_function; guiFunctionKeycode onKeyPressed = default_functionKeycode; guiFunctionKeycode onKeyReleased = default_functionKeycode; guiFunctionObject onDrag = default_functionObject; // visibility bool isVisible(); void show(); void hide(); // focus bool getFocus(); void setFocus(bool f); // selection bool isSelected(); void select(); void unselect(); // position (origin is the center of the screen) void setPosition(const sf::Vector2f& p); void setPosition(float x, float y); sf::Vector2f getPosition(); // bounds void setLimits(sf::FloatRect& box); sf::FloatRect& getLimits(); // size void setSize(sf::Vector2f& sz); void setSize(float w, float h); sf::Vector2f& getSize(); // manual resize void setResizeable(bool enabled); bool isResizeable(); // drag n'drop void setDragable(bool enabled); bool isDragable(); void setDragArea(sf::FloatRect& d); sf::FloatRect& getDragArea();};class GUI{private: Game *_game; bool _mouseShown = true; std::vector _object;public: GUI(); ~GUI(); bool initialize(Game& g); std::vector& getObject(); void push(guiObject *obj); void pop(); void showMouse(); void hideMouse(); void event(const sf::Event& ev); void draw(sf::RenderWindow& dest); void update(double dt);};
Now that it works, I can focus on the tilemap generator.




Let's start !

Hello everyone,

As I haven't coded for quite a long time, I'm starting a simple project.
It will be a 2d turn based horror/hunting game, with an "Aliens"-like ambiance, with some roguelike-ish elements.

I'll be using Code::Blocks for the C++ coding, for the graphics, and Audacity for the sounds & music.

Though I'm using Windows, I'll try to make it portable to Linux and MacOS.
And I'd go for SFML this time. It seems bug free enough, and there's a project to port it to iOS and Android, which could become useful later.

I will try to update this journal once a week, and I'd do my best to keep things simple.



Sign in to follow this  
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!