Navigation

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

    Unexpected fun (or fun facts)

    Coding
    fun
    8
    23
    1784
    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.
    • R
      romain337 last edited by romain337

      Yes I use my girlfriend's shampoo because it gives "volume" to the hair, but in fact I have baldness (I'm not totally bald) and I laugh on my own. Well that's not programming, it's true.

      Otherwise drawTextEx is not documented, are there other functions like this? It's super interesting!

      1 Reply Last reply Reply Quote 1
      • vinicity
        vinicity F last edited by

        I was going to post a link with my post about the very useful drawMultiColoredText() command, but it seems to have been removed without any notification. I guess we are not allowed to discuss undocumented features here?

        pianofire 1 Reply Last reply Reply Quote 1
        • pianofire
          pianofire Fuze Team @vinicity last edited by

          @vinicity There is no problem with discussing them but they may or may not be come permanent language features so use with care

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

            But why was the other topic deleted, then?

            https://fuzearena.com/forum/post/10219

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

              It was deleted by the poster

              1 Reply Last reply Reply Quote 0
              • vinicity
                vinicity F last edited by

                I see! Sorry for thinking it was you guys!

                So, here is what I got:

                drawMulticoloredText(float x, float y, float size, vector tint, ...) where ... can be one string or a series of strings like other text drawing functions.

                It supports colour markup like "[red]This will be red [blue]and this will be blue". Hex colour codes are also supported (should be prefixed with # like in HTML).

                But the most useful thing about it is that you can add in one of the following constants in the string:
                CONTROLS_A, CONTROLS_B, CONTROLS_X, CONTROLS_Y, CONTROLS_DPAD, CONTROLS_STICK_LEFT, CONTROLS_STICK_RIGHT, CONTROLS_L3, CONTROLS_R3, CONTROLS_L, CONTROLS_ZL, CONTROLS_R, CONTROLS_ZR, CONTROLS_MINUS, CONTROLS_PLUS and a little picture of the corresponding joy-con control will be rendered in its place.

                Just beware that this is undocumented and unsupported stuff, so it might change or even be removed in future Fuze updates. I think (and hope) the plan is to add this functionality to the old text rendering commands in the future...

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

                  @vinicity thats valuable information, thanks. But I am sure, you got some coding fun too to share😉?

                  1 Reply Last reply Reply Quote 1
                  • R
                    romain337 last edited by

                    Wow this is very nice! thanks you for sharing!

                    1 Reply Last reply Reply Quote 0
                    • spikey
                      spikey F last edited by

                      I got another one: never seen a thread going off topic as quick as this one 😂

                      1 Reply Last reply Reply Quote 0
                      • vinicity
                        vinicity F last edited by

                        OK, here is a joke:

                        A Programmer was walking out of door for work, his wife said “while you’re out, buy some milk” and he never came home.

                        1 Reply Last reply Reply Quote 6
                        • pianofire
                          pianofire Fuze Team last edited by

                          My wife said: "Please go to the store and buy a carton of milk and if they have eggs, get six." I came back with 6 cartons of milk She said, "why in the hell did you buy six cartons of milk"

                          "They had eggs"

                          1 Reply Last reply Reply Quote 8
                          • spikey
                            spikey F last edited by

                            Yes, guys, you nailed it. 😄😆

                            1 Reply Last reply Reply Quote 1
                            • PickleCatStars
                              PickleCatStars F last edited by PickleCatStars

                              How do mathematicians deal with constipation?

                              They sit down and work it out with a pencil.

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

                                what is a computers favorite food?... bits and chips

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

                                  Depending on your integer size 4294967297 + 4294967297 = 2 ;-) also you can get over it if you use int() to define your integer value.
                                  (further down in the code you need a update() and sleep(10) , not shown in the screenshot)
                                  bild.jpg
                                  bild.jpg

                                  We seem to have 4 bytes available if we use a normal int assignment (not over the int() return value).
                                  FFFF FFFF = 0 = 4294967296 = 2^32
                                  Maybe int() returns a 64 bit integer?

                                  Gothon 1 Reply Last reply Reply Quote 2
                                  • Gothon
                                    Gothon F @spikey last edited by

                                    Yes, Fuze integers are 64 bit signed values, but the constant literals (numbers typed into the code editor) are 32 bit signed values. It is somewhat unusual for literals to be a smaller type than the variables they are assigned to. It makes for some interesting code if you want to use larger integers.

                                    1 Reply Last reply Reply Quote 1
                                    • PickleCatStars
                                      PickleCatStars F last edited by

                                      ...so if you do ’x = 4294967296
                                      y = x+x
                                      Print(y)’

                                      You’ll get the right answer?

                                      spikey 1 Reply Last reply Reply Quote 0
                                      • spikey
                                        spikey F @PickleCatStars last edited by spikey

                                        @toxibunny well not wrong, but probably not what you would expect. The number is stored in x as 0. So the result will be zero. @Gothon mentioned that the editor or interpreter is assigning only 2 bytes 4 bytes for the number you type in the editor. If you generate that number with a function like int() and pow() you get the right value into x and it will show correctly. (Hope i got that right)

                                        1 Reply Last reply Reply Quote 1
                                        • PickleCatStars
                                          PickleCatStars F last edited by

                                          What if x was set to be 4294967295?

                                          Gothon 1 Reply Last reply Reply Quote 0
                                          • Gothon
                                            Gothon F @PickleCatStars last edited by Gothon

                                            @toxibunny said in Unexpected fun (or fun facts):

                                            What if x was set to be 4294967295?

                                            You will get 4294967295 + 4294967295 = -2 because 4294967295 = 2^32 - 1. Valid values for 32 bit (4 byte) signed numbers go from -2^31 to 2^31 - 1 (-2147483648 to 2147483647), anything outside that range wraps around. Eg, 2147483648 = -2147483648

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