How can I test things on my PC that I plan to port to my phone?

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
128Gigabytes
Prole
Posts: 14
Joined: Wed Jan 04, 2017 5:53 pm

How can I test things on my PC that I plan to port to my phone?

Post by 128Gigabytes »

The problem being, my PC screen is 1360 x 778 while my phone is 1440 x 2960
So obviously I can't use a window that is so much taller on my computer screen because most of it is off screen

Even at my max screen res on my PC its too tall (Plus with the res that high I can't really see anything because it makes everything so small)

What can I do to avoid having to port my scripts over to my phone every time I need to test something?
TheHistoricApple
Prole
Posts: 26
Joined: Sun Jan 15, 2017 6:46 am

Re: How can I test things on my PC that I plan to port to my phone?

Post by TheHistoricApple »

128Gigabytes wrote: Wed Jun 07, 2017 8:06 am my PC screen is 1360 x 778 while my phone is 1440 x 2960
First, I would not recommend making your game native 1440x2960 especially if you plan on supporting other phones.

Reason being it takes Alot more power to scale down large assets then scale up small assets an older phone could possible freeze up and lag depending on the size and volume of scaling.

your phone can support other resolutions

If you dont want to use a resolution library like push, one thing you could do is force your game landscape which would make your phone 2960x1440.

Then you can make a if statement that sees what os your running. if its windows then set screen width = 2960 / 2 and screen height = 1440 / 2 then scaled down all your assets with a scale of .5
128Gigabytes
Prole
Posts: 14
Joined: Wed Jan 04, 2017 5:53 pm

Re: How can I test things on my PC that I plan to port to my phone?

Post by 128Gigabytes »

What is a good resolution to make the default then?
TheHistoricApple
Prole
Posts: 26
Joined: Sun Jan 15, 2017 6:46 am

Re: How can I test things on my PC that I plan to port to my phone?

Post by TheHistoricApple »

I personally use 480x320
128Gigabytes
Prole
Posts: 14
Joined: Wed Jan 04, 2017 5:53 pm

Re: How can I test things on my PC that I plan to port to my phone?

Post by 128Gigabytes »

TheHistoricApple wrote: Wed Jun 07, 2017 7:32 pm I personally use 480x320
Jeeze, thats gonna give me very little space to work with. Also how do I get the screen resolution so I can upscale correctly?

Like if I wanted to draw a box that was half the screen size, I would make its size (screenResX / 2) by (screenResY / 2)

But I can't figure out how to get the screenRes values.
TheHistoricApple
Prole
Posts: 26
Joined: Sun Jan 15, 2017 6:46 am

Re: How can I test things on my PC that I plan to port to my phone?

Post by TheHistoricApple »

lets say I'm developing my game for 480x320
Lets sets those to vars

Code: Select all

OriginalWidth, OriginalHeight = 480, 320
So we want to scale it to our new resolution which is the actual size of the devices we are running the app on.
Lets set those aswell.

Code: Select all

WindowWidth, WindowHeight = love.graphics.getDimensions()
Now we want to divide to get our scale factors

Code: Select all

ScaleX = WindowWidth / OriginalWidth
ScaleY = WindowHeight / OriginalHeight
-- now we can scale

function love.draw()
    love.graphics.push()
    love.graphics.scale(ScaleX, ScaleY)
    --draw here
    --example rectangle
    love.graphics.rectangle("fill", 100 / ScaleX, 100 / ScaleY, 100, 100)
    love.graphics.pop()
end
We have to divide by the scale so it stays at the same spot of x = 100 y = 100
Also if you use and mouse click functions youd have to divide by the scale aswell.

Note this is a very rough way to scale because it stretches the images with no care to how it looks afterwards.

Thats why you should really look into a resolution handling library such as push because it letterboxes and gets it pixel perfect for you.
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: How can I test things on my PC that I plan to port to my phone?

Post by Davidobot »

I would recommend developing for 1280x720 - even low-end Android phones have that resolution. From that, it's a nice scale up to 1080p and 2K.

(This applies to both phones and PC)
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot] and 0 guests