Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Grille committed May 22, 2024
1 parent d9572ab commit 9f24949
Show file tree
Hide file tree
Showing 50 changed files with 690 additions and 1,383 deletions.
11 changes: 7 additions & 4 deletions 2D-isoedit/2D-isoedit.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<ApplicationIcon>..\Assets\Cube.ico</ApplicationIcon>
<UseWindowsForms>true</UseWindowsForms>
Expand Down Expand Up @@ -39,19 +39,22 @@
<None Update="examples\Factory_256.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="examples\Factory_256_tex.png">
<None Update="examples\Factory_256_texture.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="examples\Maze_256.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="examples\Maze_256_tex.png">
<None Update="examples\Maze_256_texture.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="examples\Mountain_512.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="examples\Mountain_512_tex.png">
<None Update="examples\Mountain_512_normals.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="examples\Mountain_512_texture.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion 2D-isoedit/Properties/PublishProfiles/FolderProfile.pubxml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>false</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishReadyToRun>false</PublishReadyToRun>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<History>True|2024-05-17T03:06:20.8803250Z;True|2024-05-17T05:03:45.3980494+02:00;False|2024-05-17T05:03:13.6159268+02:00;True|2024-05-17T04:26:46.7169587+02:00;True|2024-05-17T04:25:33.1076032+02:00;True|2024-05-17T04:15:26.7922707+02:00;False|2024-05-17T04:15:05.9330880+02:00;True|2024-05-16T19:11:17.4240395+02:00;True|2024-05-16T19:08:16.0793059+02:00;True|2024-05-16T19:07:35.4674945+02:00;True|2024-05-16T18:54:50.1329214+02:00;True|2024-05-16T18:53:01.1952092+02:00;True|2024-05-16T04:02:27.0490665+02:00;False|2024-05-16T04:01:46.9816716+02:00;False|2024-05-16T04:01:20.6997543+02:00;False|2024-05-16T04:00:52.1892983+02:00;True|2021-11-11T22:41:33.5885524+01:00;True|2021-11-11T22:40:28.4833719+01:00;</History>
<History>True|2024-05-22T20:52:27.9711505Z;True|2024-05-22T22:51:47.5700720+02:00;False|2024-05-22T22:50:52.7248082+02:00;False|2024-05-22T22:50:36.9802310+02:00;False|2024-05-22T22:50:25.1277928+02:00;True|2024-05-22T22:48:02.0316773+02:00;True|2024-05-22T22:42:39.9578832+02:00;False|2024-05-22T22:37:32.8215520+02:00;True|2024-05-17T05:06:20.8803250+02:00;True|2024-05-17T05:03:45.3980494+02:00;False|2024-05-17T05:03:13.6159268+02:00;True|2024-05-17T04:26:46.7169587+02:00;True|2024-05-17T04:25:33.1076032+02:00;True|2024-05-17T04:15:26.7922707+02:00;False|2024-05-17T04:15:05.9330880+02:00;True|2024-05-16T19:11:17.4240395+02:00;True|2024-05-16T19:08:16.0793059+02:00;True|2024-05-16T19:07:35.4674945+02:00;True|2024-05-16T18:54:50.1329214+02:00;True|2024-05-16T18:53:01.1952092+02:00;True|2024-05-16T04:02:27.0490665+02:00;False|2024-05-16T04:01:46.9816716+02:00;False|2024-05-16T04:01:20.6997543+02:00;False|2024-05-16T04:00:52.1892983+02:00;True|2021-11-11T22:41:33.5885524+01:00;True|2021-11-11T22:40:28.4833719+01:00;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
10 changes: 10 additions & 0 deletions 2D-isoedit/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions 2D-isoedit/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@
<data name="StatusInformationOutline" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\assets\StatusInformationOutline.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Tilt" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\assets\Tilt.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ToggleButton" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\assets\ToggleButton.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
Expand Down
Binary file added 2D-isoedit/assets/Tilt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Binary file added 2D-isoedit/examples/Mountain_512_normals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed 2D-isoedit/examples/Mountain_512_tex.png
Binary file not shown.
Binary file added 2D-isoedit/examples/Mountain_512_texture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion 2D-isoedit/examples/config.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
default_texture ./examples/default.txt
default_map ./examples/Mountain_512.png
54 changes: 0 additions & 54 deletions 2D-isoedit/examples/default.txt

This file was deleted.

16 changes: 16 additions & 0 deletions 2D-isoedit/src/ExceptionDialog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Program;

internal class ExceptionDialog
{
public static DialogResult Show(IWin32Window owner, Exception e)
{
return MessageBox.Show(owner, e.Message, e.GetType().Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
87 changes: 87 additions & 0 deletions 2D-isoedit/src/ImageFileDialog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;

namespace Program;

internal class ImageFileDialog
{
public const string ImageFilter = "Image Files(*.BMP;*.JPG;*.GIF;*.PNG;*.TIFF)|*.bmp;*.jpg;*.gif;*.png;*.tiff|All files (*.*)|*.*";

public static string DirectoryExport;
public static string DirectoryImport;

public static bool TryOpenImage(IWin32Window owner, out string path)
{
var dialog = new OpenFileDialog();
dialog.InitialDirectory = Path.GetFullPath(DirectoryImport);
dialog.Filter = ImageFilter;

if (dialog.ShowDialog(owner) == DialogResult.OK)
{
path = dialog.FileName;
DirectoryImport = Path.GetDirectoryName(path);

return true;
}

path = null!;
return false;
}

public static bool TrySaveImage(IWin32Window owner, Bitmap bitmap)
{
var dialog = new SaveFileDialog();
dialog.InitialDirectory = Path.GetFullPath(DirectoryExport);
dialog.AddExtension = true;
dialog.Filter = ImageFilter;
dialog.DefaultExt = ".png";

if (dialog.ShowDialog(owner) == DialogResult.OK)
{
var path = dialog.FileName;
var format = GetImageFormat(path);

bitmap.Save(dialog.FileName, format);
DirectoryExport = Path.GetDirectoryName(path);

return true;
}
return false;
}

public static void SaveImage(IWin32Window owner, Bitmap bitmap)
{
try
{
TrySaveImage(owner, bitmap);
}
catch (Exception e)
{
ExceptionDialog.Show(owner, e);
}
}

public static ImageFormat GetImageFormat(string path)
{
var extension = Path.GetExtension(path).ToLower();
return extension switch
{
".bmp" => ImageFormat.Bmp,
".jpg" => ImageFormat.Jpeg,
".jpeg" => ImageFormat.Jpeg,
".gif" => ImageFormat.Gif,
".png" => ImageFormat.Png,
".tiff" => ImageFormat.Tiff,
_ => throw new ArgumentOutOfRangeException(),
};
}

}
3 changes: 2 additions & 1 deletion 2D-isoedit/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public static class CProgram
static void Main()
{
//Application.EnableVisualStyles();
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
MainForm = new FormEditor();
Expand Down
4 changes: 4 additions & 0 deletions 2D-isoedit/src/SettingsFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using System.IO;
using Grille.Graphics.Isometric.WinForms;

namespace Program;

Expand Down Expand Up @@ -56,5 +57,8 @@ bool TryGetValue(string key)

if (TryGetValue("default_map"))
DefaultMap = value;

ImageFileDialog.DirectoryImport = DirectoryImport;
ImageFileDialog.DirectoryExport = DirectoryExport;
}
}
Loading

0 comments on commit 9f24949

Please sign in to comment.