Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 46

Thread: Irrlicht module: unofficial preview 3

  1. #11
    Hi Bagamut,

    thanks for mentioning this. I forgot about it totally. As Roberto seem to have not interest in this anymore, I might have a look at this freebasic wrapper.

    Cheers
    Michael

  2. #12

    help how to adapt irrlicht for thinbasic

    anybody out there can help me to understand how to adept "irrlicht" wrapper for thinbasic? How has created "thinbasic_irrlicht.dll"? What tool I have to use? I want to create a dungeon with a monster in there with irrlicht/thinbasic petr, michael, eros, matthew, bagamut or some person of this forum site could help? you are welcome to give some infos or links or something else.
    regards, largo

  3. #13
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Hi largo,

    sorry no-one replied to your request.
    Irrlicht project was a Roberto Bianchi project, I just published it.

    If I remember well, it was a wrapper of a C++ library. You need to have Microsoft C++ in order to go on with the project.

    If someone is interested to go on, I can see if I'm in the position (I've to ask to Roberto about that) to publish source code of the wrapper.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  4. #14

    enum question again with translation example (freebasic to thinbasic)

    I've tried to tranlsate "enum types" with thinbasic. See my example. The freebasic example I have desactivated and it's below thinbasic part. perhaps somebody can check the thinbasic code how to specify "types objects" with a number ( = 1) or better using equates and say what's correct?

                                      '---------------> ' Event types from irrlicht part ------->
    'enum IRR_EEVENT_TYPE
    '    IRR_EET_GUI_EVENT            = 0
    '    IRR_EET_MOUSE_INPUT_EVENT    = 1
    '    IRR_EET_KEY_INPUT_EVENT      = 2
    '    IRR_EET_JOYSTICK_INPUT_EVENT = 3
    '    IRR_EET_LOG_TEXT_EVENT       = 4
    '    IRR_EET_USER_EVENT           = 5
    'End enum
    '-------------------------------------------> irrlicht part                
    
    
    ' Empty GUI script created on 06-07-2011 10:21:23 by largo_winch  (ThinAIR)
    Uses "console"
    '----------------------> THINBASIC PART -------------------->
    Type MyEnum
    'enum MyEnum
            'option1 = 1
            'option2 = 2
            'option3 = 3
            option1 As Single '= 1 doesn't work!
            option2 As Single '= 2 doesn't work!
            option3 As Single '= 3 doesn't work!
    'End enum
    End Type
    
    Dim xmyEnum As MyEnum
    
    Dim MyVar As Integer
    Dim MyVar2 As Integer
    
    MyVar = xmyEnum.option1
    MyVar2 = xmyEnum.option2
    
    Select Case MyVar
            Case xmyEnum.option1
                    PrintL "Option 1"
            Case xmyEnum.option2
                    PrintL "Option 2"
            Case xmyEnum.option3
                    PrintL "Option 3"
    End Select
    'result="Option 1"
    
    Select Case MyVar2
            'Case xmyEnum.option1 '--------> only with a trick to get the correct result! :)
            '        PrintL "Option 1"
            Case xmyEnum.option2
                    PrintL "Option 2"
            Case xmyEnum.option3
                    PrintL "Option 3"
    End Select
    'result="Option 2"
    
    'Sleep 1500                                  
    WaitKey
    '-----------------------------------------------> end thinbasic script ----->
    
    
    '------ original Freebasic code example ------------------------------------>
    '
    'enum MyEnum
    '        option1 = 1
    '        option2 = 2
    '        option3 = 3
    'End enum
    
    'Dim MyVar As Integer
    'Dim MyVar2 As Integer
    
    'MyVar = option1
    'MyVar2 = option2
    
    'Select Case MyVar
    '        Case option1
    '                Print "Option 1"
    '        Case option2
    '                Print "Option 2"
    '        Case option3
    '                Print "Option 3"
    'End Select
    '
    'Select Case MyVar2
    '        Case option1
    '                Print "Option 1"
    '        Case option2
    '                Print "Option 2"
    '        Case option3
    '                Print "Option 3"
    'End Select
    
    'Sleep 1500
    '-----> result "option1"
    '-----> result "option2"
    
    bye, largo
    Attached Files Attached Files
    Last edited by largo_winch; 07-06-2011 at 11:23.

  5. #15
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hi,

    if you have FreeBASIC enum like this:
    enum IRR_EEVENT_TYPE    
        IRR_EET_GUI_EVENT            = 0
        IRR_EET_MOUSE_INPUT_EVENT    = 1
        IRR_EET_KEY_INPUT_EVENT      = 2
        IRR_EET_JOYSTICK_INPUT_EVENT = 3
        IRR_EET_LOG_TEXT_EVENT       = 4
        IRR_EET_USER_EVENT           = 5
    End enum
    
    you can re-represent it in thinBASIC like:
    Alias Long As IRR_EEVENT_TYPE
    Begin Const 'IRR_EEVENT_TYPE    
      %IRR_EET_GUI_EVENT            = 0
      %IRR_EET_MOUSE_INPUT_EVENT    = 1
      %IRR_EET_KEY_INPUT_EVENT      = 2
      %IRR_EET_JOYSTICK_INPUT_EVENT = 3
      %IRR_EET_LOG_TEXT_EVENT       = 4
      %IRR_EET_USER_EVENT           = 5
    End Const
    
    ...
    
    Dim MyEvent As IRR_EEVENT_TYPE
    
    MyEvent = %IRR_EET_USER_EVENT
    
    or even simply as:
    Alias Long As IRR_EEVENT_TYPE
    Begin Const 'IRR_EEVENT_TYPE    
      %IRR_EET_GUI_EVENT            = 0  ' -- Sets start of numbering
      %IRR_EET_MOUSE_INPUT_EVENT         ' -- This is automatically 1
      %IRR_EET_KEY_INPUT_EVENT           ' -- This is automatically 2...
      %IRR_EET_JOYSTICK_INPUT_EVENT
      %IRR_EET_LOG_TEXT_EVENT      
      %IRR_EET_USER_EVENT          
    End Const
    
    ...
    
    Dim MyEvent As IRR_EEVENT_TYPE
    
    MyEvent = %IRR_EET_USER_EVENT
    
    Regarding original FreeBasic code, it would become something like:
    Uses "console"
    
    Begin Const 'MyEnum
      %option1  = 1   ' -- Start from 1
      %option2  
      %option3  
    End Const
                   
    Dim MyVar, MyVar2 As Long ' -- Integer would work as well, but LONGs are faster 
     
    MyVar  = %option1
    MyVar2 = %option2
     
    Select Case MyVar
            Case %option1
                    PrintL "Option 1"
            Case %option2
                    PrintL "Option 2"
            Case %option3
                    PrintL "Option 3"
    End Select
    
    Select Case MyVar2
            Case %option1
                    PrintL "Option 1"
            Case %option2
                    PrintL "Option 2"
            Case %option3
                    PrintL "Option 3"
    End Select
     
    WaitKey
    
    Petr
    Last edited by Petr Schreiber; 07-06-2011 at 11:37.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  6. #16

    irrlicht translation successful?

    thank you petr for infos about "enum" translations help to thinbasic !

    yoh! now I've done next step and crazy thing: I have translated the "irrlichtwrapper.bi" for thinbasic as include file (as well as I am able to do that after two hours!). see my zip folder. but I have to add something more. So I can imagine I have to connect the file to thincore? I must build a module engine?

                                      ' Empty GUI script created on 06-07-2011 18:31:07 by largo_winch (ThinAIR)
    
    '' Includes for extension libraries
    #INCLUDE "Irrlicht_lw1.inc"
    
    Uses "console", "ui" 
    
    Declare Function LoadLibrary Lib "KERNEL32.DLL" Alias "LoadLibraryA" (lpLibFileName As Asciiz) As Long
    
    hLib = LoadLibrary("IRRLICHT.DLL")
    hLib = LoadLibrary("IRRLICHTWRAPPER.DLL")
    '--------------------------------------------------------------->
    
    IrrStart (%IRR_EDT_OPENGL, 400, 200, %IRR_BITS_PER_PIXEL_32,_
              %IRR_WINDOWED, %IRR_NO_SHADOWS, %IRR_IGNORE_EVENTS,_
              %IRR_VERTICAL_SYNC_ON )
    
    'IrrStart, %IRR_EDT_OPENGL, 400, 200, 32,_
    '          %FALSE, %FALSE, %FALSE, 0 
    
    
    ' Set the title of the display
    IrrSetWindowCaption( "Example 01: Hello World" )
    
    ' add a static text object to the graphical user interface. 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
    IrrAddStaticText( "Hello World", 4,0,200,16, %IRR_GUI_NO_BORDER, %IRR_GUI_NO_WRAP )
    
    ' while the scene is still running
    While IrrRunning
        ' begin the scene, erasing the canvas to white before rendering
        IrrBeginScene( 255,255,255 )
    
        ' draw the Graphical User Interface
        IrrDrawGUI
    
        ' end drawing the scene and render it
        IrrEndScene
    Wend
    
    ' -----------------------------------------------------------------------------
    ' Stop the irrlicht engine and release resources
    IrrStop
    
    "irrstart" is a sub declaration but thinbasic doesn't accept this command or cannot read this command although it's defined in include file.

    bye, largo
    Last edited by largo_winch; 08-06-2011 at 19:10.

  7. #17
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hi!,

    you are almost there!

    Tip #1
    Remove this code from the include file and examples:
    Declare Function LoadLibrary Lib "KERNEL32.DLL" Alias "LoadLibraryA" (lpLibFileName As Asciiz) As Long
    
    Dim hlib As DWord
    Dim v As Long
    
    hLib = LoadLibrary("IRRLICHT.DLL")
    hLib = LoadLibrary("IRRLICHTWRAPPER.DLL")
    
    Why? Because you can declare the DLL in the DECLAREs directly, see Tip #2

    Tip #2
    Just specify the DLL directly in the declarations. That means for example this:
    Declare Function IrrRunning Alias "IrrRunning" () As Integer
    
    becomes this:
    Declare Function IrrRunning LIB "IrrlichtWrapper.DLL" Alias "IrrRunning" () As Integer
    
    Tip #3
    Value initialization is not supported in declare statements, so this:
    Declare Sub IrrStart Alias "IrrStart" ( _
        ByVal device_type As IRR_DEVICE_TYPES, _
        ByVal iwidth As Integer, _
        ByVal iheight As Integer, _
        ByVal bitsperpixel As Integer, _ 'unSigned 
        ByVal fullscreen As Integer, _
        ByVal use_shadows As Integer, _
        ByVal iCaptureMouse As Integer, _
        ByVal vsync As Integer = IRR_OFF ) '
    
    becomes (with Tip #2 applied as well):
    Declare Sub IrrStart Lib "IrrlichtWrapper.dll" Alias "IrrStart" ( _
        ByVal device_type As IRR_DEVICE_TYPES, _
        ByVal iwidth As Integer, _
        ByVal iheight As Integer, _
        ByVal bitsperpixel As Integer, _ 'unSigned 
        ByVal fullscreen As Integer, _
        ByVal use_shadows As Integer, _
        ByVal iCaptureMouse As Integer, _
        ByVal vsync As Integer) ' -- Removed initialization
    
    Tip #4
    Be precise, for example

    • you have IrrStart defined twice in the INC file, first as SUB (correct), second as function (wrong, delete it)
    • you need to be sure about data types, for example I have seen:
      ByVal bitsperpixel As Integer, _ 'unSigned
      
      .. but Integer is signed of course, so this is confusing
    • Beware! FreeBasic Integer is 32bit while ThinBASIC Integer is 16bit! So FreeBasic Integer should be Long or Int32 data type in ThinBASIC.
      To see the details on FreeBASIC data types, look here: http://mateusz.viste.free.fr/dos/fb_types.pdf
      To see the details on ThinBASIC data types, look here: http://www.thinbasic.com/public/products/thinBasic/help/html/numericvariables.htm


    I think you did good job, now just make the details fit and you can run Irrlicht tomorrow


    Petr
    Last edited by Petr Schreiber; 07-06-2011 at 20:41.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  8. #18
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Largo,

    in thinBasic there is no need to use "LoadLib" to load a libraries in order to access sub or functions inside them: you just need to declare the needed sub/functions and all the rest will be done automagically. So change all your needed declares in order to use the LIB clause

    The problem is that you need to declare your subs/functions using the LIB "libName" clause. See http://www.thinbasic.com/public/prod...ml/declare.htm

    Other problems I've fixed in attached files:
    • in DECLARE statement you cannot indicate default values for optional parameters, just use OPTIONAL keyword for optional parameters
    • WSTRING is not supported. wstring is just a UNICODE (double byte) string. Use UCODE$ to convert from ascii to UNICODE string
    • IrrStart was defined more than once. I just commented some out and leave the first version I found in the include file. I do not know it it is ok or not


    Ciao
    Eros
    Attached Files Attached Files
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  9. #19
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    oops, sorry Petr. I posted while you was posting.
    Your is a much better explanation than mine!
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  10. #20
    thanks to petr and eros! I have aim to manage this irrlicth monsterly stuff!

    I see a little light at the end of the hole but there are some more questions.

    ' Empty GUI script created on 06-08-2011 08:53:01 by largo_winch (ThinAIR)

    '----------------------------------------------------------------
    'Question about irrlicht_engine, if this translation is correct:
    '----------------------------------------------------------------

    '1) --------------------->
    '#define IRR_OFF 0
    %IRR_OFF = 0

    '#define IRR_ON 1
    %IRR_ON = 0

    '2) --------------------->
    'TYPE irr_node As LONG Ptr
    Type irr_node
    irr_node As Long Ptr
    End Type

    'Type irr_gui_object as Any Ptr
    Type irr_gui_object
    irr_gui_object As Any Ptr
    End Type

    'TYPE irr_mesh as LONG PTR
    Type irr_mesh ' doesn't work for loading objects
    irr_mesh As Long Ptr
    End Type
    -example one (Hello irrlicht) opens a dialog as wished, but Title text isn't correct (I see hyroglyphs). see my example.

    -I've changeld nearly all integer into longs.

    -included lib's (LIB "IrrlichtWrapper.DLL") as needed.

    - all wstring/zstring I changed into "string"

    - all examples you find in zip folder with new "irrlicht_lw.inc" (not perfect but nearly 90 per cent I am thinking!)

    more questions will come.thanks boys for helping and hints!
    eros, I didn't see your example until some seconds before my post here. I will check next hours.

    I cannot load yet any irrlicht object (irr_mesh) gives still errors.

    bye largo
    Last edited by largo_winch; 08-06-2011 at 19:11.

Page 2 of 5 FirstFirst 1234 ... LastLast

Similar Threads

  1. Irrlicht module: 2nd unofficial preview
    By ErosOlmi in forum Irrlicht
    Replies: 11
    Last Post: 08-05-2007, 10:31

Members who have read this thread: 1

Tags for this Thread

Posting Permissions

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