Problem using vehicleCanvas for drawing a simple HUD

Discussion in 'Programming' started by Mr.Hankey, Aug 14, 2013.

  1. Mr.Hankey

    Mr.Hankey
    Expand Collapse

    Joined:
    Aug 9, 2012
    Messages:
    29
    I just have a simple question: Is there any hardcoded logic that prevents the vehicleCanvas to be updated when the debugmode is 0? I removed all the Lua checks and have veryfied that my code is reached by using simple print operations but still the following is only shown on screen when the player has a debugmode enabled:
    Code:
    local txt = "testtestestestestestestestestestestestes"
    self.c:drawText(txt, string.len(txt), 5, 300, self.paints.fontLeft)
    (I put this right at the end of the DrawingCanvas.update function inside canvas.lua)

    After that I also tried using the systemCanvas which works well without any debugmode but it only covers the top right corner of the screen. I even tried creating a new SkRect using createSKRect and then assigning this one to BeamEngine.canvasTexture.rect but it seems to be completly read-only.
    Apparently there is no way to create or adjust a canvas in Lua :(
     
  2. Incognito

    Incognito
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    246
    I also tried to make a simple HUD, but nothing came of it.
    Quote from canvas.lua (DrawingCanvas:update):
    Code:
    -- this will be only executed if debug mode is enabled
    So, obj.canvasTexture is nil when debug mode is off.
    Most likely will not get to work vehicle canvas without inclusion debug mode.
    About systemCanvas, tdev's quote:
     
    #2 Incognito, Aug 14, 2013
    Last edited: Aug 14, 2013
  3. Mr.Hankey

    Mr.Hankey
    Expand Collapse

    Joined:
    Aug 9, 2012
    Messages:
    29
    Yeah the system and vehicle lua are two seperate Lua VirtualMachines i suppose.

    Using the systemCanvas works fine without the debugmode as I said but as you can see here its area doesn't cover the whole screen and I haven't found a way yet to change this:

    (imported from here)
     
  4. Incognito

    Incognito
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    246
    Press F10 and move it:
     

    Attached Files:

    • BeamNGSandbox 2013-08-14 23-03-54-74.png
  5. Mr.Hankey

    Mr.Hankey
    Expand Collapse

    Joined:
    Aug 9, 2012
    Messages:
    29
    Nice find! I didn't even suspect it could be part of the Torque3D GUI system. I can now easily make it span the whole screen and make it scale with other resolutions by adjusting art/gui/playGui.gui :)
     
  6. tdev

    tdev
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 3, 2012
    Messages:
    3,031
    nice finds guys :)

    sorry for the lack of documentation on this, working on the input wizard right now. If you have any questions on how things work, just ask :)
     
  7. GregBlast

    GregBlast
    Expand Collapse

    Joined:
    Aug 12, 2013
    Messages:
    224
    By the way is there any way to update the canvasTexture bounds by code ? Using the UI editor is ok but requires hand work every time... What if we'd always want it to cover the entire screen for example ? Maybe there is a script defining it somewhere. I just hope it's not part of the game core code...
    While I'm at it it would be nice to have a signature of the 'userdata' objects as of course no 'dump' will ever output it.
     
  8. Incognito

    Incognito
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    246
    The size and position can be changed manualy in the art\gui\playerGUI.gui (line 106).
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice