diff --git a/core/config.d b/core/config.d index 8c0f877e4..ae07e6100 100644 --- a/core/config.d +++ b/core/config.d @@ -90,6 +90,7 @@ struct ConfigManager char[] esmDir; char[] bsaDir; char[] sndDir; + char[] fontDir; char[] musDir; // Explore music char[] musDir2; // Battle music @@ -266,6 +267,7 @@ struct ConfigManager bsaDir = dataDir; esmDir = dataDir; sndDir = dataDir ~ "Sound/"; + fontDir = dataDir ~ "Fonts/"; musDir = dataDir ~ "Music/Explore/"; musDir2 = dataDir ~ "Music/Battle/"; diff --git a/fonts/fntfile.d b/fonts/fntfile.d deleted file mode 100644 index 798095374..000000000 --- a/fonts/fntfile.d +++ /dev/null @@ -1,146 +0,0 @@ - -/* - Font loader for the Morrowind .FNT/.TEX font file pair. The current - code has just been used for testing purposes and to decode the file - format. To make it work with MyGUI, we will have to cooperate with a - custom sub-class of the MyGUI::Font class in C++. - */ -module fonts.fntfile; - -import std.stream; - -import monster.util.string; - -align(1) -struct FntEntry -{ - // Positions, as fractions of the entire texture surface. The - // xstart2 etc values are just repeated information. The reason for - // this is that the characters are stored as four points, with an - // (x,y) coordinate each. Since all the rectangles are aligned with - // the image however, this is pretty redundant information. - - float xstart, ystart; - float xend; - float ystart2, xstart2; - float yend; - float xend2, yend2; - - float width; - float height; - int zero1; // Empty heigth? (always zero) - float emptyWidth; // Width for empty characters - float unk2; // Vertical displacement? - int zero2; // Horizontal displacement? - - bool isUsed() { return width != 0; } -} -static assert(FntEntry.sizeof == 56); - -align(1) -struct FntFile -{ - float size; - int unk2, unk3; - char[128] texname; - - ubyte[160] filler; // Makes the header exactly 300 bytes long - - FntEntry[255] chars; -} - -align(1) -union Color -{ - ubyte[4] rgba; - uint val; -} -static assert(Color.sizeof == 4); - -// One character -struct Char -{ - Color[][] pixels; - bool isUsed; - int width, height; - char chr; -} - -FntFile fnt; -Char[255] chars; - -// Load a fnt-file -void loadFont(char[] fntFile) -{ - assert(iEnds(fntFile, ".fnt"), - "loadFont() can only load .fnt files"); - - File s = new File(fntFile); - s.readExact(&fnt, fnt.sizeof); - s.close(); - - // Load the .tex file - int texWidth, texHeight; - char[] tfile = stripz(fnt.texname)~".tex"; - // DIRTY hack since we can't do case-insensitive file searching yet - if(tfile[0] == 'D') tfile[0] = 'd'; - s.open(tfile); - s.read(texWidth); - s.read(texHeight); - assert(s.size() == 4*(texWidth*texHeight + 2)); - - ubyte[] buf; - buf.length = s.size - s.position; - s.readExact(buf.ptr, buf.length); - delete s; - - // Get the pixel buffer as a series of ints - uint[] pixelBuf = cast(uint[]) buf; - - foreach(i, ch; fnt.chars) - with(chars[i]) - { - // Store the char, if it is printable - if(i > 33 && i < 127) - chr = i; - else chr = ' '; - - // Store the pixel dimensions - isUsed = ch.isUsed; - height = cast(int)ch.height; - if(isUsed) - width = cast(int)ch.width; - else - width = cast(int)ch.emptyWidth; - - assert(ch.emptyWidth == 0 || ch.emptyWidth == -1 || !isUsed); - assert(ch.zero1 == 0); - assert(ch.zero2 == 0); - assert(ch.xstart2 == ch.xstart); - assert(ch.ystart2 == ch.ystart); - assert(ch.xend2 == ch.xend); - assert(ch.yend2 == ch.yend); - - // If the character is not present, skip to the next one now. - if(!isUsed) continue; - - // Get the pixel coordinates of this character - int startX = cast(int) (ch.xstart * texWidth); - int startY = cast(int) (ch.ystart * texHeight); - int endX = cast(int) (ch.xend * texWidth); - int endY = cast(int) (ch.yend * texHeight); - - assert(endX-startX == width); - assert(endY-startY == height); - - // Set up the pixel array - pixels.length = height; - foreach(line, ref slice; pixels) - { - // First pixel in the line - int strt = texWidth*(startY+line) + startX; - // Get a slice of the pixel data - slice = cast(Color[])pixelBuf[strt..strt+width]; - } - } -} diff --git a/MyGUI_Media/Comic.TTF b/media_mygui/Comic.TTF similarity index 100% rename from MyGUI_Media/Comic.TTF rename to media_mygui/Comic.TTF diff --git a/MyGUI_Media/black.png b/media_mygui/black.png similarity index 100% rename from MyGUI_Media/black.png rename to media_mygui/black.png diff --git a/MyGUI_Media/core.font b/media_mygui/core.font similarity index 80% rename from MyGUI_Media/core.font rename to media_mygui/core.font index 36da17b0a..3ff0c3be6 100644 --- a/MyGUI_Media/core.font +++ b/media_mygui/core.font @@ -1,7 +1,7 @@  - + diff --git a/MyGUI_Media/core.lang b/media_mygui/core.lang similarity index 100% rename from MyGUI_Media/core.lang rename to media_mygui/core.lang diff --git a/MyGUI_Media/core.layer b/media_mygui/core.layer similarity index 100% rename from MyGUI_Media/core.layer rename to media_mygui/core.layer diff --git a/MyGUI_Media/core.png b/media_mygui/core.png similarity index 100% rename from MyGUI_Media/core.png rename to media_mygui/core.png diff --git a/MyGUI_Media/core.pointer b/media_mygui/core.pointer similarity index 100% rename from MyGUI_Media/core.pointer rename to media_mygui/core.pointer diff --git a/MyGUI_Media/core.skin b/media_mygui/core.skin similarity index 100% rename from MyGUI_Media/core.skin rename to media_mygui/core.skin diff --git a/MyGUI_Media/core.xml b/media_mygui/core.xml similarity index 67% rename from MyGUI_Media/core.xml rename to media_mygui/core.xml index ee4c539f5..f7439be0b 100644 --- a/MyGUI_Media/core.xml +++ b/media_mygui/core.xml @@ -7,10 +7,12 @@ - + + + diff --git a/media_mygui/mwpointer.png b/media_mygui/mwpointer.png new file mode 100644 index 000000000..90bc19b5e Binary files /dev/null and b/media_mygui/mwpointer.png differ diff --git a/media_mygui/openmw.font b/media_mygui/openmw.font new file mode 100644 index 000000000..9baccc7c5 --- /dev/null +++ b/media_mygui/openmw.font @@ -0,0 +1,43 @@ + + + + + diff --git a/media_mygui/openmw.pointer b/media_mygui/openmw.pointer new file mode 100644 index 000000000..0d77c878d --- /dev/null +++ b/media_mygui/openmw.pointer @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/media_mygui/openmw_button.skin b/media_mygui/openmw_button.skin new file mode 100644 index 000000000..036202485 --- /dev/null +++ b/media_mygui/openmw_button.skin @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MyGUI_Media/openmw_windows.skin b/media_mygui/openmw_windows.skin similarity index 68% rename from MyGUI_Media/openmw_windows.skin rename to media_mygui/openmw_windows.skin index 769f428f1..10ea2bec9 100644 --- a/MyGUI_Media/openmw_windows.skin +++ b/media_mygui/openmw_windows.skin @@ -10,28 +10,28 @@ - + - + - + - + @@ -39,30 +39,73 @@ - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -116,20 +159,24 @@ - - - - - - - - - + + + + + + + + + - + @@ -141,22 +188,28 @@ - - - - - - + + + + + + + + - + - + @@ -187,6 +240,14 @@ + + + + + + + + @@ -202,13 +263,9 @@ - -