Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    drawText() fails to overwrite

    Bug Reporting (FUZE 4 Nintendo Switch)
    4
    9
    361
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Wanderer1412
      Wanderer1412 Donator last edited by Wanderer1412

      If I draw the same text in the same place twice, first in a foreground colour and then in a background colour. I still see a "ghost outline" of the foreground colour...

      text = "Hello World!"
      text_size = 300
      textSize(text_size)
      text_width = textWidth(text)
      text_height = gHeight() / tHeight()
      drawText(gWidth() / 2 - text_width / 2, gHeight() / 2 - text_height / 2, text_size, skyblue, text)
      drawText(gWidth() / 2 - text_width / 2, gHeight() / 2 - text_height / 2, text_size, black, text)
      update()
      sleep(2)
      

      Shouldn't it disappear?

      1 Reply Last reply Reply Quote 0
      • Dave
        Dave Fuze Team last edited by

        You will have to add a clear() function to clear the screen between updates if you want it to overwrite.

        1 Reply Last reply Reply Quote 0
        • Martin
          Martin Fuze Team last edited by Martin

          Dave is of course correct regarding the use of clear. But I was just exchanging messages with @pianofire on the subject since I was a little confused too and it is most likely due to anti-aliasing being applied to font rendering in the frame buffer.

          @pianofire very quickly produced some very lovely effects by just offsetting the black slightly from the lighter colour though so I can see a lot of advantages to the way that it is!

          1 Reply Last reply Reply Quote 3
          • Jongjungbu
            Jongjungbu F last edited by

            I would love to see some of these text effects, and use them in my text adventure! @Martin @pianofire

            1 Reply Last reply Reply Quote 1
            • Wanderer1412
              Wanderer1412 Donator last edited by Wanderer1412

              @Martin - the weird edge effect certainly allows for some nice patterns when in a loop!
              In my case the screen has a lot of static stuff on that I don't want to re-draw (it's the "options" screen for my game) so I didn't want to use "clear()". I just wanted to animate a few small bits of text so now I just use "box()" in background colour...

              text = "Hello World!"
              text_size = 300
              textSize(text_size)
              text_width = textWidth(text)
              text_height = gHeight() / tHeight()
              drawText(gWidth() / 2 - text_width / 2, gHeight() / 2 - text_height / 2, text_size, skyblue, text)
              // drawText(gWidth() / 2 - text_width / 2, gHeight() / 2 - text_height / 2, text_size, black, text)
              box(gWidth() / 2 - text_width / 2, gHeight() / 2 - text_height / 2, text_width, text_height, black, false)
              update()
              sleep(2)
              

              This should allow for some nice (or annoying!) animation effects using size, transparency and position.... I haven't tried yet, but maybe "pulse", "wiggle" and "slide"?

              1 Reply Last reply Reply Quote 0
              • Dave
                Dave Fuze Team last edited by

                Apologies @Wanderer1412 I didn't give enough thought to this post! After seeing some of these effects I regret simply advising a clear()!

                1 Reply Last reply Reply Quote 0
                • Martin
                  Martin Fuze Team last edited by

                  @Wanderer1412 You could still have your static text while using clear by putting the static text in a function and simply calling that from the main loop. Obviously there will come a point where you may start to see slow-down and then the box approach would help with that. There's always more than one way to achieve the same thing.

                  Wanderer1412 1 Reply Last reply Reply Quote 0
                  • Wanderer1412
                    Wanderer1412 Donator @Martin last edited by

                    @Martin - Understood, and both approaches would work. Thanks so much for all your input. I'm not sure how I got the whim to animate bits of text - but it turned out to be a lot more fun than I expected and has opened up new possibilities!

                    1 Reply Last reply Reply Quote 1
                    • Wanderer1412
                      Wanderer1412 Donator last edited by Wanderer1412

                      I finally got back to the program where I used the animated text discussed above. For anyone who is curious it's called "Pong+" and shared with friend code SW-3411-8656-9702
                      The title-screen uses the clear() method that Dave suggested originally, and the select-score-to-win-screen uses my "black box" method (to avoid re-drawing the whole screen)

                      1 Reply Last reply Reply Quote 1
                      • First post
                        Last post