if entityOnScreen( entityIndex ) = True
drawEntity( entityIndex )
end if
sub RectanglesOverlap(sx1 as Int,sy1 as Int,sx2 as Int,sy2 as Int,dx1 as Int,dy1 as Int,dx2 as Int,dy2 as Int ) as boolean
dim result as Boolean
result=false
if sx1 < dx2 then
if sx2 >= dx1 then
if sy1 < dy2 then
if sy2 >= dy1 then
result = true
end if
end if
end if
end if
return result
End Sub
For lack of a better term, how do I parent the cars to the street? I could recalculate their relative position everytime the background scrolls, but his seems like a lot of overhead.
I understand the philosophy that you both mentioned. What about taking into account different screen sizes and resolutions. Since my project uses dip exclusively, the actual world coordinates may not work out, or Am I wrong?
-Sterling
1) yes, 100% wrong with DIP. Use %x and %y measure units always
Could you explain? I don't understand your answer.
My own answer would be: the coordinates in the world may be in pixels, in dip or anything else. Choose the most useful units for you. The coordinates on screen can use different units. The problem is not the units, but the conversion between them.
My own ( but short for sure ) experience. Found DIP useless.
I use %x/%y units for views and pixels for grafics with proper scale
And we're talking about 2D games, where all is based on pixel grafics, so pixels, IMHO, is a native unit
Or may be I don't understand DIP at all
For applications using views, like buttons, labels etc, %% is the best for me. And once again, this is my opinion only. One of the first version of app i'm making had mix of DIPs and %%, so it looks Ok on one device and ugly on another. Later I move to %% only and get the same look everywhere.
As I wrote above you should (almost) never use pixels without one of the scaling units.
The physical screen size of Galaxy Nexus and Galaxy Ace are similar. However the Galaxy Nexus resolution is about 720x1200 (scale=2) and the resolution of Galaxy Ace is about 320x480 (scale=1). Theoretically you can show a huge map on Galaxy Nexus. However the result will be a "compressed" and unusable map.
This is exactly the purpose of 'dip' units. A 100dip button will have (more or less) the same physical size on ALL devices.
On non-games applications percentage units are less useful. As the result, on tablets, will be a stretched UI. In such applications it is best to use 'dip' units together with AutoScaleAll.
Yes, for views, I use also %x and %y most of the time. But that's something different, there are no "world coordinates", only "screen coordinates".
As I wrote above you should (almost) never use pixels without one of the scaling units.
The physical screen size of Galaxy Nexus and Galaxy Ace are similar. However the Galaxy Nexus resolution is about 720x1200 (scale=2) and the resolution of Galaxy Ace is about 320x480 (scale=1). Theoretically you can show a huge map on Galaxy Nexus. However the result will be a "compressed" and unusable map.
This is exactly the purpose of 'dip' units. A 100dip button will have (more or less) the same physical size on ALL devices.
On non-games applications percentage units are less useful. As the result, on tablets, will be a stretched UI. In such applications it is best to use 'dip' units together with AutoScaleAll.
This was my first thought as well. Which means that DIP units are enough in this case.(we do not look at tablets farther than at phones, so I don't see why the displayed things should be sized bigger on them)
This was my first thought as well. Which means that DIP units are enough in this case.
However based on many discussions in the forum and my personal experience I realized that it is more appropriate (aka looks better) to slightly increase the font size and the views size on larger devices. Note that the default scale rate is pretty small (0.3).
I'm also not sure that we hold the devices in the same distance.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?