Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: love.graphics.getWidth(screen) returns 400px for bottom screen (should be 320) #247

Open
1 task done
alalalsam opened this issue Jan 29, 2025 · 0 comments
Open
1 task done
Labels

Comments

@alalalsam
Copy link

Software Version

3.0.1

What Happened?

Context:
Running code natively on new 3ds XL from SD card

Code:

function love.load()
	love.graphics.set3D(false)
end


function love.draw(screen)
	if screen == "top" then
		love.graphics.rectangle("line", 0, 0, 400, 240)
		love.graphics.print(love.graphics.getWidth(screen), 50, 50)
	end

	if screen == "bottom" then
		love.graphics.rectangle("line", 0, 0, 320, 240)
		love.graphics.print(love.graphics.getWidth(screen), 50, 50)
	end
end

Output:
(screenshot of 3ds)

Image
Image

What was Expected?

love.graphics.getWidth(screen) should have returned 320 when screen == "bottom", but it returned 400.

I also tried deliberately setting love.graphics.getWidth(screen) to a local variable as follows:

function love.draw(screen)
	local width = love.graphics.getWidth(screen)
	if screen == "top" then
		love.graphics.rectangle("line", 0, 0, 400, 240)
		love.graphics.print(width, 50, 50)
	end

	if screen == "bottom" then
		love.graphics.rectangle("line", 0, 0, 320, 240)
		love.graphics.print(width, 50, 50)
	end
end

with no success.

Code to Reproduce

function love.load()
	love.graphics.set3D(false)
end


function love.draw(screen)
	if screen == "top" then
		love.graphics.rectangle("line", 0, 0, 400, 240)
		love.graphics.print(love.graphics.getWidth(screen), 50, 50)
	end

	if screen == "bottom" then
		love.graphics.rectangle("line", 0, 0, 320, 240)
		love.graphics.print(love.graphics.getWidth(screen), 50, 50)
	end
end

Console

Nintendo 3DS

Firmware Version(s)

11.17.0-50U

Custom Firmware Version

Custom Luma3DS based off 13.1

Execution Method

Homebrew Menu

Code of Conduct

  • I have read the Code of Conduct and agree to these terms
@alalalsam alalalsam added the bug label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant