Results 1 to 10 of 159

Thread: The Probe

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #33
    Hey all,
    I now have most of my old shiny slick Immediate Mode GUI stuff ported over to my new cross-platform engine, and is now part of the engine itself, so I can do suff like so:


    initialization
    Code:
    procedure TTheProbe.OnCreateResources(var aExecuting: boolean);
    var
      x,y : word;
      sr  : TSoundRequest;
      i   : Integer;
      Resource    : TMemoryStream;
      ResourceName: AnsiString;
    begin
    ...
      if GetResourceByName('systemgui',ResourceName,Resource) then begin xeEngine.GUI.LoadGUIFromStream(Resource,xeColorKey,True); Resource.Free; end;
    ...
      xeEngine.GUI.ResetLastWidget;
    ...
    end;
    updating
    Code:
    procedure TTheProbe.OnUpdateFrame(aTimeSlice: single; var aExecuting: boolean);
    var
      t: Single;
    begin
      inherited;
    
    
    ...
      xeEngine.GUI.Update(aTimeSlice);
    ...
    end;
    Rendering
    Code:
    var
      RadioButtons: array[1..2] of Boolean = (True,False);
      ActiveRadio : Integer = 1;
      ShowGUI     : Boolean = True;
      avalue      : Single = 50;
    
    
    procedure TTheProbe.RenderTestGUI;
    var
      i: Integer;
      y: Single;
      h: Single;
    begin
      h := FFont.MaxHeight(1) + 4;
      xeEngine.GUI.Prepare;
      try
        xeEngine.GUI.SetFontColor(xeEngine.MakeColor(255,255,255,255));
        xeEngine.GUI.SetBackgroundColor(xeEngine.MakeColor(64,64,64,255));
        xeEngine.GUI.StartWindow(100,100,285,150,'Video Options',FFont,True);
    
    
         y := 8;
    
    
         for i := 1 to High(RadioButtons) do
         begin
          if xeEngine.GUI.DoRadioButton(ActiveRadio = i,8,y,Format('radio button#%d',[i]),FFont) then
          begin
            ActiveRadio := i;
          end;
          y := y + h;
         end;
    
    
        if xeEngine.GUI.DoButton(8,60,75,30,'ok',FFont) then
        begin
          ShowGUI := False;
        end;
        y := y + 35;
    
    
        xeEngine.GUI.DoLabel(8,y,'some trackbar',FFont,xeYellow,True);
        y := y + h;
    
    
        xeEngine.GUI.DoHorizontalTrackBar(8,y,100,0,100,avalue);
    
    
        xeEngine.GUI.EndWindow;
      finally
        xeEngine.GUI.Finish;
      end;
    end;
    which does this


    And it just works

    cheers,
    Paul
    Last edited by paul_nicholls; 09-10-2011 at 09:28 PM.

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
  •