Fullscreen in Linux issue

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
User avatar
RostakaGmfun
Prole
Posts: 3
Joined: Fri Mar 06, 2015 12:40 pm
Location: Kyiv, Ukraine
Contact:

Fullscreen in Linux issue

Post by RostakaGmfun »

Hi there!
I am new to love2d, but a day of explorations proved that this engine is really cool. However, as I am Linux user (specifically Debian Wheezy with Openbox DE) I have experienced fullscreen issue (I guess you've heard of it, linux users, don't you?). It is obvious that the bug comes from SDL library love2d depends on (I have tried to write simple game engine and faced the same thing some time ago). However, there is certainly a way to overcome it.
1) I am interested how can I set fullscreen mode without changing screen resolution in conf.lua file
2) A good idea is to implement so-called viewport scaling, so that you can choose game resolution whatever is the best fit for your needs, but the screen resolution would remain native.
I am interested to hear you opinions and see how many there are linux users who develop with love2d.
Best regards,
RostakaGmfun
User avatar
BluBillz
Prole
Posts: 46
Joined: Tue Oct 29, 2013 6:02 pm

Re: Fullscreen in Linux issue

Post by BluBillz »

one way i learned how to make fullscreen scale properly and look fancy how you want it is with a function like this..

Code: Select all

function checkResolution()
		if fullscreen == false then
			love.graphics.setMode(0, 0, false, v, f)
			love.graphics.setMode(love.graphics.getWidth() - 200,love.graphics.getHeight() - 200, false, v, f)
		end
		if fullscreen == true then
			love.graphics.setMode(0, 0, true, v, f)
			love.graphics.setMode(love.graphics.getWidth(),love.graphics.getHeight(), true, v, f)
		end
end
but for this to work with linux exactly who knows...you can try this out tho.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Fullscreen in Linux issue

Post by s-ol »

RostakaGmfun wrote:Hi there!
I am new to love2d, but a day of explorations proved that this engine is really cool. However, as I am Linux user (specifically Debian Wheezy with Openbox DE) I have experienced fullscreen issue (I guess you've heard of it, linux users, don't you?). It is obvious that the bug comes from SDL library love2d depends on (I have tried to write simple game engine and faced the same thing some time ago). However, there is certainly a way to overcome it.
1) I am interested how can I set fullscreen mode without changing screen resolution in conf.lua file
2) A good idea is to implement so-called viewport scaling, so that you can choose game resolution whatever is the best fit for your needs, but the screen resolution would remain native.
I am interested to hear you opinions and see how many there are linux users who develop with love2d.
Best regards,
RostakaGmfun
I'm on i3 on Arch with no issues.

For changing fullscreen mode at runtime, here's the API:
https://www.love2d.org/wiki/love.window

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Fullscreen in Linux issue

Post by slime »

RostakaGmfun wrote:Hi there!
I am new to love2d, but a day of explorations proved that this engine is really cool. However, as I am Linux user (specifically Debian Wheezy with Openbox DE) I have experienced fullscreen issue (I guess you've heard of it, linux users, don't you?). It is obvious that the bug comes from SDL library love2d depends on (I have tried to write simple game engine and faced the same thing some time ago). However, there is certainly a way to overcome it.
What kind of issue are you experiencing? exclusive-fullscreen mode has drawbacks but they shouldn't manifest as bugs.
RostakaGmfun wrote:1) I am interested how can I set fullscreen mode without changing screen resolution in conf.lua file

Code: Select all

function love.conf(t)
    t.window.fullscreen = true
    t.window.fullscreentype = "desktop"
end
Or you can do it using [wiki]love.window.setMode[/wiki]:

Code: Select all

function love.load()
    love.window.setMode(800, 600, {fullscreen = true, fullscreentype = "desktop"})
end
Or [wiki]love.window.setFullscreen[/wiki] if you want to toggle into and out of fullscreen:

Code: Select all

function love.keypressed(key)
    if key == "f" then
        love.window.setFullscreen(not love.window.getFullscreen(), "desktop")
    end
end
(see the [wiki]FullscreenType[/wiki] wiki page.)
User avatar
RostakaGmfun
Prole
Posts: 3
Joined: Fri Mar 06, 2015 12:40 pm
Location: Kyiv, Ukraine
Contact:

Re: Fullscreen in Linux issue

Post by RostakaGmfun »

S0lll0s wrote: I'm on i3 on Arch with no issues.

For changing fullscreen mode at runtime, here's the API:
https://www.love2d.org/wiki/love.window
Hm, interesting. On my system, If I change the resolution of love game and move mouse to the edge of the screen, the view will scroll and you will see other windows under the game window. What is most annoying thins is that when I tried to take screenshot of this, I actually got game window and black background at places where desktop is visible:
Image

Update
Just came up with the idea that mouse can be fixed at the center of the window, and the desktop will never be visible, because mouse will never reach the edge of the screen. I will try in a moment and tell how that was went on.
User avatar
RostakaGmfun
Prole
Posts: 3
Joined: Fri Mar 06, 2015 12:40 pm
Location: Kyiv, Ukraine
Contact:

Re: Fullscreen in Linux issue

Post by RostakaGmfun »

At last, I made that.
Here is example code:

Code: Select all

local screen = {}
screen.w = 800
screen.h = 600

local mouse = {}
mouse.x = screen.w/2
mouse.y = screen.h/2

function love.load()
    love.window.setMode(screen.w/2,screen.h/2,{fullscreen=true})
    love.graphics.setBackgroundColor(128,128,128)
    love.graphics.setColor(255,192,28)
    love.mouse.setX(0)
    love.mouse.setX(0)
    love.mouse.setY(screen.w/2)
    love.mouse.setY(screen.h/2)
end

function love.mousemoved(x, y, dx, dy)
    mouse.x = mouse.x+x-screen.w/2
    mouse.y = mouse.y+y-screen.h/2
    if mouse.x>screen.w
        then mouse.x = screen.w
    elseif mouse.x<0
        then mouse.x = 0
    end
    if mouse.y>screen.h
        then mouse.y = screen.h
    elseif mouse.y<0
        then mouse.y = 0
    end
    love.mouse.setX(screen.w/2)
    love.mouse.setY(screen.h/2)
end

function love.draw()
    love.graphics.print("mouse.x: "..mouse.x..",mouse.y: "..mouse.y, 10, 10)
    love.graphics.circle("fill", mouse.x,mouse.y, 10, 20)
end
Briefly, it sets screen resolution from screen table. Next it processes mouse move event in love.mousemoved(). Every time mouse is moved it is being put back at the center of the screen, and mouse table is updated with position of mouse. In love.draw() the mouse coordinates are printed and an orange circle is drawn at position (mouse.x,mouse.y). This way, you still get your mouse and fullscreen in Linux working perfectly. Please tell me if it works on your systems.
Hope somebody will find this useful.
Update
The only thing left is to hide real mouse cursor and draw nice cursor image instead of orange circle. Also, mouse sensitivity should be tweaked a bit.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 3 guests