I need help to create a GUI game
  • catafestcatafest May 2011
    Hi .
    I use C::B and a want make a GUI for my game.
    I need to understand how working under HGE using the hgeGUIObject.
    The menu should not use text, only images. I went from saying the only position (x,y), sound and title, and will add and sprite for each button in the future.
    I make under project the meniu.h and meniu.cpp.
    Now under meniu.h i have this :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    #ifndef MENIU_H_INCLUDED
    #define MENIU_H_INCLUDED
    #pragma once
    #include "hge.h"
    #include "hgegui.h"
    hgeGUI *gui;
     
    enum game_meniu_state { MN_START,MN_OPT,MN_EXIT};
    class meniu : public hgeGUIObject {
    public:
    meniu(int id,HEFFECT snd,float x, float y, char *title);
    virtual void Render();
    virtual void Update(float dt);
     
    virtual void Enter();
    virtual void Leave();
    virtual bool IsDone();
    virtual void Focus(bool bFocused);
    virtual void MouseOver(bool bOver);
     
    virtual bool MouseLButton(bool bDown);
    virtual bool KeyClick(int key, int chr);
     
    bool meniu_ok() { return meniu_press; };
    private:
    game_meniu_state meniu_state;
    bool meniu_press;
    HEFFECT snd;
    float delay;
    char *title;
    HGE* hge;
    };
    #endif // MENIU_H_INCLUDED

    Under meniu.cpp i have this :
    1
    2
    3
    4
    5
    6
    7
    8
    #include ".\meniu.h"
    meniu::meniu(int _id, HEFFECT _snd, float _x, float _y, char *_title)
    {
    id=_id;
    snd=_snd;
    title=_title;
     
    }

    Now when i compile the project i has this :
    1
    2
    3
    4
    D:\working\test001hge-cb\meniu.cpp|2|error: prototype for 'meniu::meniu(int, HEFFECT, float, float, char*)' does not match any in class 'meniu'|
    D:\working\test001hge-cb\.\meniu.h|10|error: candidates are: meniu::meniu(const meniu&)|
    D:\working\test001hge-cb\.\meniu.h|12|error: meniu::meniu(int, HEFFECT, float, float, float, char*)|
    ||=== Build finished: 3 errors, 0 warnings ===|

    I know I am not very good at programming in C + +, I still want to learn using HGE. Can someone help?
    Regards.
  • catafestcatafest June 2011
    ...maybe my example is not good ...
    I need to make a gui with buttons , but using sprite.
    On official site is a gui example with fonts ....

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

In this Discussion

Who's Online (2)