3D Irrlicht GUI Translator (VisualDesigner 2 Irrlicht Gui)

Fragen zu Grafik- & Soundproblemen und zur Spieleprogrammierung haben hier ihren Platz.
Benutzeravatar
Max_der_Held
Beiträge: 595
Registriert: 18.04.2006 17:01
Wohnort: Bavaria
Kontaktdaten:

3D Irrlicht GUI Translator (VisualDesigner 2 Irrlicht Gui)

Beitrag von Max_der_Held »

Hallo Leute,

ich stelle hier nur kurz ein Programm vor, dass die mit dem Visual Designer von Purebasic erstellten Fenster, buttons etc. in Irrlicht -Gui umwandelt.

man kann den herausgegebenen Code dann in sein irrlicht-programm einfügen und hat ein einfach erstelltes gui.

UPDATE 08.08.2010 : jetzt werden Proceduren unterstützt (open_window_0() etc.)
und der Code ist viel sauberer.
Ich hoffe einfach es nutzt noch jemand auch die irrlicht engine ^^ .

-lg
max.
Bild

Zum Starten des Beispiels wird der 1.05-Irrlicht-Thalius&Neotoma-wrapper benötigt

bei der Next-engine muss wohl bisschen umgecoodet werden. wer will ist frei das zu tun.

CODE:

Code: Alles auswählen


; PureBasic Visual Designer v3.95 build 1485 (PB4Code)

Structure gadget
   x.f
   y.f
   x2.f
   y2.f
   name.s ; die Konstante z.b. # button_addmoreSauerstoff (ohne das kreuz)
   art.i  ; z.b. #edit_gadget_art_button
   text.s ; der text, der angezeigt wird.
   min.i  ; für scrollbars: minimum, maximum, seitenlänge..
   max.i 
   pagelengh.i
   Tilewidth.i ; für Listicongadget: Kastenbreite
   Parent.s    ; für Gadgets: Ihr fenster
EndStructure 

;- Window Constants
;
Enumeration
  #Window_0
EndEnumeration

;- Gadget Constants
;
#windows_titelleiste = 20
Enumeration
  #Editor_Input
  #Editor_Output
  #Button_Translate
  #Button_Quit
  #Button_preview
EndEnumeration

Enumeration 
   #edit_gadget_art_button
   #edit_gadget_art_scrollbar
   #edit_gadget_art_text
   #edit_gadget_art_listview
   #edit_gadget_art_image
   #edit_gadget_art_window
   #edit_gadget_art_combobox
   #edit_gadget_art_checkbox
   #edit_gadget_art_editbox
   #edit_gadget_art_menu
   #edit_gadget_art_textline ; eine in den code einzufügende textzeile, z.b. "procedure open_window_1()"
EndEnumeration



Global NewList gadget. gadget()
Global NewList main_global.s() ; eine "global" - Zeile.


Procedure.s translate (text.s)
   Protected anzahl_returns , procedurecount , line.s , Gadgetart.s , Anzahl_windows ,  output.s , id.i = 0
   
   anzahl_returns = CountString ( text , Chr(10 ))
   
   For x = 1 To anzahl_returns +1
      
      line.s = ReplaceString ( RemoveString( RemoveString ( RemoveString ( StringField ( text , x , Chr(10)) , " " ) , "if" , #PB_String_NoCase ) , Chr(34) ) , ")" , "," ) ; replacestring, because then the stringfield runs correctly.
      
      ; schaun, ob neue Procedure losgeht.
      If FindString ( LCase(line) , "endprocedure" , 1)
         AddElement( gadget() )  ; die "open_window_.." procedure beibehalten.
            gadget()\name = "   EndProcedure" + Chr(10)
            gadget()\art  = #edit_gadget_art_textline 
            
         procedurecount - 1
         Continue 
      ElseIf FindString ( LCase (line ) , "procedure" , 1 )
         AddElement( gadget() )
            Debug line 
            gadget()\name = "   Procedure " + Right( line , Len(line)-9)
            gadget()\name = Left(gadget()\name , Len( gadget()\name ) -2 ) + ")" ; das letzte komma mit klammerzu ersetzen
            gadget()\art  = #edit_gadget_art_textline
            
         procedurecount + 1
         Continue 
      EndIf 
      
      Gadgetart.s = LCase (StringField ( line , 1 , "(" )) ; z.b. EditorGadget
      
      Select Gadgetart 
      
         Case "openwindow" ; neues window auf dem die gadgets gezeichnet werden müssen.
         
            AddElement (gadget())
               gadget ()\name   = Mid( line , FindString ( line , "#" , 1 ) +1 , FindString ( line , "," , 1 ) - FindString ( line , "#" , 1 ) -1 )
               gadget ()\x      = Val( StringField ( line , 2 , ",") )
               gadget ()\y      = Val( StringField ( line , 3 , ",") ) 
               gadget ()\x2     = Val( StringField ( line , 4 , ",") ) + gadget()\x
               gadget ()\y2     = Val( StringField ( line , 5 , ",") ) + gadget()\y +#windows_titelleiste 
               gadget ()\text   = StringField ( line , 6 , ",")
               gadget ()\art    = #edit_gadget_art_window 
            
            CurrentWindow.s     = "*" + gadget()\name 
            
         Case "buttongadget"
            
            AddElement (gadget ())
               gadget ()\name   = Mid( line , FindString ( line , "#" , 1 ) +1 , FindString ( line , "," , 1 ) - FindString ( line , "#" , 1 ) -1 )
               gadget ()\x      = Val( StringField ( line , 2 , ",") )
               gadget ()\y      = Val( StringField ( line , 3 , ",") )+#windows_titelleiste 
               gadget ()\x2     = Val( StringField ( line , 4 , ",") ) + gadget()\x
               gadget ()\y2     = Val( StringField ( line , 5 , ",") ) + gadget()\y 
               gadget ()\text   = StringField ( line , 6 , ",")
               gadget ()\art    = #edit_gadget_art_button
               gadget ()\Parent = CurrentWindow 
            
         Case "stringgadget"
            
            AddElement (gadget ())
               gadget ()\name   = Mid( line , FindString ( line , "#" , 1 ) +1 , FindString ( line , "," , 1 ) - FindString ( line , "#" , 1 ) -1 )
               gadget ()\x      = Val( StringField ( line , 2 , ",") )
               gadget ()\y      = Val( StringField ( line , 3 , ",") )+#windows_titelleiste 
               gadget ()\x2     = Val( StringField ( line , 4 , ",") ) + gadget()\x
               gadget ()\y2     = Val( StringField ( line , 5 , ",") ) + gadget()\y 
               gadget ()\text   = StringField ( line , 6 , ",")
               gadget ()\art    = #edit_gadget_art_editbox
               gadget ()\Parent = CurrentWindow 
               
         Case "textgadget"
            
            AddElement (gadget ())
               gadget ()\name   = Mid( line , FindString ( line , "#" , 1 ) +1 , FindString ( line , "," , 1 ) - FindString ( line , "#" , 1 ) -1 )
               gadget ()\x      = Val( StringField ( line , 2 , ",") )
               gadget ()\y      = Val( StringField ( line , 3 , ",") )+#windows_titelleiste 
               gadget ()\x2     = Val( StringField ( line , 4 , ",") ) + gadget()\x
               gadget ()\y2     = Val( StringField ( line , 5 , ",") ) + gadget()\y 
               gadget ()\text   = StringField ( line , 6 , ",")
               gadget ()\art    = #edit_gadget_art_text
               gadget ()\Parent = CurrentWindow 
               
         Case "checkboxgadget"
            
            AddElement (gadget ())
               gadget ()\name   = Mid( line , FindString ( line , "#" , 1 ) +1 , FindString ( line , "," , 1 ) - FindString ( line , "#" , 1 ) -1 )
               gadget ()\x      = Val( StringField ( line , 2 , ",") )
               gadget ()\y      = Val( StringField ( line , 3 , ",") )+#windows_titelleiste 
               gadget ()\x2     = Val( StringField ( line , 4 , ",") ) + gadget()\x
               gadget ()\y2     = Val( StringField ( line , 5 , ",") ) + gadget()\y 
               gadget ()\text   = StringField ( line , 6 , ",")
               gadget ()\art    = #edit_gadget_art_checkbox
               gadget ()\Parent = CurrentWindow 
               
         Case "comboboxgadget"
            
            AddElement (gadget ())
               gadget ()\name   = Mid( line , FindString ( line , "#" , 1 ) +1 , FindString ( line , "," , 1 ) - FindString ( line , "#" , 1 ) -1 )
               gadget ()\x      = Val( StringField ( line , 2 , ",") )
               gadget ()\y      = Val( StringField ( line , 3 , ",") )+#windows_titelleiste 
               gadget ()\x2     = Val( StringField ( line , 4 , ",") ) + gadget()\x
               gadget ()\y2     = Val( StringField ( line , 5 , ",") ) + gadget()\y 
               gadget ()\art    = #edit_gadget_art_combobox
               gadget ()\Parent = CurrentWindow 
               
         Case "listviewgadget"
            
            AddElement (gadget ())
               gadget ()\name   = Mid( line , FindString ( line , "#" , 1 ) +1 , FindString ( line , "," , 1 ) - FindString ( line , "#" , 1 ) -1 )
               gadget ()\x      = Val( StringField ( line , 2 , ",") )
               gadget ()\y      = Val( StringField ( line , 3 , ",") )+#windows_titelleiste 
               gadget ()\x2     = Val( StringField ( line , 4 , ",") ) + gadget()\x
               gadget ()\y2     = Val( StringField ( line , 5 , ",") ) + gadget()\y 
               gadget ()\art    = #edit_gadget_art_listview
               gadget ()\Parent = CurrentWindow 
               
         Case "scrollbargadget"
            
            AddElement (gadget    ())
               gadget ()\name      = Mid( line , FindString ( line , "#" , 1 ) +1 , FindString ( line , "," , 1 ) - FindString ( line , "#" , 1 ) -1 )
               gadget ()\x         = Val( StringField ( line , 2 , ",") )
               gadget ()\y         = Val( StringField ( line , 3 , ",") )+#windows_titelleiste 
               gadget ()\x2        = Val( StringField ( line , 4 , ",") ) + gadget()\x
               gadget ()\y2        = Val( StringField ( line , 5 , ",") ) + gadget()\y 
               gadget ()\max       = Val( StringField ( line , 6 , ",") )
               gadget ()\min       = Val( StringField ( line , 7 , ",") )
               gadget ()\pagelengh = Val( StringField ( line , 8 , ",") )
               gadget ()\art       = #edit_gadget_art_scrollbar
               gadget ()\Parent    = CurrentWindow 
               
         Case "editorgadget"
            
            AddElement (gadget ())
               gadget ()\name   = Mid( line , FindString ( line , "#" , 1 ) +1 , FindString ( line , "," , 1 ) - FindString ( line , "#" , 1 ) -1 )
               gadget ()\x      = Val( StringField ( line , 2 , ",") )
               gadget ()\y      = Val( StringField ( line , 3 , ",") )+#windows_titelleiste 
               gadget ()\x2     = Val( StringField ( line , 4 , ",") ) + gadget()\x
               gadget ()\y2     = Val( StringField ( line , 5 , ",") ) + gadget()\y 
               gadget ()\art    = #edit_gadget_art_editbox
               gadget ()\Parent = CurrentWindow 
               
               
         Case "imagegadget"
         
            AddElement (gadget ())
               gadget ()\name   = Mid( line , FindString ( line , "#" , 1 ) +1 , FindString ( line , "," , 1 ) - FindString ( line , "#" , 1 ) -1 )
               gadget ()\x      = Val( StringField ( line , 2 , ",") )
               gadget ()\y      = Val( StringField ( line , 3 , ",") )+#windows_titelleiste 
               gadget ()\x2     = Val( StringField ( line , 4 , ",") ) + gadget()\x
               gadget ()\y2     = Val( StringField ( line , 5 , ",") ) + gadget()\y 
               gadget ()\art    = #edit_gadget_art_button
               gadget ()\Parent = CurrentWindow 
               
         Case "buttonimagegadget"
         
            AddElement (gadget ())
               gadget ()\name   = Mid( line , FindString ( line , "#" , 1 ) +1 , FindString ( line , "," , 1 ) - FindString ( line , "#" , 1 ) -1 )
               gadget ()\x      = Val( StringField ( line , 2 , ",") )
               gadget ()\y      = Val( StringField ( line , 3 , ",") )+#windows_titelleiste 
               gadget ()\x2     = Val( StringField ( line , 4 , ",") ) + gadget()\x
               gadget ()\y2     = Val( StringField ( line , 5 , ",") ) + gadget()\y 
               gadget ()\art    = #edit_gadget_art_button
               gadget ()\Parent = CurrentWindow 
               
      EndSelect 
      
   Next 

   ; output schreiben.
   
   ; erst die globals:
   
   output+ Chr(10)
   output + " ; ---------------------------------------------------------------------------------------------" +Chr(10)
   output + " ; --- Globals"+Chr(10)
   output + " ; ---------------------------------------------------------------------------------------------"+Chr(10)+Chr(10)
   
   ForEach gadget()
      If Not gadget()\art = #edit_gadget_art_textline
          AddElement(main_global())
             output + "  Global *" + gadget()\name  + Chr(10)
      EndIf 
   Next 
   output + Chr(10)
   output + " ; ---------------------------------------------------------------------------------------------"+Chr(10)
   output + " ; --- Commands"+Chr(10)
   output + " ; ---------------------------------------------------------------------------------------------"+Chr(10) +Chr(10)
   
   ; dann die Befehle.
   
   ResetList ( gadget())
   
      While NextElement (gadget())
         
         id     + 1
         output + Chr(10)
         
         Select gadget()\art 
            
            Case #edit_gadget_art_button
               
               output + "      *" +  gadget()\name + " = IrrGuiAddButton( " + Chr(34) + gadget()\text +Chr(34) + " , " +  Str( gadget()\x) + " , " + Str( gadget()\y ) + " , " + Str( gadget()\x2 ) + " , " + Str( gadget()\y2) + " , " + gadget()\Parent + " , " + Str(id)  + " ) "
            
            Case #edit_gadget_art_scrollbar
               
               If gadget()\x2 - gadget()\x > gadget()\y2 - gadget()\y
                  horizontal = 1
               EndIf 
               
               output + "      *" +  gadget()\name + " = IrrGuiAddscrollbar( " + Str(horizontal) +" , " +  Str( gadget()\x) + " , " + Str( gadget()\y ) + " , " + Str( gadget()\x2 ) + " , " + Str( gadget()\y2) + " , " + gadget()\Parent + " , " + Str(id) + " ) "
               
            Case #edit_gadget_art_text
            
               output + "      *" +  gadget()\name + " = IrrGuiAddStaticText( " + Chr(34) + gadget()\text +Chr(34) + " , " +  Str( gadget()\x) + " , " + Str( gadget()\y ) + " , " + Str( gadget()\x2 ) + " , " + Str( gadget()\y2) + " , 1 , 1 , 1 , " + gadget()\Parent + " , " + Str(id) + " ) "
               
            Case #edit_gadget_art_image

               output + "      *" +  gadget()\name + " = IrrGuiAddImage( " +  Str( gadget()\x) + " , " + Str( gadget()\y ) + " , " + Str( gadget()\x2 ) + " , " + Str( gadget()\y2) + " , " + gadget()\Parent + " , " + Str(id) + " ) "
               
            Case #edit_gadget_art_window
               
               If gadget()\Parent = "" : gadget()\Parent = "0" : EndIf 
               output + "      *" +  gadget()\name + " = IrrGuiAddwindow( " +  Str( gadget()\x) + " , " + Str( gadget()\y ) + " , " + Str( gadget()\x2 ) + " , " + Str( gadget()\y2) + " , " + Chr(34) + gadget()\text + Chr(34) + " , 0 , " + gadget()\Parent + " , " + Str(id) + " ) "
               
            Case #edit_gadget_art_combobox
            
               output + "      *" +  gadget()\name + " = IrrGuiAddComboBox( " +  Str( gadget()\x) + " , " + Str( gadget()\y ) + " , " + Str( gadget()\x2 ) + " , " + Str( gadget()\y2) + " , " + gadget()\Parent + " , " + Str(id) + " ) "
               
            Case #edit_gadget_art_checkbox
               
               output + "      *" +  gadget()\name + " = IrrGuiAddCheckBox( 0 , " +  Str( gadget()\x) + " , " + Str( gadget()\y ) + " , " + Str( gadget()\x2 ) + " , " + Str( gadget()\y2) + " , " + Chr(34) + gadget()\text + Chr(34) +" , "  + gadget()\Parent + " , " + Str(id) + " ) "
               
            Case #edit_gadget_art_editbox
               
               output + "      *" +  gadget()\name + " = IrrGuiAddEditBox( "  +Chr(34) +  gadget()\text + Chr(34) + " , " +  Str( gadget()\x) + " , " + Str( gadget()\y ) + " , " + Str( gadget()\x2 ) + " , " + Str( gadget()\y2) + " , 1 , "  + gadget()\Parent + " , " + Str(id) + " ) "
               
            Case #edit_gadget_art_menu
            
               output + "      *" +  gadget()\name + " = irrguiaddmenu( "  + gadget()\Parent + " , " + Str(id) + " ) "
            
            Case #edit_gadget_art_textline
               
               output + gadget()\name
               
         EndSelect 
         
         
      Wend 
      
      ProcedureReturn output 
      
EndProcedure 


Procedure Open_Window_translator()

  If OpenWindow(#Window_0, 452, 205, 600, 521, "PB2Irrlicht translator",  #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
    If CreateGadgetList(WindowID(#Window_0))
      EditorGadget(#Editor_Input, 0, 5, 595, 210)
      SetGadgetText ( #Editor_Input , "Hier kommt der Visual-Designer-Code rein, also einfach irgendein pb-gadgets-code.")
      EditorGadget(#Editor_Output, 0, 215, 595, 230)
      SetGadgetText ( #Editor_Output , "Hier kommt dann der erstellte Code raus, nachdem >>Translate<< gedrückt wurde.")
      ButtonGadget(#Button_Translate, 5, 455, 165, 40, "Translate")
      ; ButtonGadget(#Button_preview, 175, 455, 95, 40, "Preview")
      ButtonGadget(#Button_Quit, 515, 455, 75, 40, "Quit")
      
      Repeat 
         
         evt = WaitWindowEvent()
         
         Select evt
         
            Case #PB_Event_Gadget
               
               Select EventGadget ()
                  
                  Case #Button_Translate
                     
                     SetGadgetText ( #Editor_Output , translate (GetGadgetText ( #Editor_Input)))
                     
                  Case #Button_Quit ;ende
                  
                     End 
               
               EndSelect 
            
            Case #PB_Event_Menu 
            
            Case #PB_Event_CloseWindow 
               
               End 
               
        EndSelect 
     
       ForEver 
    EndIf
  EndIf
EndProcedure

Open_Window_translator()





--

hier noch'n beispiel, dass jeder sieht, es geht:

Code: Alles auswählen

XIncludeFile #PB_Compiler_Home + "includes\irrlichtWrapper_include.pbi"


ScreenWidth.l = 1240
ScreenHeight.l = 1024

If IrrStartEx(#IRR_EDT_DIRECT3D9 , ScreenWidth , ScreenHeight , 0, 1,0,32,1,0,1,0)
  ; Set the title of the display
  IrrSetWindowCaption( "Example 26: Using the Irrlicht-GUI" )
  
  ; add a static text object to the graphical user interface, at the moment
  ; this is the only interface object we support. The text will be drawn inside
  ; the defined rectangle, the box will not have a border and the text will not
  ; be wrapped around if it runs off the end

 
  *Window_0 = 0;IrrGuiAddWindow( 397 , 271 , 1421 , 1059 , "Newwindow(0" , 0 , 0 , 1 ) 
  *Button_0 = IrrGuiAddButton( "Outliner" , 5 , 30 , 75 , 60 , *Window_0 , 2 ) 
  *Button_1 = IrrGuiAddButton( "Newthings" , 80 , 30 , 150 , 60 , *Window_0 , 3 ) 
  *Button_2 = IrrGuiAddButton( "Eigenschaften" , 230 , 30 , 300 , 60 , *Window_0 , 4 ) 
  *Button_4 = IrrGuiAddButton( "kombis" , 155 , 30 , 225 , 60 , *Window_0 , 5 ) 
  *Button_5 = IrrGuiAddButton( "Outliner" , 305 , 30 , 375 , 60 , *Window_0 , 6 ) 
  *Button_7 = IrrGuiAddButton( "Textures" , 455 , 30 , 525 , 60 , *Window_0 , 7 ) 
  *Button_9 = IrrGuiAddButton( "Layer" , 380 , 30 , 450 , 60 , *Window_0 , 8 ) 
  *Window_Eigenschaften = IrrGuiAddWindow( 270 , 252 , 459 , 551 , "Éigenschaften" , 0 , 0 , 9 ) 
  *Image_Texture1 = IrrGuiAddButton( "" , 5 , 25 , 60 , 80 , *Window_Eigenschaften , 10 ) 
  *Image_Texture2 = IrrGuiAddButton( "" , 65 , 25 , 120 , 80 , *Window_Eigenschaften , 11 ) 
  *Combo_materialtype = IrrGuiAddComboBox( 0 , 80 , 190 , 100 , *Window_Eigenschaften , 12 ) 
  *Combo_col_art = IrrGuiAddComboBox( 0 , 100 , 190 , 120 , *Window_Eigenschaften , 13 ) 
  *Combo_col_type = IrrGuiAddComboBox( 0 , 120 , 190 , 140 , *Window_Eigenschaften , 14 ) 
  *Text_eigenschaften_pos = IrrGuiAddStaticText( "XYZ:" , 5 , 145 , 40 , 165 , 1 , 1 , 1 , *Window_Eigenschaften , 15 ) 
  *String_eigenschaften_pos = IrrGuiAddEditBox( "" , 40 , 145 , 185 , 165 , 1 , *Window_Eigenschaften , 16 ) 
  *Text_eigenschaften_rot = IrrGuiAddStaticText( "Scale:" , 5 , 185 , 40 , 205 , 1 , 1 , 1 , *Window_Eigenschaften , 17 ) 
  *String_eigenschaften_rot = IrrGuiAddEditBox( "" , 40 , 165 , 185 , 185 , 1 , *Window_Eigenschaften , 18 ) 
  *Text_3 = IrrGuiAddStaticText( "Rot:" , 5 , 165 , 40 , 185 , 1 , 1 , 1 , *Window_Eigenschaften , 19 ) 
  *String_eigenschaften_scale = IrrGuiAddEditBox( "" , 40 , 185 , 185 , 205 , 1 , *Window_Eigenschaften , 20 ) 
  *Text_5 = IrrGuiAddStaticText( "Name:" , 5 , 205 , 40 , 225 , 1 , 1 , 1 , *Window_Eigenschaften , 21 ) 
  *String_eigenschaften_name = IrrGuiAddEditBox( "" , 40 , 205 , 185 , 225 , 1 , *Window_Eigenschaften , 22 ) 
  *Text_7 = IrrGuiAddStaticText( "Animlist" , 5 , 225 , 40 , 245 , 1 , 1 , 1 , *Window_Eigenschaften , 23 ) 
  *String_eigenschaften_animlist = IrrGuiAddEditBox( "" , 40 , 225 , 185 , 245 , 1 , *Window_Eigenschaften , 24 ) 
  *Text_9 = IrrGuiAddStaticText( "startanim" , 5 , 245 , 40 , 265 , 1 , 1 , 1 , *Window_Eigenschaften , 25 ) 
  *Combo_eigenschaften_startanim = IrrGuiAddComboBox( 40 , 245 , 185 , 265 , *Window_Eigenschaften , 26 ) 
  *Image_Texture3 = IrrGuiAddButton( "" , 125 , 25 , 180 , 80 , *Window_Eigenschaften , 27 ) 
  *Button_eigenschaften_details = IrrGuiAddButton( "Details" , 5 , 270 , 85 , 290 , *Window_Eigenschaften , 28 ) 
  *Window_Outliner = IrrGuiAddWindow( 63 , 568 , 251 , 850 , "Outliner" , 0 , 0 , 29 ) 
  *Button_outliner_example = IrrGuiAddButton( "beispiel" , 35 , 25 , 90 , 45 , *Window_Outliner , 30 ) 
  *CheckBox_outliner_example_isobjectvisible = IrrGuiAddCheckBox( 0 , 5 , 25 , 30 , 45 , "" , *Window_Outliner , 31 ) 
  *Text_outliner_example_objectname = IrrGuiAddStaticText( "ObjektName" , 95 , 25 , 165 , 45 , 1 , 1 , 1 , *Window_Outliner , 32 ) 
  *Window_toolbox = IrrGuiAddWindow( 88 , 5 , 601 , 191 , "Toolbox" , 0 , 0 , 33 ) 
  *Button_toolbox_terrain_heben = IrrGuiAddButton( "terrainheben" , 5 , 25 , 170 , 45 , *Window_toolbox , 34 ) 
  *Button_toolbox_platzieren = IrrGuiAddButton( "Platzieren" , 5 , 45 , 170 , 65 , *Window_toolbox , 35 ) 
  *Button_toolbox_waypointsverbinden = IrrGuiAddButton( "verbinden" , 10 , 85 , 90 , 105 , *Window_toolbox , 36 ) 
  *Text_toolbox_waypoints = IrrGuiAddStaticText( "waypoints" , 10 , 65 , 85 , 85 , 1 , 1 , 1 , *Window_toolbox , 37 ) 
  *Button_toolbox_waypointstrennen = IrrGuiAddButton( "trennen" , 90 , 85 , 170 , 105 , *Window_toolbox , 38 ) 
  *ButtonImage_move = IrrGuiAddButton( "" , 10 , 120 , 45 , 150 , *Window_toolbox , 39 ) 
  *ButtonImage_scale = IrrGuiAddButton( "" , 45 , 120 , 80 , 150 , *Window_toolbox , 40 ) 
  *ButtonImage_rotate = IrrGuiAddButton( "" , 80 , 120 , 115 , 150 , *Window_toolbox , 41 ) 
  *ButtonImage_select = IrrGuiAddButton( "" , 115 , 120 , 150 , 150 , *Window_toolbox , 42 ) 
  *Button_toolbox_edit = IrrGuiAddButton( "Edit" , 150 , 120 , 190 , 150 , *Window_toolbox , 43 ) 
  *Button_19 = IrrGuiAddButton( "Texturepaint" , 10 , 155 , 175 , 175 , *Window_toolbox , 44 ) 
  *ScrollBar_toolbox_hohenfaktor = IrrGuiAddScrollBar( 1 , 235 , 30 , 500 , 50 , *Window_toolbox , 45 ) 
  *ScrollBar_toolbox_grosse = IrrGuiAddScrollBar( 1 , 235 , 50 , 500 , 70 , *Window_toolbox , 46 ) 
  *ScrollBar_toolbox_yverschiebung = IrrGuiAddScrollBar( 1 , 235 , 70 , 500 , 90 , *Window_toolbox , 47 ) 
  *Text_toolbox_hohenfaktor = IrrGuiAddStaticText( "Höhenfaktor" , 180 , 30 , 230 , 50 , 1 , 1 , 1 , *Window_toolbox , 48 ) 
  *Text_toolbox_pinselgrosse = IrrGuiAddStaticText( "Pinselgroße" , 180 , 50 , 230 , 70 , 1 , 1 , 1 , *Window_toolbox , 49 ) 
  *Text_16 = IrrGuiAddStaticText( "y-verschieb" , 180 , 70 , 230 , 90 , 1 , 1 , 1 , *Window_toolbox , 50 ) 
  *Window_newObjects = IrrGuiAddWindow( 668 , 27 , 815 , 193 , "NewObjects" , 0 , 0 , 51 ) 
  *Button_newobj_addwaypoint = IrrGuiAddButton( "waypoint" , 0 , 25 , 50 , 60 , *Window_newObjects , 52 ) 
  *Button_newobj_addmesh = IrrGuiAddButton( "Mesh" , 50 , 25 , 100 , 60 , *Window_newObjects , 53 ) 
  *Button_newobj_ = IrrGuiAddButton( "" , 100 , 25 , 150 , 60 , *Window_newObjects , 54 ) 
  *Button_newobj_addsky = IrrGuiAddButton( "Sky" , 0 , 60 , 50 , 95 , *Window_newObjects , 55 ) 
  *Button_newobj_addterrain = IrrGuiAddButton( "Terrain" , 50 , 60 , 100 , 95 , *Window_newObjects , 56 ) 
  *Button_newobj_addparticles = IrrGuiAddButton( "Particles" , 100 , 60 , 150 , 95 , *Window_newObjects , 57 ) 
  *Button_newobj_Billboard = IrrGuiAddButton( "Billboard" , 0 , 95 , 50 , 130 , *Window_newObjects , 58 ) 
  *Button_newobj_addsound = IrrGuiAddButton( "3D-Sound" , 50 , 95 , 100 , 130 , *Window_newObjects , 59 ) 
  *Button_newobj_music = IrrGuiAddButton( "Music" , 100 , 95 , 150 , 130 , *Window_newObjects , 60 ) 
  *Button_newobj_addplayer = IrrGuiAddButton( "Player" , 0 , 130 , 50 , 165 , *Window_newObjects , 61 ) 
  *Button_newobj_addnpc = IrrGuiAddButton( "NPC" , 50 , 130 , 100 , 165 , *Window_newObjects , 62 ) 
  *Window_kombinationen = IrrGuiAddWindow( 971 , 40 , 1133 , 768 , "Kombinationslist" , 0 , 0 , 63 ) 
  *Button_kombis_example = IrrGuiAddButton( "examplecombi" , 0 , 25 , 140 , 45 , *Window_kombinationen , 64 ) 
  *ScrollBar_4 = IrrGuiAddScrollBar( 1 , 145 , 25 , 160 , 725 , *Window_kombinationen , 65 ) 
  *Window_layer = IrrGuiAddWindow( 64 , 269 , 242 , 555 , "Layer" , 0 , 0 , 66 ) 
  *Text_18 = IrrGuiAddStaticText( "Brush" , 5 , 30 , 60 , 45 , 1 , 1 , 1 , *Window_layer , 67 ) 
  *ScrollBar_layer_brushsize = IrrGuiAddScrollBar( 1 , 35 , 50 , 170 , 65 , *Window_layer , 68 ) 
  *ScrollBar_layer_brushelementabstand = IrrGuiAddScrollBar( 1 , 35 , 65 , 170 , 80 , *Window_layer , 69 ) 
  *Text_layer_pinselsize = IrrGuiAddStaticText( "size" , 0 , 50 , 30 , 65 , 1 , 1 , 1 , *Window_layer , 70 ) 
  *Text_layer_elementabstand = IrrGuiAddStaticText( "lücke" , 0 , 65 , 30 , 80 , 1 , 1 , 1 , *Window_layer , 71 ) 
  *Button_layer_addlayer = IrrGuiAddButton( "Add_layer" , 0 , 105 , 80 , 120 , *Window_layer , 72 ) 
  *Button_layer_deletelayer = IrrGuiAddButton( "del_layer" , 90 , 105 , 165 , 120 , *Window_layer , 73 ) 
  *Text_23 = IrrGuiAddStaticText( "Layers:" , 5 , 85 , 60 , 100 , 1 , 1 , 1 , *Window_layer , 74 ) 
  *Button_layer_examplelayer = IrrGuiAddButton( "Examplelayer" , 0 , 145 , 165 , 160 , *Window_layer , 75 ) 
  *Button_selectlayer = IrrGuiAddButton( "Select_layer" , 0 , 120 , 80 , 135 , *Window_layer , 76 ) 
  *Window_textures = IrrGuiAddWindow( 379 , 672 , 961 , 757 , "texturewindow" , 0 , 0 , 77 ) 
  *Button_texture_add = IrrGuiAddButton( "add" , 5 , 65 , 80 , 80 , *Window_textures , 78 ) 
  *Button_texture_delete = IrrGuiAddButton( "del" , 80 , 65 , 155 , 80 , *Window_textures , 79 ) 
  *ScrollBar_texture_scroll = IrrGuiAddScrollBar( 1 , 155 , 65 , 575 , 80 , *Window_textures , 80 ) 
  *Image_textures_example = IrrGuiAddButton( "" , 5 , 25 , 50 , 65 , *Window_textures , 81 ) 
  ; 
  IrrGuiAddComboBox(120,240,180,260,0,23)
  *button.l = IrrGuiAddButton( "Hello World", 4,100,200,116, 0,10 )
  
  *scrollbar.l = IrrGuiAddScrollBar(#True, 4,120,200,136,0,11)
  IrrGuiScrollBarSetMax(*scrollbar,255)
  v.l = IrrGuiGetAlpha()
  IrrGuiScrollBarSetPos(*scrollbar,v)
  
  *PureLogo = IrrGetTexture( "media\PureBasicLogo2.jpg" )
  pw.l = 256
  ph.l = 64
  
  *Image = IrrGuiAddImage(ScreenWidth-pw,ScreenHeight-ph,(ScreenWidth-ph)+256,(ScreenHeight-ph)+64,0,12)
  
  IrrGuiImageSetImage(*Image,*PureLogo)
  IrrGuiImageSetUseAlphaChannel(*Image,#False)
  
  
  ; load the Scene, which was created with IrrEdit. So we have a complete Scene, with
  ; Objects, Animator and Lights. 
  IrrLoadScene("media\example.irr");
  
  ; add a first person perspective camera into the scene that is controlled with
  ; the mouse and the cursor keys. if however you capture events when starting
  ; irrlicht this will become a normal camera that can only be moved by code
  *OurCamera = IrrAddCamera( 50,0,0, 0,0,0 )
  
  ; while the scene is still running
  While IrrRunning()
  
      ; begin the scene, erasing the canvas to white before rendering
      IrrBeginScene( 255,255,255 )
  
      ; draw the scene
      
    While IrrGuiEventAvailable()
      *guievent.IRR_GUI_EVENT = IrrReadGuiEvent()
  ;;      Debug(Str(*guievent\eventtype))
      If *guievent\EventType > 0
      EndIf
      If *guievent\EventType > 0 
        If *guievent\Caller = *button And *guievent\EventType = #IRR_EGET_BUTTON_CLICKED
          Debug("Button !")
          IrrGuiSetText(*caption, "Button was pressed")
          mytext.s = IrrGuiGetText(*button)
          Debug(mytext)
        EndIf
        If *guievent\Caller = *scrollbar
          Debug("Scrollbar !")
          v.l = IrrGuiScrollBarGetPos(*scrollbar)
          IrrGuiSetAlpha(v )
         EndIf
      EndIf
    Wend
    
      ; while there are key events waiting to be processed
      While IrrKeyEventAvailable()
  
          ; read the key event out. the key event has three parameters the key
          ; scan code, the direction of the key and flags that indicate whether
          ; the control key or the shift keys were also pressed
          *KeyEvent.IRR_KEY_EVENT = IrrReadKeyEvent()
          Debug( "Key="+ Str(*KeyEvent\key))
       Wend
  
      IrrDrawScene()      
  
      ; draw the Graphical User Interface
      IrrDrawGUI()
  
      ; end drawing the scene and render it
      IrrEndScene()
      
  Wend
  
  ; -----------------------------------------------------------------------------
  ; Stop the irrlicht engine and release resources
  IrrStop()
EndIf

End
Benutzeravatar
Max_der_Held
Beiträge: 595
Registriert: 18.04.2006 17:01
Wohnort: Bavaria
Kontaktdaten:

Re: 3D Irrlicht GUI Translator (VisualDesigner 2 Irrlicht Gu

Beitrag von Max_der_Held »

Update 1:
  • ausgegebene Codestruktur verbessert
    upgedated auf Pb 4.5
    Procedure unterstützung eingebaut
    PB gadget-konstanten werden jetzt zu Gadget-Pointer-Globals.
schöne Ferien
wer noch den Thalius- irrlichtWrapper nutzt
Code lässt sich recht einfach nach N3xtd convertieren.
Antworten