Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 25

Thread: my current GUI-project

  1. #11
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,795
    Blog Entries
    3
    Rep Power
    693
    Hi Rene,

    thanks for the updates and the music tip as well! I wrote BASICally complete StringBuilder module when listening to:



    Checkout RDio.com for tons of music...

    The addition Eros made in 1.9.13.0 will make incredible things possible...


    Petr
    Last edited by Petr Schreiber; 07-08-2014 at 20:07.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  2. #12
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Philippines
    Age
    47
    Posts
    1,218
    Blog Entries
    1
    Rep Power
    133
    i'm screwed- the video is not available in germany because the german government wants to have money before i can listen to this - it's a shame and it's only possible in germany .... you still can pay... viva le capitalism...
    Last edited by ReneMiner; 07-08-2014 at 20:20.
    [TABLE="class: tblf1 tblf-fullwidth tblf-alternate"]
    [TR]
    [TD][COLOR=#b22222][B][SIZE=1]The limit is[/SIZE][/B][/COLOR][/TD]
    [TD="class: isRelinked"] [COLOR=#0000cd][B][SIZE=1]Imagination[/SIZE][/B][/COLOR][/TD]
    [/TR]
    [/TABLE]

  3. #13
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,795
    Blog Entries
    3
    Rep Power
    693
    No problem, try to register at rdio.com:
    http://www.rdio.com/

    It is perfectly legal, no user content, just official releases. Seek for "Avicii - True".
    This is somehow not very intelectually challenging album, but it is fantastic for coding...

    I have an account there, we can share coding music if you want.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  4. #14
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Philippines
    Age
    47
    Posts
    1,218
    Blog Entries
    1
    Rep Power
    133
    something else here might be an idea...

    currently we do this:
    ' assume heap hPtrs holds pointers, created alike
    Dword hPtrs = Heap_allocbyStr( MKDWD$( ptr1, ptr2, ptr3, ptr4,...) )
    
    
    ' create local pointer-array on this
    
    Local lPtr(Heap_Size(hPtrs)/4) As Dword At hPtrs
    
    'now it comes, lets say all those pointers point some data of type t_myType
    Local lData As t_myType At 0
    
    ' until this line my function works pretty well without any real local variables. 
    ' ( hPtrs in reality is noded to some other structure )
    
    
    ' now I need to push the lData-mask forward and place it to the pointers in a loop
    ' like this
    
    Local i As Long
    
    For i = 1 To Ubound(lPtr)
      SetAt(lData, lPtr(i) )
      ' do something with data...
    Next
    
    in many cases i don't need the value of "i" and loop through all elements of Array lPtr anyway and thought about something like this:

    For Array lPtr
    ' from now on lPtr is an overlay at the "current" element of Array lPtr()
      SetAt(lData, lPtr)    
      ' do something with data...
    Next
    
    ... until here still understandeable ... this does it too- without the need of any real variables, assume hPtrs would be read out somewhere and this were inside some function:

    Uses "console"
    
    DWord hPtrs = HEAP_AllocByStr( MKDWD$ ( _
                                   HEAP_AllocByStr("This is a test"),          _
                                   HEAP_AllocByStr("only try out"),            _
                                   HEAP_AllocByStr("if it were possible"),     _
                                   HEAP_AllocByStr("to bind a few different"), _
                                   HEAP_AllocByStr("sized amounts of data"),   _
                                   HEAP_AllocByStr("to just one DWord")        _
                                  )      )
    
                                  
    Dim lPtr As DWord At hPtrs    ' this only a virtual surfer
    
    While VarPtr(lPtr) <= hPtrs + HEAP_Size(hPtrs) - SizeOf(DWord)
      
      PrintL HEAP_Get(lPtr)  ' usually would SetAt( lData, lPtr ) here...
    
      SetAt(lPtr, VarPtr(lPtr) + SizeOf(DWord))
      
    Wend
    
    PrintL $CRLF & Repeat$(42, "*")
    PrintL $CRLF & "Any key to end"
    WaitKey
    
    still easy, just when it comes to multidimensional storage it becomes hard to read when you try to avoid real variables
    check this:
    Uses "console"
    
    ' exxagerate a little bit now
    ' all noded to one dword:
    
    DWord hPtrs = HEAP_AllocByStr( MKDWD$ ( _
                                   HEAP_AllocByStr( MKDWD$(  _
                                                    HEAP_AllocByStr("Name"),  _
                                                    HEAP_AllocByStr("Mail"),  _
                                                    HEAP_AllocByStr("System" & $CRLF ) _
                                                   )      ),                  _
                                   HEAP_AllocByStr( MKDWD$(                   _
                                                    HEAP_AllocByStr("Eros"),  _
                                                    HEAP_AllocByStr("@Olmi"), _
                                                    HEAP_AllocByStr("Intel i7 M620") _
                                                   )      ),                  _ 
                                   HEAP_AllocByStr( MKDWD$(                   _
                                                    HEAP_AllocByStr("Petr"),  _
                                                    HEAP_AllocByStr("@PSch"), _
                                                    HEAP_AllocByStr("Intel Core i5-3350P") _
                                                   )      ),                  _ 
                                   HEAP_AllocByStr( MKDWD$(                   _
                                                    HEAP_AllocByStr("Rene"),  _
                                                    HEAP_AllocByStr("@home"), _
                                                    HEAP_AllocByStr("Intel Core i5-3330") _
                                  )      )         )      )
                                                   
                                  
    
    ' not any real variables used to read out :D
    
    Dim lPtrLine   As DWord At hPtrs
    Dim lPtrColumn As DWord At lPtrLine
    
    While VarPtr(lPtrLine) <= hPtrs + HEAP_Size(hPtrs) - SizeOf(DWord)
      
      While VarPtr(lPtrColumn) <= lPtrLine + HEAP_Size(lPtrLine) - SizeOf(DWord)
        Print HEAP_Get(lPtrColumn) & $TAB
        SetAt(lPtrColumn, VarPtr(lPtrColumn) + SizeOf(DWord))
      Wend                    
      PrintL
      
      SetAt(lPtrLine, VarPtr(lPtrLine) + SizeOf(DWord))
      SetAt(lPtrColumn, lPtrLine)
    Wend
    
    PrintL $CRLF & Repeat$(42, "*")
    PrintL $CRLF & "Any key to end"
    WaitKey
    
    barely readeable in the end. the same in future syntax if the world were a perfect place...

    Dim lPtrLine(Heap_Size(hPtrs)/4) As Dword At hPtrs
    Dim lPtrColumn() As Dword At 0
    
    For Array lPtrLine
      Redim lPtrColumn(Heap_Size(lPtrLine)/4) At lPtrLine
      For Array lPtrColumn
         Print Heap_Get( lPtrColumn ) & $TAB
      Next
      PrintL
    Next
    
    Listen to this while thinking about the above...
    Last edited by ReneMiner; 06-09-2014 at 11:38.
    [TABLE="class: tblf1 tblf-fullwidth tblf-alternate"]
    [TR]
    [TD][COLOR=#b22222][B][SIZE=1]The limit is[/SIZE][/B][/COLOR][/TD]
    [TD="class: isRelinked"] [COLOR=#0000cd][B][SIZE=1]Imagination[/SIZE][/B][/COLOR][/TD]
    [/TR]
    [/TABLE]

  5. #15
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Philippines
    Age
    47
    Posts
    1,218
    Blog Entries
    1
    Rep Power
    133

    Back to gui

    i ran into some issue regarding negative coordinates when printing TBGL_PrintFont2D.

    Attached image shows twice the same TBGL-window and within you see a box captioned "GUI.tBasicu" on the left with some text inside.
    On the right image i dragged the box a little left so it starts outside left of the visible TBGL-window-client. Drawing the box from negative coords is no problem as you see but it won't print the text



    Now do I have to render the text onto a texture or cumbersome calculate the very left visible char or use some viewport?
    Any simple suggest anyone?
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	tbgl_PrintfontIssue.jpg 
Views:	66 
Size:	73.8 KB 
ID:	9092  
    [TABLE="class: tblf1 tblf-fullwidth tblf-alternate"]
    [TR]
    [TD][COLOR=#b22222][B][SIZE=1]The limit is[/SIZE][/B][/COLOR][/TD]
    [TD="class: isRelinked"] [COLOR=#0000cd][B][SIZE=1]Imagination[/SIZE][/B][/COLOR][/TD]
    [/TR]
    [/TABLE]

  6. #16
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,795
    Blog Entries
    3
    Rep Power
    693
    Dear Rene,

    thank you for your question - this is sadly a behavior of the OpenGL implementation when working with this kind of fonts. It is very annoying, but I found no way around it.

    But there is a light at the end of tunnel - you may render the text to texture. How?

    You just clear the frame, render the text into positive coordinates, copy the graphical output to texture via TBGL_RenderToTexture and then you map this texture to your window.

    I hope this will help you, I will investigate options how to avoid this limitation of Windows OpenGL.


    Petr

    P.S. I am leaving to Slovakia till Sunday, so I might not be able to reply in that time.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  7. #17
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Philippines
    Age
    47
    Posts
    1,218
    Blog Entries
    1
    Rep Power
    133
    i was anxious to get an answer like that because it means to re-think about the mechanics of my gui. perhaps in general it could be better to have no window-alike boxes that just get drawn as now - but each box (i.e. "window") just is a textured quad. would use up quite a few texture-slots but will certainly draw faster if the surface-template of a box/window gets only drawn again if it changes and else use the existing texture again...

    the final "printed" font would look better too (automatic anti-aliased) due the usage as texture.

    ...but...

    i'm not sure about sizes, imagine we have a box 100 * 200 pixels, i would need to use a texture of 128 * 256 ( the next power of two) for it to be on the safe side ? that would occupy a lot of unused memory on the graphics-hardware if it were this way...

    My other idea was that maybe TBGL_PrintFont2d can be changed in behaviour when negative x-value is passed? I planned to create a function alike that:

    TBGL_SetActiveFont 1
    PrintFont "Hello", X, Y, Align1, Align2, MaxWidth
    
    
    Function PrintFont( ByVal sText  As String, _
                        ByVal X      As Long,   _
                        ByVal Y      As Long,   _
               Optional ByVal sAlign As Long,   _ 
                        ByVal aAlign As Long,   _
                        ByVal maxW   As Long )
                        
      Local i, lW, lH As Long
      
      While X < 0 
        If i >= StrPtrLen(StrPtr(sText)) Then Exit While
        TBGL_GetFontTextSize( Memory_Get(StrPtr(sText)+i,1), lW, lH )
        X += lW 
       ' totalTextwidth += lW  ' >>> startX for maxWidth-calculation !
        i += 1
      Wend
      
      Select Case i
        Case StrPtrLen(StrPtr(sText))
          Exit Function
        Case 0
          Nop
        Case Else
          sText = Memory_Get(StrPtr(sText)+i, StrPtrLen(StrPtr(sText))-i)
      End Select
      
    ' don't bother actual alignement nor passing maxWidth for this example
    ' this approach only works for left-aligned, else much more complicated
    
      TBGL_PrintFont2D sText, X, Y, sAlign, aAlign, maxW ' - totalTextwidth
      
    End Function
    
    Last edited by ReneMiner; 05-09-2014 at 11:52.
    [TABLE="class: tblf1 tblf-fullwidth tblf-alternate"]
    [TR]
    [TD][COLOR=#b22222][B][SIZE=1]The limit is[/SIZE][/B][/COLOR][/TD]
    [TD="class: isRelinked"] [COLOR=#0000cd][B][SIZE=1]Imagination[/SIZE][/B][/COLOR][/TD]
    [/TR]
    [/TABLE]

  8. #18
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,795
    Blog Entries
    3
    Rep Power
    693
    Stay tuned Rene,

    I am investigating


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  9. #19
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,795
    Blog Entries
    3
    Rep Power
    693
    Haha! I think I got it!

    Let me know, if tbgl_PrintFont and tbgl_PrintFont2D works for you as expected now
    If yes, I will update help file and binaries for next ThinBASIC...


    Petr

    Attachement removed.
    Last edited by Petr Schreiber; 13-09-2014 at 14:51.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  10. #20
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Philippines
    Age
    47
    Posts
    1,218
    Blog Entries
    1
    Rep Power
    133
    sadly does not print any text at all now

    attached latest version - Attention, needs thinCore.dll from other thread, use version of september 10th !
    Attached Files Attached Files
    Last edited by ReneMiner; 13-09-2014 at 11:56.
    [TABLE="class: tblf1 tblf-fullwidth tblf-alternate"]
    [TR]
    [TD][COLOR=#b22222][B][SIZE=1]The limit is[/SIZE][/B][/COLOR][/TD]
    [TD="class: isRelinked"] [COLOR=#0000cd][B][SIZE=1]Imagination[/SIZE][/B][/COLOR][/TD]
    [/TR]
    [/TABLE]

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Current module development possibilities?
    By Michael Hartlef in forum thinBasic SDK
    Replies: 0
    Last Post: 17-09-2013, 20:12
  2. current thinAir very unstable?
    By Michael Hartlef in forum thinAir General
    Replies: 5
    Last Post: 09-02-2008, 07:35
  3. Current TAB player seems not working here
    By ErosOlmi in forum T.A.B. (ThinBasic Adventure Builder)
    Replies: 10
    Last Post: 21-04-2007, 12:41
  4. thinBundle: current status
    By ErosOlmi in forum thinBundle
    Replies: 0
    Last Post: 02-04-2007, 15:15
  5. Current development
    By ErosOlmi in forum thinBasic General
    Replies: 1
    Last Post: 31-08-2006, 22:33

Posting Permissions

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