Problem drawing when going from fullscreen to normal

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Raxe88
Prole
Posts: 15
Joined: Mon Jul 29, 2013 11:14 pm

Problem drawing when going from fullscreen to normal

Post by Raxe88 » Tue Nov 11, 2014 7:42 pm

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!
Attachments
test2.love
The code is the same as above.
(400 Bytes) Downloaded 76 times

User avatar
kraftman
Party member
Posts: 277
Joined: Sat May 14, 2011 10:18 am

Re: Problem drawing when going from fullscreen to normal

Post by kraftman » Tue Nov 11, 2014 11:40 pm

change the variable desktop to a string "desktop"

Code: Select all

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

User avatar
SpotlightKid
Prole
Posts: 6
Joined: Mon Nov 10, 2014 7:57 am
Location: Cologne, Germany

Re: Problem drawing when going from fullscreen to normal

Post by SpotlightKid » Wed Nov 12, 2014 1:18 am

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?

Raxe88
Prole
Posts: 15
Joined: Mon Jul 29, 2013 11:14 pm

Re: Problem drawing when going from fullscreen to normal

Post by Raxe88 » Wed Nov 12, 2014 2:54 pm

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...

User avatar
rmcode
Party member
Posts: 454
Joined: Tue Jul 15, 2014 12:04 pm
Location: Germany
Contact:

Re: Problem drawing when going from fullscreen to normal

Post by rmcode » Thu Nov 13, 2014 8:09 am

It works fine for me on OSX.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 15 guests