Hedgewars Theme Creator

21 replies [Last post]
mrboese
User offline. Last seen 6 years 32 weeks ago. Offline
Joined: 2010-12-27
Posts: 22

I already wrote about it in the suggestions forum:

The Hedgewars Theme Creator should be finished now - I already tested it and created a theme "Beach" (Works fine and creating the theme - ok - except the creating of the images Annoyed - is very easy).

You can download it here: http://tilegame.bplaced.net/HWThemeEdit/

Even I developed it for .NET, it will run EVERYWHERE, because it can be used with Mono (I tested it -> works!!!)

mrboese
User offline. Last seen 6 years 32 weeks ago. Offline
Joined: 2010-12-27
Posts: 22

Good news:

The MONO Project works (Tested it minutes ago) !

You can download a solution for MonoDevelop here: http://tilegame.bplaced.net/HWThemeEdit/

Now the Theme Creator can be used with all platforms, supported by MONO.

Big Grin

(But MonoDevelop is a litte bit strange: I have to press Alt+Gr+[Key] to write braces - I cannot use Ctrl+Alt+[Key])

EDIT:
WIN32 project -> 1_1 to 1_2 (Another Zip library)
MONO compatible binary uploaded -> Should work (?)

KoBeWi
KoBeWi's picture
User offline. Last seen 3 days 13 hours ago. Offline
Joined: 2010-12-25
Posts: 564

Nice editor, but I don't know why does it copy XML, unused images and music to the exported directory. And it should remember last used path to the theme.

mrboese
User offline. Last seen 6 years 32 weeks ago. Offline
Joined: 2010-12-27
Posts: 22

KoBeWi allegedly wrote:

Nice editor, but I don't know why does it copy XML, unused images and music to the exported directory. And it should remember last used path to the theme.

Because the export function works as following:

  • Save current document data to theme.xml
  • Check if the Hedgewars path is correct and the themes folder is existing
  • Copy all contents of the working directory (usually %temp%\HedwarsThemeCreator\{Random Number from 10000 to 99999} ) to %Data%\Themes\{Theme name}
  • Check if the music file is already existing; if not, copy it to the music directory.

I will change the behaviour a little bit.

----

EDIT: I published version 1.3, which export only necessary files to the hedgewars theme editor.

//Copy files of src to dst, if its not the same
                if (dir != ThemeDocument.LastInstance.Folder)
                {
                    Thread.Sleep(100);

                    //Copy cfg
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\theme.cfg", dir);

                    //Copy Textures
                    //General
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\icon.png", dir);
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\icon@2x.png", dir);
                    //Sky
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\Sky.png", dir);
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\horizont.png", dir);
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\Clouds.png", dir);
                    //Flakes
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\Flake.png", dir);
                    //Water
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\BlueWater.png", dir);
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\Droplet.png", dir);
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\Splash.png", dir);
                    //Land
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\LandTex.png", dir);
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\LandBackTex.png", dir);
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\Girder.png", dir);
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\horizont.png", dir);
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\Border.png", dir);
                    FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\Dust.png", dir);

                    //Land Objects
                    foreach (ThemeLandObject obj in ThemeDocument.LastInstance.LandObjects)
                    {
                        FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\" + obj.Image + ".png", dir);
                    }
                    //Spray Objects
                    foreach (ThemeSprayObject obj in ThemeDocument.LastInstance.SprayObjects)
                    {
                        FileHelper.CopyFileToDirectoy(ThemeDocument.LastInstance.Folder + "\\" + obj.Image + ".png", dir);
                    }
                }

Henek
Henek's picture
User offline. Last seen 5 years 41 weeks ago. Offline
Joined: 2010-04-06
Posts: 55

I want to prepare you for that the next version of hedgewars will have a new theme.cfg format.
This will affect all current themes so they have to be updated.
It is still work in progress so updating the editor now is not a good idea.
If you want to look at the new format go to the google code page,
more details will be revealed at a later date.

One of those hedgewars developers. I am specially knowledgeable in lua scripting, and the father of gameplay scripts.

mrboese
User offline. Last seen 6 years 32 weeks ago. Offline
Joined: 2010-12-27
Posts: 22

OK.

I already found it on Google Code and I think that it's better than the old format (clearer and easier) .
And a little suggestion: Will it be possible to set more than one background music?

Henek
Henek's picture
User offline. Last seen 5 years 41 weeks ago. Offline
Joined: 2010-04-06
Posts: 55

why would you want to set more then one?

One of those hedgewars developers. I am specially knowledgeable in lua scripting, and the father of gameplay scripts.

mrboese
User offline. Last seen 6 years 32 weeks ago. Offline
Joined: 2010-12-27
Posts: 22

Imagine, you play a looooong match and the background music is repeating and repeating and repeating (...).
You may get crazy and hang yourself - died of hedgewars! (Everything is possible; nothing is true, everything is permitted) Big Grin

It could be nice to enable more songs, but it's not important.

nemo
nemo's picture
User offline. Last seen 10 hours 15 min ago. Offline
Joined: 2009-01-28
Posts: 1861

Mute in-game music, open up your favourite music player, play using that. Smile

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

mrboese
User offline. Last seen 6 years 32 weeks ago. Offline
Joined: 2010-12-27
Posts: 22

New version (1.4) released:
- You can set the land object visibility rectangles by dragging the mouse
- First attempts to implement the new theme cfg (Not used; Win32-Project only)

KoBeWi
KoBeWi's picture
User offline. Last seen 3 days 13 hours ago. Offline
Joined: 2010-12-25
Posts: 564

You need to fix this editor, because thanks to error with saving I lost my theme :/
And in which version are you going to make it remember last used path?
And it still copies unused images (for me: clouds)

mrboese
User offline. Last seen 6 years 32 weeks ago. Offline
Joined: 2010-12-27
Posts: 22

Quote:
You need to fix this editor, because thanks to error with saving I lost my theme :/

Error message?
The creator always uses the temporary directory to store all data. While saving, the data in the current working directory in %temp% will be packed in a *.zip-archive.
You can backup all your data, till you restart the creator, because it will delete the folders in %temp%\HedgeWarsThemeCreator at startup.

Quote:
And in which version are you going to make it remember last used path?

Maybe in next version. Is there a bookmark-function that can be used within the OpenFile dialog?

Quote:
And it still copies unused images (for me: clouds)

It's necessary.

Henek
Henek's picture
User offline. Last seen 5 years 41 weeks ago. Offline
Joined: 2010-04-06
Posts: 55

clouds.png is not needed, I am not totally sure but I think the only needed ones are land graphics and flakes.

One of those hedgewars developers. I am specially knowledgeable in lua scripting, and the father of gameplay scripts.

mrboese
User offline. Last seen 6 years 32 weeks ago. Offline
Joined: 2010-12-27
Posts: 22

Quote:
clouds.png is not needed

It's necessary - Not for the game, but for the editor.
If there're any default images available (in the HW-Graphics-folder), the editor will use it automatically.

And: I think that this is not too fatal, if there're any unnecessary images Wink Smiley

Henek
Henek's picture
User offline. Last seen 5 years 41 weeks ago. Offline
Joined: 2010-04-06
Posts: 55

If the theme is to be included in Hedgewars, then it may not include duplicates of a default image. And as of that it is a good practice not to have them in unofficial themes.

One of those hedgewars developers. I am specially knowledgeable in lua scripting, and the father of gameplay scripts.

mrboese
User offline. Last seen 6 years 32 weeks ago. Offline
Joined: 2010-12-27
Posts: 22

Why don't you want unnecessary images in the exported folder so badly? I don't understand this.

But I'm working on it: The ImageEditorControl will not copy the images to the folder, if they aren't necessary. If you click "edit", the ImageEditor will create the file.
You will be able to keep the old behaviour (It can be turned on in the "options" menu)

mrboese
User offline. Last seen 6 years 32 weeks ago. Offline
Joined: 2010-12-27
Posts: 22

I finished version 1.5.

Now, you can disable the copying of unnecessary files and some other things has been improved, too.

Download and changelog at:
http://tilegame.bplaced.net/HWThemeEdit/

  /// 
        /// Keep 1024 borders
        /// resize, keeping aspect ratio
        /// 
        /// 
        public Image ReturnResized()
        {
            if (PreviewImage.Width > 1024 || PreviewImage.Height > 1024)
            {
                if (PreviewImage.Width == PreviewImage.Height)
                {
                    return new Bitmap(PreviewImage, new Size(1024, 1024));
                }
                else
                {
                    float max = Math.Max(PreviewImage.Width, PreviewImage.Height);
                    float percent = 1024f / max;

                    int width = (int)(PreviewImage.Width * percent);
                    int height = (int)(PreviewImage.Height * percent);

                    if (width > 1024)
                        width = 1024;
                    if (height > 1024)
                        height = 1024;

                    return new Bitmap(PreviewImage, new Size(width, height));
                }
            }

            return PreviewImage;
        }

        public void Export(string folder, bool ToHW)
        {
            if (File.Exists(ImageFile))
            {
                //Export to the "export" folder
                string exportfolder = ThemeDocument.LastInstance.Folder + "\\Export";
                string exportedbitmap_lowres = Path.GetFileNameWithoutExtension(ImageFile) + "-lowres.png";
                string exportedbitmap = Path.GetFileName(ImageFile);


                if (AllowGreaterThan1024)
                {
                    //Low Res if available
                    var lowres = ReturnResized();
                    var highres = PreviewImage;

                    //Export lowres
                    if (lowres != PreviewImage)
                    {
                        ExportBitmap(lowres, exportedbitmap_lowres, folder, ToHW);
                    }

                    //Export HighRes
                    ExportBitmap(highres, exportedbitmap, folder, ToHW);
                }
                else
                {
                    var lowres = ReturnResized();
                    ExportBitmap(lowres, exportedbitmap, folder, ToHW);
                }
            }
        }

        public static void ExportBitmap(Image bit, string fileName, string hwdirectory, bool allowhw)
        {
            //Export to Exported folder
            bit.Save(ThemeDocument.LastInstance.Folder + "\\Export\\" + fileName);

            //if HW, the export there
            if (allowhw)
            {
                bit.Save(hwdirectory.TrimEnd('\\') + "\\" + fileName);
            }
        }

jenrique1603
jenrique1603's picture
User offline. Last seen 12 years 47 weeks ago. Offline
Joined: 2011-02-18
Posts: 3

una pregunta,como cambiar el formato del tema de (XML) a (CFG) ayuda porfavor! Geek

doomy
doomy's picture
User offline. Last seen 1 day 7 hours ago. Offline
Joined: 2011-01-16
Posts: 132

Wine(AKA Windows Program Loader)doesn't seem to work for this Annoyed
Are you planning on making one for linux?

mrboese
User offline. Last seen 6 years 32 weeks ago. Offline
Joined: 2010-12-27
Posts: 22

@doomy:
That's a .NET/MONO program. You can install MONO on Linux or Mac to use this program.

@jenrique1603:
1. Please write on english.
2. There should be an option like "export" (or something similar).

doomy
doomy's picture
User offline. Last seen 1 day 7 hours ago. Offline
Joined: 2011-01-16
Posts: 132

thanks!

mrboese
User offline. Last seen 6 years 32 weeks ago. Offline
Joined: 2010-12-27
Posts: 22

New version available on https://sourceforge.net/projects/hwthemeedit/files/

Added: Support for "Chunk.png"

Copyright © 2004-2023 Hedgewars Project. All rights reserved. [ contact ]