Issue #638 resolved default x and y position

created an issue

Perhaps should have x and y positions which default to 0 like and

Comments (6)

  1. Alex Szpakowski

    If gets default x/y, then should too. If gets default x/y, then it also needs a default wrap width because the wrap width comes after x/y in the argument list. What should the default wrap width be?

  2. hahawoo reporter

    Hehe, I thought about this too! I concluded that printf doesn't need a default x/y just because print does. Having a default x/y is easy for print, draw and drawg, and complicated for printf, and that's okay.

  3. Joel Schumacher

    Also it would be very convenient if subsequent calls to print without specified x/y would increment the y-position. So the strings will be drawn at 0,0 then 0,20 for example, then 0,40 and so on. It's a little tricky with font-sizes though (especially if they are changed between these subsequent draw calls)

  4. hahawoo reporter

    That would be convenient, I can totally empathise with the use case, hehe. However, I think it's a little bit too complicated, because now there'd have to be this state which remembers the y-position, which resets every frame for the next love.draw, and it'd only work if you used print without arguments, so it would probably only be useful for debugging because you can't choose its position.

    However, you can always use \n in'First line!\nSecond line!\nEtc.!')

    Or you could build up a string and print that:

    info = ''
    info = info .. 'Test\n'
    info = info .. variable .. '\n'

    Edit: Or this! :P'One!', 0, 0)'\nTwo!', 0, 0)'\n\nThree!', 0, 0)'\n\n\nFour!', 0, 0)
  5. hahawoo reporter

    In regards to printf again: I think the defaults for draw, drawg and print generally would be for "getting a Drawable/Geometry/text to the screen quickly" (and also fullscreen Canvases and ParticleSystems for draw).

    Defaults could be used for printf too, which you might want for "getting wrapped text to the screen quickly". So, I'd say the-width-of-the-screen would be a good default wrap width. The only problem I see with this is that if the lover specified only an x and y position, it would be a weird to have a default wrap. That said, maybe specifying only an x and y position for printf would just be a weird thing to do. :P

  6. Log in to comment