paul_nicholls
29-09-2010, 06:30 AM
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 :)
http://img405.imageshack.us/img405/8278/screenshotalx.th.png (http://img405.imageshack.us/i/screenshotalx.png/)
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.
http://img20.imageshack.us/img20/4664/guipacked.png (http://img20.imageshack.us/i/guipacked.png/)
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:
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
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 :)
http://img405.imageshack.us/img405/8278/screenshotalx.th.png (http://img405.imageshack.us/i/screenshotalx.png/)
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.
http://img20.imageshack.us/img20/4664/guipacked.png (http://img20.imageshack.us/i/guipacked.png/)
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:
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