Skip to content

Commit

Permalink
Fixed fuzzy button
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxgurugamer committed Mar 20, 2018
1 parent a0e9aa6 commit 61c90b9
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 5 deletions.
Binary file modified .vs/EditorExtensionsRedux/v15/sqlite3/storage.ide
Binary file not shown.
2 changes: 1 addition & 1 deletion EditorExtensionsRedux.version
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"MAJOR":3,
"MINOR":3,
"PATCH":19,
"BUILD":1
"BUILD":2
},
"KSP_VERSION":
{
Expand Down
77 changes: 75 additions & 2 deletions EditorExtensionsRedux/AppLauncherButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,81 @@ private void ButtonState (bool state)
Log.Debug ("ApplicationLauncher on" + state.ToString ());
EditorExtensions.Instance.Visible = state;
}
/// <summary>
/// Copied from ToolbarController
/// </summary>
///
//
// The following function was initially copied from @JPLRepo's AmpYear mod, which is covered by the GPL, as is this mod
//
// This function will attempt to load either a PNG or a JPG from the specified path.
// It first checks to see if the actual file is there, if not, it then looks for either a PNG or a JPG
//
// easier to specify different cases than to change case to lower. This will fail on MacOS and Linux
// if a suffix has mixed case
static string[] imgSuffixes = new string[] { ".png", ".jpg", ".gif", ".PNG", ".JPG", ".GIF" };
public static Boolean LoadImageFromFile(ref Texture2D tex, String fileNamePath)
{

Boolean blnReturn = false;
try
{
string path = fileNamePath;
if (!System.IO.File.Exists(fileNamePath))
{
// Look for the file with an appended suffix.
for (int i = 0; i < imgSuffixes.Length; i++)

if (System.IO.File.Exists(fileNamePath + imgSuffixes[i]))
{
path = fileNamePath + imgSuffixes[i];
break;
}
}

//File Exists check
if (System.IO.File.Exists(path))
{
try
{
tex.LoadImage(System.IO.File.ReadAllBytes(path));
blnReturn = true;
}
catch (Exception ex)
{
Log.Error("Failed to load the texture:" + path);
Log.Error(ex.Message);
}
}
else
{
Log.Error("Cannot find texture to load:" + fileNamePath);
}


}
catch (Exception ex)
{
Log.Error("Failed to load (are you missing a file):" + fileNamePath);
Log.Error(ex.Message);
}
return blnReturn;
}

Texture2D GetTexture(string path, bool b)
{

Texture2D tex = new Texture2D(16, 16, TextureFormat.ARGB32, false);

if (LoadImageFromFile(ref tex, KSPUtil.ApplicationRootPath + "GameData/" + path))
return tex;
return tex;
}
/// <summary>
/// End of copy
/// </summary>

private void OnGuiAppLauncherReady ()
private void OnGuiAppLauncherReady ()
{
if (this.button == null) {
try {
Expand All @@ -64,7 +137,7 @@ private void OnGuiAppLauncherReady ()
null, //RUIToggleButton.onEnable
null, //RUIToggleButton.onDisable
ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH, //visibleInScenes
GameDatabase.Instance.GetTexture (texPathDefault, false) //texture
GetTexture (texPathDefault, false) //texture
);
Log.Debug ("Added ApplicationLauncher button");
} catch (Exception ex) {
Expand Down
2 changes: 1 addition & 1 deletion EditorExtensionsRedux/AssemblyVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

using System.Reflection;

[assembly: AssemblyVersion("3.3.19.1")]
[assembly: AssemblyVersion("3.3.19.2")]
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"MAJOR":3,
"MINOR":3,
"PATCH":19,
"BUILD":1
"BUILD":2
},
"KSP_VERSION":
{
Expand Down
3 changes: 3 additions & 0 deletions GameData/EditorExtensionsRedux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
##
##

3.3.19.2
Fixed fuzzy button

3.3.19.1
Fixed issue when displaying autostruts, most got reset to Heaviest
Fixed issue when setting AS to grandparent, was setting to Heaviest
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
##
##

3.3.19.2
Fixed fuzzy button

3.3.19.1
Fixed issue when displaying autostruts, most got reset to Heaviest
Fixed issue when setting AS to grandparent, was setting to Heaviest
Expand Down

0 comments on commit 61c90b9

Please sign in to comment.