Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #279 from IntelOrca/add-window-icon
Set window icon to OpenLoco logo
- Loading branch information
Showing
7 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Microsoft Visual C++ generated resource script. | ||
// | ||
#include "resource.h" | ||
|
||
#define APSTUDIO_READONLY_SYMBOLS | ||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Generated from the TEXTINCLUDE 2 resource. | ||
// | ||
#include "winres.h" | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
#undef APSTUDIO_READONLY_SYMBOLS | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// English (United Kingdom) resources | ||
|
||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) | ||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK | ||
|
||
#ifdef APSTUDIO_INVOKED | ||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// TEXTINCLUDE | ||
// | ||
|
||
1 TEXTINCLUDE | ||
BEGIN | ||
"resource.h\0" | ||
END | ||
|
||
2 TEXTINCLUDE | ||
BEGIN | ||
"#include ""winres.h""\r\n" | ||
"\0" | ||
END | ||
|
||
3 TEXTINCLUDE | ||
BEGIN | ||
"\r\n" | ||
"\0" | ||
END | ||
|
||
#endif // APSTUDIO_INVOKED | ||
|
||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Icon | ||
// | ||
|
||
// Icon with lowest ID value placed first to ensure application icon | ||
// remains consistent on all systems. | ||
IDI_ICON ICON "logo\\icon.ico" | ||
|
||
#endif // English (United Kingdom) resources | ||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
|
||
#ifndef APSTUDIO_INVOKED | ||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Generated from the TEXTINCLUDE 3 resource. | ||
// | ||
|
||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
#endif // not APSTUDIO_INVOKED |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#r "System.Drawing.dll" | ||
|
||
using System.Drawing; | ||
using System.Drawing.Imaging; | ||
|
||
if (Args.Count == 0) | ||
{ | ||
Console.WriteLine("Usage: makeico <directory>"); | ||
return; | ||
} | ||
|
||
var inputDirectory = Args[0]; | ||
var outputPath = Path.Combine(inputDirectory, "icon.ico"); | ||
var imageSizes = new int[] { 256, 128, 96, 64, 48, 40, 32, 24, 16, 8, 4 }; | ||
var foundImages = imageSizes | ||
.Select(size => (size, Path.Combine(inputDirectory, "icon_x" + size + ".png"))) | ||
.Where(x => File.Exists(x.Item2)) | ||
.ToArray(); | ||
|
||
using (FileStream fs = new FileStream(outputPath, FileMode.Create)) | ||
{ | ||
var bw = new BinaryWriter(fs); | ||
bw.Write((short)0); | ||
bw.Write((short)1); | ||
bw.Write((short)foundImages.Length); | ||
|
||
var dataStartOffset = 6 + (foundImages.Length * 16); | ||
|
||
using (var dataStream = new MemoryStream()) | ||
{ | ||
foreach (var (size, path) in foundImages) | ||
{ | ||
bw.Write((byte)(size == 256 ? 0 : size)); | ||
bw.Write((byte)(size == 256 ? 0 : size)); | ||
bw.Write((byte)0); | ||
bw.Write((byte)0); | ||
bw.Write((short)0); | ||
bw.Write((short)32); | ||
|
||
int dataOffset = (int)dataStream.Position; | ||
int dataLength; | ||
|
||
Console.WriteLine("Importing {0}", Path.GetFileName(path)); | ||
using (var image = Image.FromFile(path)) | ||
{ | ||
image.Save(dataStream, ImageFormat.Png); | ||
} | ||
|
||
dataLength = (int)dataStream.Position - dataOffset; | ||
dataOffset += dataStartOffset; | ||
|
||
bw.Write(dataLength); | ||
bw.Write(dataOffset); | ||
} | ||
bw.Write(dataStream.ToArray()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//{{NO_DEPENDENCIES}} | ||
// Microsoft Visual C++ generated include file. | ||
// Used by OpenLoco.rc | ||
// | ||
#define IDI_ICON 101 | ||
|
||
// Next default values for new objects | ||
// | ||
#ifdef APSTUDIO_INVOKED | ||
#ifndef APSTUDIO_READONLY_SYMBOLS | ||
#define _APS_NEXT_RESOURCE_VALUE 102 | ||
#define _APS_NEXT_COMMAND_VALUE 40001 | ||
#define _APS_NEXT_CONTROL_VALUE 1001 | ||
#define _APS_NEXT_SYMED_VALUE 101 | ||
#endif | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters