forked from teamnwah/openmw-tes3coop
More work on the GUI. Tried (and failed) to make the fonts work.
git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@85 ea6a568a-9f4f-0410-981a-c910a81bb256
This commit is contained in:
parent
17a2c67d26
commit
fdf9da706f
21 changed files with 280 additions and 237 deletions
|
@ -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/";
|
||||
|
||||
|
|
146
fonts/fntfile.d
146
fonts/fntfile.d
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 103 B After Width: | Height: | Size: 103 B |
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<MyGUI type="Font">
|
||||
<Font name="MyGUI_CoreFont.18" source="Comic.TTF" size="18" resolution="72" antialias_colour="false" space_width="a" tab_count="4" spacer="5">
|
||||
<Font name="MyGUI_CoreFont.18" source="Comic.TTF" size="18" resolution="72" antialias_colour="false" space_width="4" tab_count="4" spacer="5">
|
||||
<Code range="33 126"/>
|
||||
<Code range="1025 1105"/>
|
||||
<Code range="8470 8470" help="№"/>
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
|
@ -7,10 +7,12 @@
|
|||
<List file="core.layer" group="General"/>
|
||||
<List file="core.skin" group="General"/>
|
||||
<List file="core.font" group="General"/>
|
||||
<List file="core.pointer" group="General"/>
|
||||
<List file="core.plugin"/>
|
||||
|
||||
<List file="openmw.pointer" group="General"/>
|
||||
<List file="openmw_windows.skin" group="General"/>
|
||||
<List file="openmw_button.skin" group="General"/>
|
||||
<List file="openmw.font" group="General"/>
|
||||
</MyGUI>
|
||||
|
||||
</MyGUI>
|
BIN
media_mygui/mwpointer.png
Normal file
BIN
media_mygui/mwpointer.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
43
media_mygui/openmw.font
Normal file
43
media_mygui/openmw.font
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<MyGUI type="Font">
|
||||
<!--
|
||||
<Font name="gothic" source="gothic.ttf" size="18" resolution="72" antialias_colour="false" space_width="4" tab_count="4" spacer="5">
|
||||
<Code range="33 126"/>
|
||||
<Code range="1025 1105"/>
|
||||
<Code range="8470 8470" help="№"/>
|
||||
<Code hide="128"/>
|
||||
<Code hide="1026 1039"/>
|
||||
<Code hide="1104"/>
|
||||
</Font>
|
||||
|
||||
<Font name="daedric" source="daedric.ttf" size="18" resolution="72" antialias_colour="false" space_width="4" tab_count="4" spacer="5">
|
||||
<Code range="33 98"/>
|
||||
<Code hide="128"/>
|
||||
<Code hide="1026 1039"/>
|
||||
<Code hide="1104"/>
|
||||
</Font>
|
||||
|
||||
<Font name="cards" default_height="17" source="magiccards.ttf" size="18" resolution="50" antialias_colour="false" space_width="4" tab_width="8" cursor_width="2" distance="5" offset_height="0">
|
||||
<Code range="33 98"/>
|
||||
</Font>
|
||||
|
||||
<Font name="dorcla" source="dorcla.ttf" size="20" resolution="72" antialias_colour="false" space_width="5" tab_count="4" spacer="5">
|
||||
<Code range="33 126"/>
|
||||
<Code range="1025 1105"/>
|
||||
<Code range="8470 8470" help="№"/>
|
||||
<Code hide="128"/>
|
||||
<Code hide="1026 1039"/>
|
||||
<Code hide="1104"/>
|
||||
</Font>
|
||||
|
||||
<Font name="perrygot" source="perrygot.ttf" size="16" resolution="72" antialias_colour="false" space_width="4" tab_count="4" spacer="5">
|
||||
<Code range="33 126"/>
|
||||
<Code range="1025 1105"/>
|
||||
<Code range="8470 8470" help="№"/>
|
||||
<Code hide="128"/>
|
||||
<Code hide="1026 1039"/>
|
||||
<Code hide="1104"/>
|
||||
</Font>
|
||||
-->
|
||||
</MyGUI>
|
13
media_mygui/openmw.pointer
Normal file
13
media_mygui/openmw.pointer
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<MyGUI type="Pointer">
|
||||
|
||||
<Pointer layer="Pointer" texture="mwpointer.png" default="arrow">
|
||||
<Info name="arrow" point="7 0" size="32 32" offset="0 0 32 32"/>
|
||||
<Info name="hresize" point="16 14" size="32 32" offset="32 0 32 32"/>
|
||||
<Info name="vresize" point="17 16" size="32 32" offset="0 32 32 32"/>
|
||||
<Info name="dresize" point="17 15" size="32 32" offset="32 32 32 32"/>
|
||||
<Info name="dresize2" point="15 15" size="32 32" offset="64 32 32 32"/>
|
||||
</Pointer>
|
||||
|
||||
</MyGUI>
|
71
media_mygui/openmw_button.skin
Normal file
71
media_mygui/openmw_button.skin
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<MyGUI type="Skin">
|
||||
<!-- Button graphics -->
|
||||
<Skin name="BTN_Top" size="128 4" texture="menu_button_frame_top.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 128 4">
|
||||
<State name="normal" offset = "0 0 128 4"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="BTN_Bottom" size="128 4" texture="menu_button_frame_bottom.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 128 4">
|
||||
<State name="normal" offset = "0 0 128 4"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="BTN_Left" size="4 16" texture="menu_button_frame_left.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 4 16">
|
||||
<State name="normal" offset = "0 0 4 16"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="BTN_Right" size="4 16" texture="menu_button_frame_right.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 4 16">
|
||||
<State name="normal" offset = "0 0 4 16"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="BTN_TopLeft" size="4 4" texture="menu_button_frame_top_left_corner.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 4 4">
|
||||
<State name="normal" offset = "0 0 4 4"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="BTN_TopRight" size="4 4" texture="menu_button_frame_top_right_corner.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 4 4">
|
||||
<State name="normal" offset = "0 0 4 4"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="BTN_BottomLeft" size="4 4" texture="menu_button_frame_bottom_left_corner.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 4 4">
|
||||
<State name="normal" offset = "0 0 4 4"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="BTN_BottomRight" size="4 4" texture="menu_button_frame_bottom_right_corner.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 4 4">
|
||||
<State name="normal" offset = "0 0 4 4"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
|
||||
<!-- Button widget -->
|
||||
<Skin name="MW_Button" size="136 24">
|
||||
<Property key="FontName" value = "MyGUI_CoreFont.18" />
|
||||
<!--Property key="FontName" value = "cards" /-->
|
||||
<Property key="FontHeight" value = "18" />
|
||||
<Property key="AlignText" value = "ALIGN_CENTER" />
|
||||
<Property key="Colour" value = "0.6 0.6 0.6" />
|
||||
|
||||
<Child type="Widget" skin="BTN_Left" offset="0 4 4 16" align="ALIGN_VSTRETCH ALIGN_LEFT"/>
|
||||
<Child type="Widget" skin="BTN_Right" offset="132 4 4 16" align="ALIGN_VSTRETCH ALIGN_RIGHT"/>
|
||||
<Child type="Widget" skin="BTN_Top" offset="4 0 128 4" align="ALIGN_HSTRETCH ALIGN_TOP"/>
|
||||
<Child type="Widget" skin="BTN_Bottom" offset="4 20 128 4" align="ALIGN_HSTRETCH ALIGN_BOTTOM"/>
|
||||
<Child type="Widget" skin="BTN_TopLeft" offset="0 0 4 4" align="ALIGN_TOP ALIGN_LEFT"/>
|
||||
<Child type="Widget" skin="BTN_TopRight" offset="132 0 4 4" align="ALIGN_TOP ALIGN_RIGHT"/>
|
||||
<Child type="Widget" skin="BTN_BottomLeft" offset="0 20 4 4" align="ALIGN_BOTTOM ALIGN_LEFT"/>
|
||||
<Child type="Widget" skin="BTN_BottomRight" offset="132 20 4 4" align="ALIGN_BOTTOM ALIGN_RIGHT"/>
|
||||
|
||||
<BasisSkin type="SimpleText" offset = "4 4 128 16" align = "ALIGN_STRETCH">
|
||||
<!--State name="disable" colour="0.87 0.87 0.87"/-->
|
||||
<!--State name="normal" colour="0 0 0"/-->
|
||||
<State name="active" colour="FF0000"/>
|
||||
<State name="pressed" colour="0000FF"/>
|
||||
<State name="select" colour="00FF00"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
</MyGUI>
|
|
@ -10,28 +10,28 @@
|
|||
|
||||
<!-- These define the window borders -->
|
||||
<Skin name="TB_B" size="512 4" texture="menu_thick_border_bottom.dds">
|
||||
<Property key="Pointer" value = "size_left" />
|
||||
<Property key="Pointer" value = "vresize" />
|
||||
<BasisSkin type="MainSkin" offset = "0 0 512 4">
|
||||
<State name="normal" offset = "0 0 512 4"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
|
||||
<Skin name="TB_R" size="4 512" texture="menu_thick_border_right.dds">
|
||||
<Property key="Pointer" value = "size_left" />
|
||||
<Property key="Pointer" value = "hresize" />
|
||||
<BasisSkin type="MainSkin" offset = "0 0 4 512">
|
||||
<State name="normal" offset = "0 0 4 512"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
|
||||
<Skin name="TB_T" size="512 4" texture="menu_thick_border_top.dds">
|
||||
<Property key="Pointer" value = "size_left" />
|
||||
<Property key="Pointer" value = "vresize" />
|
||||
<BasisSkin type="MainSkin" offset = "0 0 512 4">
|
||||
<State name="normal" offset = "0 0 512 4"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
|
||||
<Skin name="TB_L" size="4 512" texture="menu_thick_border_left.dds">
|
||||
<Property key="Pointer" value = "size_left" />
|
||||
<Property key="Pointer" value = "hresize" />
|
||||
<BasisSkin type="MainSkin" offset = "0 0 4 512">
|
||||
<State name="normal" offset = "0 0 4 512"/>
|
||||
</BasisSkin>
|
||||
|
@ -39,30 +39,73 @@
|
|||
|
||||
<!-- Window border corners -->
|
||||
<Skin name="TB_BR" size="4 4" texture="menu_thick_border_bottom_right_corner.dds">
|
||||
<Property key="Pointer" value = "size_left" />
|
||||
<Property key="Pointer" value = "dresize" />
|
||||
<BasisSkin type="MainSkin" offset = "0 0 4 4">
|
||||
<State name="normal" offset = "0 0 4 4"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="TB_BL" size="4 4" texture="menu_thick_border_bottom_left_corner.dds">
|
||||
<Property key="Pointer" value = "size_left" />
|
||||
<Property key="Pointer" value = "dresize2" />
|
||||
<BasisSkin type="MainSkin" offset = "0 0 4 4">
|
||||
<State name="normal" offset = "0 0 4 4"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="TB_TR" size="4 4" texture="menu_thick_border_top_right_corner.dds">
|
||||
<Property key="Pointer" value = "size_left" />
|
||||
<Property key="Pointer" value = "dresize2" />
|
||||
<BasisSkin type="MainSkin" offset = "0 0 4 4">
|
||||
<State name="normal" offset = "0 0 4 4"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="TB_TL" size="4 4" texture="menu_thick_border_top_left_corner.dds">
|
||||
<Property key="Pointer" value = "size_left" />
|
||||
<Property key="Pointer" value = "dresize" />
|
||||
<BasisSkin type="MainSkin" offset = "0 0 4 4">
|
||||
<State name="normal" offset = "0 0 4 4"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
|
||||
<!-- Inner borders -->
|
||||
|
||||
<Skin name="IB_T" size="512 2" texture="menu_thin_border_top.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 512 2">
|
||||
<State name="normal" offset = "0 0 512 2"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="IB_B" size="512 2" texture="menu_thin_border_bottom.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 512 2">
|
||||
<State name="normal" offset = "0 0 512 2"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="IB_L" size="2 512" texture="menu_thin_border_left.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 2 512">
|
||||
<State name="normal" offset = "0 0 2 512"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="IB_R" size="2 512" texture="menu_thin_border_right.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 2 512">
|
||||
<State name="normal" offset = "0 0 2 512"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="IB_TL" size="2 2" texture="menu_thin_border_top_left_corner.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 2 2">
|
||||
<State name="normal" offset = "0 0 2 2"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="IB_TR" size="2 2" texture="menu_thin_border_top_right_corner.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 2 2">
|
||||
<State name="normal" offset = "0 0 2 2"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="IB_BL" size="2 2" texture="menu_thin_border_bottom_left_corner.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 2 2">
|
||||
<State name="normal" offset = "0 0 2 2"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="IB_BR" size="2 2" texture="menu_thin_border_bottom_right_corner.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 2 2">
|
||||
<State name="normal" offset = "0 0 2 2"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
|
||||
<!-- These parts defines the 'blocks' to the left and right of the caption -->
|
||||
<Skin name="HB_MID" size="256 16" texture="menu_head_block_middle.dds">
|
||||
<BasisSkin type="MainSkin" offset = "0 0 256 16">
|
||||
|
@ -116,20 +159,24 @@
|
|||
</Skin>
|
||||
|
||||
<Skin name="HB_ALL" size="260 20">
|
||||
<Child type="Widget" skin="HB_MID" offset="2 2 256 16" align="ALIGN_TOP ALIGN_HSTRETCH"></Child>
|
||||
<Child type="Widget" skin="HB_TOP" offset="2 0 256 2" align="ALIGN_TOP ALIGN_HSTRETCH"></Child>
|
||||
<Child type="Widget" skin="HB_BOTTOM" offset="2 18 256 2" align="ALIGN_BOTTOM ALIGN_HSTRETCH"></Child>
|
||||
<Child type="Widget" skin="HB_LEFT" offset="0 2 2 16" align="ALIGN_TOP ALIGN_LEFT"></Child>
|
||||
<Child type="Widget" skin="HB_RIGHT" offset="258 2 2 16" align="ALIGN_TOP ALIGN_RIGHT"></Child>
|
||||
<Child type="Widget" skin="HB_TR" offset="258 0 2 2" align="ALIGN_TOP ALIGN_RIGHT"></Child>
|
||||
<Child type="Widget" skin="HB_TL" offset="0 0 2 2" align="ALIGN_TOP ALIGN_LEFT"></Child>
|
||||
<Child type="Widget" skin="HB_BR" offset="258 18 2 2" align="ALIGN_BOTTOM ALIGN_RIGHT"></Child>
|
||||
<Child type="Widget" skin="HB_BL" offset="0 18 2 2" align="ALIGN_BOTTOM ALIGN_LEFT"></Child>
|
||||
<Child type="Widget" skin="HB_MID" offset="2 2 256 16" align="ALIGN_TOP ALIGN_HSTRETCH"/>
|
||||
<Child type="Widget" skin="HB_TOP" offset="2 0 256 2" align="ALIGN_TOP ALIGN_HSTRETCH"/>
|
||||
<Child type="Widget" skin="HB_BOTTOM" offset="2 18 256 2" align="ALIGN_BOTTOM ALIGN_HSTRETCH"/>
|
||||
<Child type="Widget" skin="HB_LEFT" offset="0 2 2 16" align="ALIGN_TOP ALIGN_LEFT"/>
|
||||
<Child type="Widget" skin="HB_RIGHT" offset="258 2 2 16" align="ALIGN_TOP ALIGN_RIGHT"/>
|
||||
<Child type="Widget" skin="HB_TR" offset="258 0 2 2" align="ALIGN_TOP ALIGN_RIGHT"/>
|
||||
<Child type="Widget" skin="HB_TL" offset="0 0 2 2" align="ALIGN_TOP ALIGN_LEFT"/>
|
||||
<Child type="Widget" skin="HB_BR" offset="258 18 2 2" align="ALIGN_BOTTOM ALIGN_RIGHT"/>
|
||||
<Child type="Widget" skin="HB_BL" offset="0 18 2 2" align="ALIGN_BOTTOM ALIGN_LEFT"/>
|
||||
</Skin>
|
||||
|
||||
<!-- The actual caption. It contains the edges of each of the blocks on
|
||||
<!-- The actual caption. It contains the edges of the blocks on
|
||||
its sides as well -->
|
||||
<Skin name = "MW_Caption" size = "88 20" texture = "black.png" >
|
||||
<!--
|
||||
<Property key="FontName" value = "dorcla" />
|
||||
<Property key="FontHeight" value = "20" />
|
||||
-->
|
||||
<Property key="FontName" value = "MyGUI_CoreFont.18" />
|
||||
<Property key="FontHeight" value = "18" />
|
||||
<Property key="AlignText" value = "ALIGN_CENTER" />
|
||||
|
@ -141,22 +188,28 @@
|
|||
<BasisSkin type="SimpleText" offset = "2 0 84 20" align = "ALIGN_STRETCH"/>
|
||||
|
||||
<!-- Add the borders of the surrounding blocks -->
|
||||
<Child type="Widget" skin="HB_LEFT" offset="86 2 2 16" align="ALIGN_TOP ALIGN_RIGHT"></Child>
|
||||
<Child type="Widget" skin="HB_RIGHT" offset="0 2 2 16" align="ALIGN_TOP ALIGN_LEFT"></Child>
|
||||
<Child type="Widget" skin="HB_TR" offset="0 0 2 2" align="ALIGN_TOP ALIGN_LEFT"></Child>
|
||||
<Child type="Widget" skin="HB_TL" offset="86 0 2 2" align="ALIGN_TOP ALIGN_RIGHT"></Child>
|
||||
<Child type="Widget" skin="HB_BR" offset="0 18 2 2" align="ALIGN_BOTTOM ALIGN_LEFT"></Child>
|
||||
<Child type="Widget" skin="HB_BL" offset="86 18 2 2" align="ALIGN_BOTTOM ALIGN_RIGHT"></Child>
|
||||
<Child type="Widget" skin="HB_LEFT" offset="86 2 2 16" align="ALIGN_TOP ALIGN_RIGHT"/>
|
||||
<Child type="Widget" skin="HB_RIGHT" offset="0 2 2 16" align="ALIGN_TOP ALIGN_LEFT"/>
|
||||
<Child type="Widget" skin="HB_TR" offset="0 0 2 2" align="ALIGN_TOP ALIGN_LEFT"/>
|
||||
<Child type="Widget" skin="HB_TL" offset="86 0 2 2" align="ALIGN_TOP ALIGN_RIGHT"/>
|
||||
<Child type="Widget" skin="HB_BR" offset="0 18 2 2" align="ALIGN_BOTTOM ALIGN_LEFT"/>
|
||||
<Child type="Widget" skin="HB_BL" offset="86 18 2 2" align="ALIGN_BOTTOM ALIGN_RIGHT"/>
|
||||
</Skin>
|
||||
|
||||
<!-- ----------------------------------------------------
|
||||
|
||||
WINDOW DEFINITION
|
||||
|
||||
------------------------------------------------------ -->
|
||||
|
||||
<Skin name = "MW_Window" size = "256 54">
|
||||
<Property key="FontName" value = "MyGUI_CoreFont.18" />
|
||||
<Property key="FontHeight" value = "18" />
|
||||
<Property key="AlignText" value = "ALIGN_CENTER" />
|
||||
<Property key="Colour" value = "0 0 0" />
|
||||
<Property key="Colour" value = "0.8 0.8 0.8" />
|
||||
<Property key="ToStick" value = "true" />
|
||||
|
||||
<Child type="Widget" skin="MW_WindowBG" offset = "4 24 248 26" align = "ALIGN_STRETCH" name = "Client">
|
||||
<Child type="Widget" skin="MW_WindowBG" offset = "6 26 244 22" align = "ALIGN_STRETCH" name = "Client">
|
||||
</Child>
|
||||
|
||||
<!-- Outer orders -->
|
||||
|
@ -187,6 +240,14 @@
|
|||
</Child>
|
||||
|
||||
<!-- Inner borders -->
|
||||
<Child type="Widget" skin="IB_T" offset="6 24 244 2" align="ALIGN_TOP ALIGN_HSTRETCH"/>
|
||||
<Child type="Widget" skin="IB_B" offset="6 48 244 2" align="ALIGN_BOTTOM ALIGN_HSTRETCH"/>
|
||||
<Child type="Widget" skin="IB_L" offset="4 26 2 22" align="ALIGN_LEFT ALIGN_VSTRETCH"/>
|
||||
<Child type="Widget" skin="IB_R" offset="250 26 2 22" align="ALIGN_RIGHT ALIGN_VSTRETCH"/>
|
||||
<Child type="Widget" skin="IB_TL" offset="4 24 2 2" align="ALIGN_TOP ALIGN_LEFT"/>
|
||||
<Child type="Widget" skin="IB_TR" offset="250 24 2 2" align="ALIGN_TOP ALIGN_RIGHT"/>
|
||||
<Child type="Widget" skin="IB_BL" offset="4 48 2 2" align="ALIGN_BOTTOM ALIGN_LEFT"/>
|
||||
<Child type="Widget" skin="IB_BR" offset="250 48 2 2" align="ALIGN_BOTTOM ALIGN_RIGHT"/>
|
||||
|
||||
<!-- Caption -->
|
||||
<Child type="Widget" skin="HB_ALL" offset="4 4 248 20" align = "ALIGN_TOP ALIGN_HSTRETCH">
|
||||
|
@ -202,13 +263,9 @@
|
|||
<Property key="Scale" value = "1 1 0 0"/>
|
||||
</Child>
|
||||
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<Child type="Button" skin="WindowCaption" offset = "5 50 10 30" align = "ALIGN_HSTRETCH ALIGN_TOP" name = "Caption">
|
||||
<Property key="Scale" value = "1 1 0 0"/>
|
||||
</Child>
|
||||
<!-- Leftover code - remove later
|
||||
<Child type="Button" skin="WindowX" offset = "20 80 24 30" align = "ALIGN_LEFT ALIGN_TOP" name = "Button">
|
||||
<Property key="Event" value = "close"/>
|
||||
</Child>
|
|
@ -26,3 +26,6 @@ class InventoryItem : GameObject;
|
|||
float weight;
|
||||
int value;
|
||||
|
||||
// Reference to current container. Player / NPC inventories are also
|
||||
// containers. Not used yet.
|
||||
Container holder;
|
||||
|
|
|
@ -160,5 +160,10 @@ void ogre_getCameraPos(float *x, float *y, float *z);
|
|||
void ogre_getCameraOrientation(float *fx, float *fy, float *fz, float *ux, float *uy, float *uz);
|
||||
void ogre_moveCameraRel(float x, float y, float z);
|
||||
|
||||
// Insert a raw RGBA image into the texture system.
|
||||
//void ogre_insertTexture(char *name, int width, int height, void *data);
|
||||
|
||||
void gui_setupGUI();
|
||||
|
||||
// Test
|
||||
void gui_setFpsText(char *str);
|
||||
|
|
|
@ -203,9 +203,6 @@ extern "C" void ogre_makeScene()
|
|||
g_light->setDiffuseColour(1,0.7,0.3);
|
||||
g_light->setAttenuation(2000, 0, 0.008, 0);
|
||||
*/
|
||||
|
||||
// Finally, set up the GUI
|
||||
setupGUI();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -694,6 +691,35 @@ extern "C" SceneNode* ogre_createNode(
|
|||
|
||||
/* Code currently not in use
|
||||
|
||||
// Insert a raw RGBA image into the texture system.
|
||||
extern "C" void ogre_insertTexture(char* name, uint32_t width, uint32_t height, void *data)
|
||||
{
|
||||
TexturePtr texture = TextureManager::getSingleton().createManual(
|
||||
name, // name
|
||||
"General", // group
|
||||
TEX_TYPE_2D, // type
|
||||
width, height, // width & height
|
||||
0, // number of mipmaps
|
||||
PF_BYTE_RGBA, // pixel format
|
||||
TU_DEFAULT); // usage; should be TU_DYNAMIC_WRITE_ONLY_DISCARDABLE for
|
||||
// textures updated very often (e.g. each frame)
|
||||
|
||||
// Get the pixel buffer
|
||||
HardwarePixelBufferSharedPtr pixelBuffer = texture->getBuffer();
|
||||
|
||||
// Lock the pixel buffer and get a pixel box
|
||||
pixelBuffer->lock(HardwareBuffer::HBL_NORMAL); // for best performance use HBL_DISCARD!
|
||||
const PixelBox& pixelBox = pixelBuffer->getCurrentLock();
|
||||
|
||||
void *dest = pixelBox.data;
|
||||
|
||||
// Copy the data
|
||||
memcpy(dest, data, width*height*4);
|
||||
|
||||
// Unlock the pixel buffer
|
||||
pixelBuffer->unlock();
|
||||
}
|
||||
|
||||
// We need this later for animated meshes.
|
||||
extern "C" void* ogre_setupSkeleton(char* name)
|
||||
{
|
||||
|
@ -708,51 +734,6 @@ extern "C" void* ogre_setupSkeleton(char* name)
|
|||
return (void*)skel->createBone();
|
||||
}
|
||||
|
||||
// Use this later when loading textures directly from NIF files
|
||||
extern "C" void ogre_createTexture(char* name, uint32_t width, uint32_t height)
|
||||
{
|
||||
TexturePtr texture = TextureManager::getSingleton().createManual(
|
||||
name, // name
|
||||
"ManualTexture", // group
|
||||
TEX_TYPE_2D, // type
|
||||
width, hight, // width & height
|
||||
0, // number of mipmaps
|
||||
PF_BYTE_BGRA, // pixel format
|
||||
TU_DEFAULT); // usage; should be TU_DYNAMIC_WRITE_ONLY_DISCARDABLE for
|
||||
// textures updated very often (e.g. each frame)
|
||||
|
||||
// Get the pixel buffer
|
||||
HardwarePixelBufferSharedPtr pixelBuffer = texture->getBuffer();
|
||||
|
||||
// Lock the pixel buffer and get a pixel box
|
||||
pixelBuffer->lock(HardwareBuffer::HBL_NORMAL); // for best performance use HBL_DISCARD!
|
||||
const PixelBox& pixelBox = pixelBuffer->getCurrentLock();
|
||||
|
||||
uint8* pDest = static_cast<uint8*>(pixelBox.data);
|
||||
|
||||
// Fill in some pixel data. This will give a semi-transparent blue,
|
||||
// but this is of course dependent on the chosen pixel format.
|
||||
for (size_t j = 0; j < 256; j++)
|
||||
for(size_t i = 0; i < 256; i++)
|
||||
{
|
||||
*pDest++ = 255; // B
|
||||
*pDest++ = 0; // G
|
||||
*pDest++ = 0; // R
|
||||
*pDest++ = 127; // A
|
||||
}
|
||||
|
||||
// Unlock the pixel buffer
|
||||
pixelBuffer->unlock();
|
||||
|
||||
// Create a material using the texture
|
||||
MaterialPtr material = MaterialManager::getSingleton().create(
|
||||
"DynamicTextureMaterial", // name
|
||||
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
|
||||
|
||||
material->getTechnique(0)->getPass(0)->createTextureUnitState("DynamicTexture");
|
||||
material->getTechnique(0)->getPass(0)->setSceneBlending(SBT_TRANSPARENT_ALPHA);
|
||||
}
|
||||
|
||||
extern "C" void *ogre_insertBone(char* name, void* rootBone, int32_t index)
|
||||
{
|
||||
return (void*) ( ((Bone*)rootBone)->createChild(index) );
|
||||
|
|
|
@ -19,10 +19,10 @@ void turnGuiOff(MyGUI::WidgetPtr sender)
|
|||
}
|
||||
}
|
||||
|
||||
void setupGUI()
|
||||
extern "C" void gui_setupGUI()
|
||||
{
|
||||
ResourceGroupManager::getSingleton().
|
||||
addResourceLocation("MyGUI_Media", "FileSystem", "General");
|
||||
addResourceLocation("media_mygui", "FileSystem", "General");
|
||||
|
||||
mGUI = new MyGUI::Gui();
|
||||
mGUI->initialise(mWindow);
|
||||
|
@ -40,11 +40,12 @@ void setupGUI()
|
|||
MyGUI::ALIGN_RIGHT | MyGUI::ALIGN_TOP,
|
||||
"Statistic");
|
||||
FPSText->setTextAlign(MyGUI::ALIGN_RIGHT);
|
||||
FPSText->setColour(Ogre::ColourValue::White);
|
||||
FPSText->setNeedMouseFocus(false);
|
||||
|
||||
// TESTING WINDOW WITH BUTTON
|
||||
guiMode = 1;
|
||||
MyGUI::WidgetPtr tmp;
|
||||
/*
|
||||
// TESTING WINDOW WITH BUTTON
|
||||
width = 300;
|
||||
height = 200;
|
||||
window = mGUI->createWidget<MyGUI::Window>
|
||||
|
@ -52,36 +53,45 @@ void setupGUI()
|
|||
(mWidth-width)/4, (mHeight-height)/4, // Position
|
||||
width, height, // Size
|
||||
MyGUI::ALIGN_DEFAULT, "Overlapped");
|
||||
//window->setColour(Ogre::ColourValue::White);
|
||||
//window->setFontName("ManualFont");
|
||||
window->setCaption("GUI Demo");
|
||||
window->setMinMax(180, 160, 1000, 1000);
|
||||
window->setAlpha(0.7);
|
||||
|
||||
width = 150;
|
||||
height = 30;
|
||||
MyGUI::WidgetPtr tmp;
|
||||
tmp = window->createWidget<MyGUI::Button>
|
||||
("ButtonSmall",
|
||||
40, 100, // Position
|
||||
width, height, // Size
|
||||
MyGUI::ALIGN_LEFT | MyGUI::ALIGN_TOP,
|
||||
"Main");
|
||||
"QuitButton");
|
||||
tmp->setCaption("Press this button");
|
||||
tmp->eventMouseButtonClick = MyGUI::newDelegate(&turnGuiOff);
|
||||
*/
|
||||
|
||||
// TESTING MORROWIND SKIN
|
||||
width = 300;
|
||||
height = 190;
|
||||
mwindow = mGUI->createWidget<MyGUI::Window>
|
||||
("MW_Window",
|
||||
mWidth-width-120, mHeight-height-160, // Position
|
||||
(mWidth-width)/4, (mHeight-height)/4, // Position
|
||||
width, height, // Size
|
||||
MyGUI::ALIGN_DEFAULT, "Overlapped");
|
||||
mwindow->setCaption("Skin test");
|
||||
mwindow->setMinMax(100, 140, 1000, 1000);
|
||||
mwindow->setAlpha(1);
|
||||
|
||||
width = 45;
|
||||
height = 24;
|
||||
tmp = mwindow->createWidget<MyGUI::Button>
|
||||
("MW_Button",
|
||||
10, 32, // Position
|
||||
width, height, // Size
|
||||
MyGUI::ALIGN_LEFT | MyGUI::ALIGN_TOP,
|
||||
"MWButton1");
|
||||
tmp->setCaption("Close");
|
||||
tmp->eventMouseButtonClick = MyGUI::newDelegate(&turnGuiOff);
|
||||
|
||||
// TESTING BITMAP FONT
|
||||
/*
|
||||
tmp = mGUI->createWidget<MyGUI::Widget>
|
||||
|
@ -91,7 +101,6 @@ void setupGUI()
|
|||
MyGUI::ALIGN_LEFT | MyGUI::ALIGN_BOTTOM,
|
||||
"Statistic");
|
||||
tmp->setTextAlign(MyGUI::ALIGN_LEFT);
|
||||
tmp->setColour(Ogre::ColourValue::White);
|
||||
tmp->setFontName("ManualFont");
|
||||
tmp->setCaption("ABC");
|
||||
//*/
|
||||
|
|
|
@ -116,6 +116,9 @@ void setupOgre()
|
|||
// exterior cells differently, etc.
|
||||
ogre_makeScene();
|
||||
|
||||
// Load the GUI elements
|
||||
gui_setupGUI();
|
||||
|
||||
ogreSetup = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue