Skip to content
Permalink
Browse files
Added "UI::DrawTexture" overload which accepts an aspect ratio
  • Loading branch information
crosire committed Sep 11, 2015
1 parent cad1414 commit 6df93eb8a7fd20a70d74853bb277cd99a27e51e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
@@ -68,13 +68,17 @@ namespace GTA

void UI::DrawTexture(String ^filename, int index, int level, int time, Point pos, Size size)
{
DrawTexture(filename, index, level, time, pos, PointF(0.0f, 0.0f), size, 0.0f, Color::White);
DrawTexture(filename, index, level, time, pos, PointF(0.0f, 0.0f), size, 0.0f, Color::White, 1.0f);
}
void UI::DrawTexture(String ^filename, int index, int level, int time, Point pos, Size size, float rotation, Color color)
{
DrawTexture(filename, index, level, time, pos, PointF(0.0f, 0.0f), size, rotation, color);
DrawTexture(filename, index, level, time, pos, PointF(0.0f, 0.0f), size, rotation, color, 1.0f);
}
void UI::DrawTexture(String ^filename, int index, int level, int time, Point pos, PointF center, Size size, float rotation, Color color)
{
DrawTexture(filename, index, level, time, pos, center, size, rotation, color, 1.0f);
}
void UI::DrawTexture(String ^filename, int index, int level, int time, Point pos, PointF center, Size size, float rotation, Color color, float aspectRatio)
{
int id;

@@ -94,6 +98,6 @@ namespace GTA
const float w = static_cast<float>(size.Width) / UI::WIDTH;
const float h = static_cast<float>(size.Height) / UI::HEIGHT;

drawTexture(id, index, level, time, w, h, center.X, center.Y, x, y, rotation, 1.0f, color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, color.A / 255.0f);
drawTexture(id, index, level, time, w, h, center.X, center.Y, x, y, rotation, aspectRatio, color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, color.A / 255.0f);
}
}
@@ -100,6 +100,7 @@ namespace GTA
static void DrawTexture(System::String ^filename, int index, int level, int time, System::Drawing::Point pos, System::Drawing::Size size);
static void DrawTexture(System::String ^filename, int index, int level, int time, System::Drawing::Point pos, System::Drawing::Size size, float rotation, System::Drawing::Color color);
static void DrawTexture(System::String ^filename, int index, int level, int time, System::Drawing::Point pos, System::Drawing::PointF center, System::Drawing::Size size, float rotation, System::Drawing::Color color);
static void DrawTexture(System::String ^filename, int index, int level, int time, System::Drawing::Point pos, System::Drawing::PointF center, System::Drawing::Size size, float rotation, System::Drawing::Color color, float aspectRatio);

internal:
static System::Collections::Generic::Dictionary<System::String ^, int> ^sTextures = gcnew System::Collections::Generic::Dictionary<System::String ^, int>();

2 comments on commit 6df93eb

@njames93
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue about aspect ratio and rotation raises an interesting point, maybe a change to the setup is needed, Im thinking the width should be divided by the aspect ratio then the aspect ratio parameter set to the aspect ratio, that should prevent textures being distorted when rotated

@crosire
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might work, need to test that.

Please sign in to comment.