Results 1 to 10 of 19

Thread: My Immediate Mode GUI (IMGUI) class for Jarrod's HGE

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    My Immediate Mode GUI (IMGUI) class for Jarrod's HGE

    Hi all,
    I have been working on a GUI system that I can use in The Probe (or other Hadron Game Engine programs)...

    Here is a screenshot of the currently working GUI that I am using to control the audio options in The Probe



    I have been chopping out GUI elements (elements inside the window) from a controls VGScene demo I downloaded here:

    http://ksdev.com/vgscene/download.html

    I got the elements for the window itself (after some editing) from this project:

    http://www.sulaco.co.za/opengl_project_glWindows.htm

    I used my image packer program to jam all the elements together and am reading them into my GUI class.



    I have based my GUI class from a Immediate Mode GUI tutorial here (and converting it to Pascal obviously):

    http://sol.gfxile.net/imgui/index.html

    When it is finished, I will probably share the GUI code (hey, perhaps it will be included in Jarrod's HGE itself)

    Here is how the code currently looks to create the GUI you see in the above screenshot:

    Code:
    procedure TTheProbe.RenderAudioOptions;
    var
      x,y: Integer;
      GuiFont: Integer;
      ValueF: Single;
    begin
      GuiFont := FGUIFont;
    
      FGUI.Prepare;
        FGUI.SetFontColor(255,255,255,255);
        FGUI.SetBackgroundColor(64,64,64,255);
        FGUI.StartWindow(100,100,270,218,'Audio Options',App_SysFont);
          x := 8;
          y := 16;
    
          // music options
          if FGUI.DoCheckBox(FMusicEnabled,x,y,'music enabled',GuiFont) then
          begin
            if not FMusicEnabled then
            begin
              FMusicVolume := 0;
              Audio_SetMusicVol(FMusicVolume)
            end;
          end;
    
          y := 44;
          FGUI.DoLabel(x,y,'music volume',GuiFont,White);
    
          y := 72;
          ValueF := FMusicVolume;
          if FGUI.DoHorizontalTrackBar(x,
                                       y,
                                       255,
                                       0,1,
                                       ValueF) then
          begin
            if (ValueF > 0) and not FMusicEnabled then
              FMusicEnabled := True;
              
            FMusicVolume := ValueF;
            Audio_SetMusicVol(FMusicVolume);
          end;
    
          y := 124;
          // sfx options
          if FGUI.DoCheckBox(FSfxEnabled,x,y,'sfx enabled',GuiFont) then
          begin
            if not FSfxEnabled then
              FSfxVolume := 0;
          end;
    
          y := 152;
          FGUI.DoLabel(x,y,'sfx volume',GuiFont,White);
    
          y := 180;
          ValueF := FSfxVolume;
          if FGUI.DoHorizontalTrackBar(x,
                                       y,
                                       255,
                                       0,1,
                                       ValueF) then
          begin
            if (ValueF > 0) and not FSfxEnabled then
              FSfxEnabled := True;
    
            FSfxVolume := ValueF;
          end;
    
        FGUI.EndWindow;
      FGUI.Finish;
    end;
    cheers,
    Paul
    Last edited by paul_nicholls; 29-09-2010 at 09:37 AM.

  2. #2

  3. #3
    That looks pretty easy to use. Nice work.

    I probably won't use it since I'm not using HGE. Also, I'd encourage you to use VBO's instead. They are the future.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  4. #4
    Quote Originally Posted by chronozphere View Post
    That looks pretty easy to use. Nice work.

    I probably won't use it since I'm not using HGE. Also, I'd encourage you to use VBO's instead. They are the future.
    Thanks

    Well, as I'm using HGE (uses DirectX behind the scenes) for The Probe, I will be using the HGE sprites, etc. for my GUI until things change

    cheers,
    Paul

  5. #5
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    GUI system is lookin' nice Paul.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  6. #6
    Thanks WILL

    cheers,
    Paul

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •