Make it possible for the scale factor to be a Single instead of always an Integer.
This commit is contained in:
parent
86ef705fa5
commit
575b48de04
P3D/Resources
|
@ -2,7 +2,7 @@
|
|||
|
||||
Private Shared TextureReplacements As New Dictionary(Of TextureSource, TextureSource)
|
||||
Private Shared FilesExist As New Dictionary(Of String, Boolean)
|
||||
Private Shared TextureResolutions As New Dictionary(Of String, Integer)
|
||||
Private Shared TextureResolutions As New Dictionary(Of String, Single)
|
||||
|
||||
Public Shared Sub Load(ByVal ContentPackFile As String)
|
||||
If System.IO.Directory.Exists(GameController.GamePath & "\ContentPacks") = True Then
|
||||
|
@ -12,7 +12,7 @@
|
|||
Select Case Line.CountSplits("|")
|
||||
Case 2 'ResolutionChange
|
||||
Dim TextureName As String = Line.GetSplit(0, "|")
|
||||
Dim Resolution As Integer = CInt(Line.GetSplit(1, "|"))
|
||||
Dim Resolution As Single = CInt(Line.GetSplit(1, "|"))
|
||||
|
||||
If TextureResolutions.ContainsKey(TextureName) = False Then
|
||||
TextureResolutions.Add(TextureName, Resolution)
|
||||
|
@ -45,7 +45,7 @@
|
|||
Return TextureSource
|
||||
End Function
|
||||
|
||||
Public Shared Function GetTextureResolution(ByVal TextureName As String) As Integer
|
||||
Public Shared Function GetTextureResolution(ByVal TextureName As String) As Single
|
||||
For i = 0 To TextureResolutions.Count - 1
|
||||
If TextureResolutions.Keys(i).ToLower() = TextureName.ToLower() Then
|
||||
Return TextureResolutions.Values(i)
|
||||
|
|
|
@ -82,7 +82,7 @@ Public Class TextureManager
|
|||
Dim tSource As TextureSource = ContentPackManager.GetTextureReplacement(TexturePath & Name, r)
|
||||
|
||||
Dim cContent As ContentManager = ContentPackManager.GetContentManager(tSource.TexturePath, ".xnb,.png")
|
||||
Dim resolution As Integer = ContentPackManager.GetTextureResolution(TexturePath & Name)
|
||||
Dim resolution As Single = ContentPackManager.GetTextureResolution(TexturePath & Name)
|
||||
|
||||
Dim tKey As String = cContent.RootDirectory & "\" & tSource.TexturePath & "," & tSource.TextureRectangle.X & "," & tSource.TextureRectangle.Y & "," & tSource.TextureRectangle.Width & "," & tSource.TextureRectangle.Height & "," & resolution
|
||||
If TextureList.ContainsKey(tKey) = False Then
|
||||
|
@ -135,7 +135,7 @@ Public Class TextureManager
|
|||
Return GetTexture(Name, r, "Textures\")
|
||||
End Function
|
||||
|
||||
Public Shared Function GetTexture(ByVal Texture As Texture2D, ByVal Rectangle As Rectangle, Optional ByVal Factor As Integer = 1) As Texture2D
|
||||
Public Shared Function GetTexture(ByVal Texture As Texture2D, ByVal Rectangle As Rectangle, Optional ByVal Factor As Single = 1) As Texture2D
|
||||
Dim tex As Texture2D = Nothing
|
||||
|
||||
If TextureRectList.TryGetValue(New KeyValuePair(Of Int32, Rectangle)(Texture.GetHashCode(), Rectangle), tex) Then
|
||||
|
@ -148,11 +148,11 @@ Public Class TextureManager
|
|||
Return tex
|
||||
End Function
|
||||
|
||||
Private Shared Function TextureRectangle(ByVal Texture As Texture2D, ByVal Rectangle As Rectangle, Optional ByVal Factor As Integer = 1) As Texture2D
|
||||
Private Shared Function TextureRectangle(ByVal Texture As Texture2D, ByVal Rectangle As Rectangle, Optional ByVal Factor As Single = 1) As Texture2D
|
||||
If Rectangle = Rectangle.Empty Then
|
||||
Return Texture
|
||||
Else
|
||||
Rectangle = New Rectangle(Rectangle.X * Factor, Rectangle.Y * Factor, Rectangle.Width * Factor, Rectangle.Height * Factor)
|
||||
Rectangle = New Rectangle(CInt(Rectangle.X * Factor), CInt(Rectangle.Y * Factor), CInt(Rectangle.Width * Factor), CInt(Rectangle.Height * Factor))
|
||||
|
||||
Dim tRectangle As New Rectangle(0, 0, Texture.Width, Texture.Height)
|
||||
If tRectangle.Contains(Rectangle) = False Then
|
||||
|
|
Loading…
Reference in New Issue