Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / clipping
- - By danikaze Date 2011-12-03 15:28
Just a quick question:

Settings from beginClipping(x,y,w,h) are reseted in each draw() call right?
I mean, you need to call beginClipping everytime you draw in the screen, or can you set it only once?

void draw() {
  // draw things...



void draw() {
  // draw things...

before exit:
Parent - - By jlnr (dev) Date 2011-12-04 15:22
Right now, clipping and transforms can only happen inside of draw(). I have plans for a global transform, but not for a clipping rect yet. What is the use case for a global clipping rect?
Parent - - By danikaze Date 2011-12-05 11:53
Adding cinema bars to the screen.

You know, black horizontal bars in the top and bottom of the screen to keep a constant drawable area ratio (16:9) regardless of the screen resolution.
Parent - - By jlnr (dev) Date 2011-12-05 14:25
Oh good. That use case should be built into Gosu anyway. :) My test program already has comments indicating how it should behave.

I think OS X will even automatically do this if you request fullscreen in a different aspect ratio.
Parent - - By danikaze Date 2011-12-05 14:53
well, it's not a problem adding it in each draw() call, I just wanted to know ;)

But other thing related to this, if I want to keep a constant aspect rate, I have to use the factorX and factorY parameters in the image drawing, right?
I have a problem calculating thos resize factors, because I need the actual window size when not in fullscreen, and not the virtual size. Is there any way to get it?
With MSVC debugger I know the graphics() object has physWidth and physHeight properties, but width() and height() only return the virtual ones.

And which way is better to use? pushTransform() or factor parameters in draw functions?
Parent - - By jlnr (dev) Date 2011-12-05 14:58

You can use fullscreen at the desktop resolution by passing screenWidth()/screenHeight() for the window size. Then you know that your window is the same resolution as the physical screen. Also, your game will look better that way. :)
Parent - - By danikaze Date 2011-12-05 15:11
Yes, the window created with that size will have the same aspect ratio that the desktop, but not the same size (due to window decorator borders restrictions).
For example, I have 1920x1080 desktop (16:9), but If I create a window with that size, the physical size would be 1536x864, wich is 16:9, but I'm basing my graphics on 1280x720, so the resize factor in this case will be 1,5 (1920/1280) and graphics will be bigger than they should be.
The correct resize factor would be 1920/1536, so how can I know the physical size of the screen?
Parent - - By jlnr (dev) Date 2011-12-05 15:19
If you open it in fullscreen it should not have window decorations - does it?
Parent - - By danikaze Date 2011-12-05 15:21
Yeah, fullscreen works fine. There's no problem with that.

The problem is when creating a window (no fullscreen) with a bigger size than allowed.
Parent - - By jlnr (dev) Date 2011-12-05 15:36
Oh, if Gosu resizes your window then it also sets up scaling. So if you apply a factor of 1,5, Gosu should apply another factor that makes it work. If not, this is a bug.
Parent - - By danikaze Date 2011-12-05 16:04
Well, I can see in the graphics().queues[0].individualTransforms the matrix with the value 0.8 (1920/1536), but I'm not sure it's working as supossed, because my graphics are bigger than they should be...
Parent - - By jlnr (dev) Date 2011-12-05 16:37
Oh, so it looks different across fullscreen and windowed mode? That would be a bug, unless you are using the undocumented Graphics::setResolution member function (this might mess with windowed mode).

I will try to reproduce this in a minimal ruby script.
Parent - By danikaze Date 2011-12-05 17:42
no I'm not using setResolution.
Anyway I'm using W7 and C++ :)
If you want me to test any code, just tell me ^^
Parent - - By Jamer Date 2011-12-06 21:53
This sounds similar to another issue I'm facing where the initial transform set by Gosu is forgotten. Do you think it could be related, jlnr?
Parent - By jlnr (dev) Date 2011-12-06 22:33
You are right, this is almost certainly the same issue. Doh! :) Expect 0.7.41 to clean up soon.
Up Topic Gosu / Gosu Exchange / clipping

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill