Search the Community
Showing results for tags '2d drawing'.
-
Hey all, I've just ran through all the forum posts about resolutions and everything and none of them seem to mention something that context:GetWidth and context:GetHeight don't do which is take into account the resolution at which the player is playing the game at. Here's an example of what I'm talking about: --Battery begin local battL =math.floor((context:GetWidth()))/2 - 775 local battY =math.floor((context:GetHeight()))/2 + 425 local battX =math.floor((context:GetWidth()))/2 - 800 local battery_percent = self.battery_level / self.battery_max_level --calculate the percentage of battery power remaining context:SetColor( 1 - battery_percent, battery_percent, 0, 1) --as the battery dies the red component increases while the green decreases context:DrawRect( battX, battY, battL * battery_percent, 20) --rectangle width is dependent on the percentage of battery remaining. Wider with more power. --Battery end This is the post render part of the script I use for the flashlight bar. Here's how it looks in my native 1920x1080 display: And here's how it looks in the native leadwerks display 1024x768 See the difference? The flashlight bar doesn't show up and the interaction text is way too close to the middle of the screen, so my question is, is there an easy way to take the player's resolution and dynamically change the draw functions so they fit the screen no matter the resolution used?
- 4 replies
-
- resolution
- 2d drawing
-
(and 1 more)
Tagged with: