Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / draw_quad not working correctly
- - By kognizant.kog Date 2014-04-29 19:58
I am trying to draw a square, but it draws offscreen. This happens even if I am using other's example code. Larger shapes will be drawn, but portions will be drawn offscreen.

require 'gosu'

class Game < Gosu::Window
  SQUARE_WIDTH  = SQUARE_HEIGHT = 32

  def initialize
    super(640, 480, false)
    self.caption = "Game of Life"
    @x             = 0
    @y             = 0
    @block_color   = Gosu::Color.argb(0xffff0000)
  end

  def update
  end

  def draw
    draw_quad(@x, @y, @block_color,
              @x + SQUARE_WIDTH, @y, @block_color,
              @x + SQUARE_WIDTH, @y + SQUARE_HEIGHT, @block_color,
              @x, @y + SQUARE_HEIGHT, @block_color)
  end
end

Game.new.show

Has anyone else had this problem?
Parent - - By jlnr (dev) Date 2014-04-29 20:16
Can you please attach a screenshot of what this looks like? Which version of Gosu is this?

Gosu used to expect this order of coordinates: top left, top right, bottom left, bottom right. I think it was in the middle of the 0.7.x series when I started accepting clockwise order as well. Just to make sure, can you see if it works if you replace the 3rd and 4th coordinates?
Parent - - By kognizant.kog Date 2014-04-29 20:22
I've tried both ways. If I give you a screenshot of the above, you won't see anything, so notice that I am changing the width/height.

www.tiikoni.com/tis/view/?id=526a3e6

Gosu version 0.7.50

Edit: image is breaking, so I hard posted the link.
Parent - - By jlnr (dev) Date 2014-04-29 20:38
So with the original values of 32/32 it does not work?
Parent - - By kognizant.kog Date 2014-04-29 20:55
I expect that it does, but it is rendered off-screen. The interesting thing is that it is not just my code, but all tutorials I've copied an pasted from. Are there incompatibility issues with Mac?
Parent - By jlnr (dev) Date 2014-04-29 21:32
No, Gosu is primarily developed on a Mac (several of them, actually ;) ). Are you on a Retina Mac?
Parent - - By jlnr (dev) Date 2014-04-29 21:33
If you happen to have sdl2 installed via homebrew, you can try if this solves the issue: gem install gosu --pre
Parent - - By kognizant.kog Date 2014-04-30 16:41
I'm new to Macs and was just given one when I got my new job. I pretty sure it was brand new, so I imagine it is retina. gem install gosu --pre worked great; well, except for the fact that the quad is in the wrong location until I move the window around the screen. But I can deal with that. I'm just writing Conway's Game of Life at the moment. Thanks for the help!
Parent - - By jlnr (dev) Date 2014-04-30 19:19
Is it a laptop WITHOUT any label in the black bezel around the screen?

http://images.apple.com/macbook-pro/design-retina/images/fluidgallery/gallery3_2256.jpg

Then it's a MacBook Pro with Retina display. :)

It might be this issue here or it might not. I'll try to reproduce it with an external Retina display...

https://github.com/jlnr/gosu/issues/203
Parent - - By kognizant.kog Date 2014-05-02 01:50
Yep. It's a retina.
Parent - By kognizant.kog Date 2014-05-02 01:52
And I will also keep track of the issues page.
Up Topic Gosu / Gosu Exchange / draw_quad not working correctly

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill