Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] How to draw text on the top of window

Hi!

I'm trying to draw text on the top of window, but it's in the middle automatically.

http://i83.photobucket.com/albums/j295/ ... middle.jpg[/img]
Please tell me how to draw text on the top,
(I want text to be in brown space in the picture)

Here is the script,
Code:
    super(0,0,640,480)
    self.contents = Bitmap.new(width - 32,height - 32)
    self.contents.draw_text(0,0,width,height,text)

Thanks in advance!  :smile:
 
draw_text will automatically center the text vertically in the space you give it. To fix this, just change the height to 32 or whatever fits your text. Like this:

Code:
super(0,0,640,480)
self.contents = Bitmap.new(width - 32,height - 32)
self.contents.draw_text(0, 0, width, >>>>32<<<<, text)

Take out the >>>>> and <<<<<, that was just to show what I changed!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top