Page 1 of 1

Problem drawing when going from fullscreen to normal

Posted: Tue Nov 11, 2014 7:42 pm
by Raxe88
Hello,

I am making a videogame and I want to be able to use fullscreen with any computer. The problem comes when switching from fullscreen to normal, it offsets everything I draw up and left. Look at this and you will understand:

Image
Without going to fullscreen. Looks ok. (Looks like this the first time I open it).

Image
Looking good in fullscreen. (Ignore those white rectangles, it's puush).

Image
After going out of fullscreen, you can see "Hello World" is out of the window and the width and height variables are out of place.

In fullscreen it works just right, even after having it bugged. The problem comes when going from fullscreen to normal.

This is the code:

Code: Select all

function love.load()
	fullscreen = false;
	
	width = love.window.getWidth();
	height = love.window.getHeight();
end

function love.draw()
	love.graphics.print("Hello World",0,0);
	love.graphics.print("W :"..width,0,50);
	love.graphics.print("H :"..height,0,60);
end

function love.mousepressed(x,y,button)
	if button == "l" then
		if fullscreen == false then
			love.window.setFullscreen(true, desktop);
			fullscreen = true;
			width = love.window.getWidth();
			height = love.window.getHeight();
		else
			love.window.setFullscreen(false, desktop);
			fullscreen = false;
			width = love.window.getWidth();
			height = love.window.getHeight();
		end
	end
end
I checked this post out but I think I have a different problem: viewtopic.php?f=4&t=78317&hilit=fullscreen

I am using version 9 of LÖVE but I downloaded it when it first came out, should I download a lastest version?

Thanks!

Re: Problem drawing when going from fullscreen to normal

Posted: Tue Nov 11, 2014 11:40 pm
by kraftman
change the variable desktop to a string "desktop"

Code: Select all

love.window.setFullscreen(true, "desktop")

Re: Problem drawing when going from fullscreen to normal

Posted: Wed Nov 12, 2014 1:18 am
by SpotlightKid
Raxe88 wrote:I am using version 9 of LÖVE but I downloaded it when it first came out, should I download a lastest version?
Yes, of course, if you don't have version 0.9.1, get it. Why wouldn't you want to?

Re: Problem drawing when going from fullscreen to normal

Posted: Wed Nov 12, 2014 2:54 pm
by Raxe88
I tried both things and still doing the same thing. Is it working properly to you? Maybe it has something to do with the graphics card...

Re: Problem drawing when going from fullscreen to normal

Posted: Thu Nov 13, 2014 8:09 am
by rmcode
It works fine for me on OSX.