Page 1 of 1

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

Posted: Wed Jun 07, 2017 8:06 am
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?

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

Posted: Wed Jun 07, 2017 8:13 am
by yetneverdone
You can use android emulator

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

Posted: Wed Jun 07, 2017 8:41 am
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

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

Posted: Wed Jun 07, 2017 6:00 pm
by 128Gigabytes
What is a good resolution to make the default then?

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

Posted: Wed Jun 07, 2017 7:32 pm
by TheHistoricApple
I personally use 480x320

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

Posted: Wed Jun 07, 2017 8:39 pm
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.

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

Posted: Wed Jun 07, 2017 9:04 pm
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.

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

Posted: Thu Jun 08, 2017 7:59 pm
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)