Jump to content

[HELP] Draw partial image


Recommended Posts

Hy! I would like to make a dxDraw indicator that shows stamina. I wanted to make a picture, that fills up to a certain level based on a value, so I tried using dxDrawImageSection and RenderTarget too, but I couldn't make it. It is important that I want it to be relative, so like I have a 200x200 size picture that I draw in 80x80, or in 50x50 and so on based on the user's resolution. Could someone help me in this? 

Link to comment
  • Moderators

Best scaling factor: (in my opinion)

local screenWidth, screenHeight = guiGetScreenSize()

local developmentScreenHeight = 1080 -- your resolution.

local scaleFactor = screenHeight / developmentScreenHeight



local imageSizeX, imageSizeY = 128 * scaleFactor, 128 * scaleFactor 

 

Do not scale over the X as because of the screen ratio. (except if it is for X position)

 

With what are you filling it up? Because if it is just one colour then a rectangle is enough.

 

Link to comment
4 hours ago, IIYAMA said:

Best scaling factor: (in my opinion)


local screenWidth, screenHeight = guiGetScreenSize()

local developmentScreenHeight = 1080 -- your resolution.

local scaleFactor = screenHeight / developmentScreenHeight



local imageSizeX, imageSizeY = 128 * scaleFactor, 128 * scaleFactor 

 

Do not scale over the X as because of the screen ratio. (except if it is for X position)

 

With what are you filling it up? Because if it is just one colour then a rectangle is enough.

 

It would be a shape. So like a muscle, that has an outline and a fill based on a value.

Link to comment

I deleted the code, since it wasnt successful. I have a picture of an arm, that i would like to draw from the bottom to the top. I can't show it to you since I'm from mobile now. What I need is the idea of making this. So i know that RenderTarget crops everything that would be outside its borders, but when i resized the renderTarget, it made the picture messy and full of pixels. 

Link to comment
  • Moderators

When you are not on mobile.

Show me all the content you have and show me the end result (with Photoshop/gimp), so that I can get a better idea of what you are trying to do.

 

After that, I will give you instructions + the required information(incl. wiki links).

You make your second iteration and I will give feedback with some code adjustments.

Iterate, iterate, iterate etc.

 

Easy

 

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...