- moved the windows to use layouts

- various gui-work
- begun binding the GUI into Monster script
- updated to latest Monster source (0.11 alpha)


git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@87 ea6a568a-9f4f-0410-981a-c910a81bb256
actorid
nkorslund 16 years ago
parent 9530ae0526
commit 2995f8b99f

@ -65,13 +65,13 @@ all: openmw esmtool niftool bsatool bored
cpp: cpp_ogre.o cpp_avcodec.o cpp_bullet.o
cpp_ogre.o: $(ogre_cpp_files)
$(OGCC) -c $<
$(OGCC) -o $@ -c $<
cpp_avcodec.o: $(avcodec_cpp_files)
$(AVGCC) -c $<
$(AVGCC) -o $@ -c $<
cpp_bullet.o: $(bullet_cpp_files)
$(BGCC) -c $<
$(BGCC) -o $@ -c $<
objs/%.o: %.d
dirname $@ | xargs mkdir -p

@ -150,7 +150,7 @@ extern "C" int32_t bullet_init()
// ------- SET UP THE PLAYER -------
// Create the player collision shape.
float width = 50;
float width = 30;
/*
float height = 50;

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

@ -10,7 +10,7 @@
<Property key="FontName" value = "MyGUI_CoreFont.18" />
<Property key="FontHeight" value = "18" />
<Property key="AlignText" value = "ALIGN_DEFAULT" />
<Property key="Colour" value = "0 0 0" />
<Property key="Colour" value = "0.7 0.7 0.7" />
<BasisSkin type="SimpleText" offset = "0 0 16 16" align = "ALIGN_STRETCH"/>
</Skin>

@ -14,8 +14,11 @@
<List file="openmw_text.skin.xml" group="General"/>
<List file="openmw_windows.skin.xml" group="General"/>
<List file="openmw_button.skin.xml" group="General"/>
<List file="openmw_box.skin.xml" group="General"/>
<List file="openmw_progress.skin.xml" group="General"/>
<List file="openmw_hud_energybar.skin.xml" group="General"/>
<List file="openmw_hud_box.skin.xml" group="General"/>
<List file="openmw_mainmenu_skin.xml" group="General"/>
</MyGUI>
</MyGUI>

@ -24,6 +24,14 @@
<Code hide="1104"/>
</Font>
<Font name="daedric36" source="daedric.ttf" size="36" resolution="72" antialias_colour="false" space_width="4" tab_count="4" spacer="5">
<Code range="33 98"/>
</Font>
<Font name="daedric_orig36" source="daedric_orig.ttf" size="36" resolution="72" antialias_colour="false" space_width="4" tab_count="4" spacer="5">
<Code range="33 98"/>
</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>

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file defines the box you see around many GUI elements, such
as around the sections of the stats window, or around popup info windows -->
<MyGUI type="Skin">
<!-- Box 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>
<!-- Main box definition -->
<Skin name="MW_Box" size="516 516">
<Child type="Widget" skin="IB_T" offset="2 0 512 2" align="ALIGN_TOP ALIGN_HSTRETCH"/>
<Child type="Widget" skin="IB_B" offset="2 514 512 2" align="ALIGN_BOTTOM ALIGN_HSTRETCH"/>
<Child type="Widget" skin="IB_L" offset="0 2 2 512" align="ALIGN_LEFT ALIGN_VSTRETCH"/>
<Child type="Widget" skin="IB_R" offset="514 2 2 512" align="ALIGN_RIGHT ALIGN_VSTRETCH"/>
<Child type="Widget" skin="IB_TL" offset="0 0 2 2" align="ALIGN_TOP ALIGN_LEFT"/>
<Child type="Widget" skin="IB_TR" offset="514 0 2 2" align="ALIGN_TOP ALIGN_RIGHT"/>
<Child type="Widget" skin="IB_BL" offset="0 514 2 2" align="ALIGN_BOTTOM ALIGN_LEFT"/>
<Child type="Widget" skin="IB_BR" offset="514 514 2 2" align="ALIGN_BOTTOM ALIGN_RIGHT"/>
</Skin>
</MyGUI>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Skin">
<!-- The 'box' frame that surrounds various HUD items -->
<!-- The 'box' frame that surrounds various HUD items and other elements -->
<Skin name="HUD_Box" size="40 40" texture="menu_icon_equip.dds">
<BasisSkin type="SubSkin" offset="0 0 40 2" align= "ALIGN_TOP ALIGN_HSTRETCH">
<State name="normal" offset="2 2 40 2"/>
@ -15,7 +15,6 @@
<BasisSkin type="SubSkin" offset="38 2 2 36" align= "ALIGN_RIGHT ALIGN_VSTRETCH">
<State name="normal" offset="40 4 2 36"/>
</BasisSkin>
<!-- The interior of the box -->
<Child type="Widget" skin="BlackBG" offset="2 2 36 36" align="ALIGN_STRETCH" name="Client"/>
</Skin>

@ -27,24 +27,19 @@
</Skin>
<!-- Progress bar track, various colors -->
<Skin name = "MW_BarTrack_Red" size = "16 8" texture = "menu_bar_red.dds" >
<BasisSkin type="MainSkin" offset = "0 0 16 8" align = "ALIGN_STRETCH">
<State name="normal" offset = "0 8 16 8"/>
<Skin name = "MW_BarTrack_Red" size = "4 8" texture = "smallbars.png" >
<BasisSkin type="MainSkin" offset = "0 0 4 8" align = "ALIGN_STRETCH">
<State name="normal" offset = "0 0 4 8"/>
</BasisSkin>
</Skin>
<Skin name = "MW_BarTrack_Green" size = "16 8" texture = "menu_bar_green.dds" >
<BasisSkin type="MainSkin" offset = "0 0 16 8" align = "ALIGN_STRETCH">
<State name="normal" offset = "0 8 16 8"/>
<Skin name = "MW_BarTrack_Green" size = "4 8" texture = "smallbars.png" >
<BasisSkin type="MainSkin" offset = "0 0 4 8" align = "ALIGN_STRETCH">
<State name="normal" offset = "0 16 4 8"/>
</BasisSkin>
</Skin>
<Skin name = "MW_BarTrack_Blue" size = "16 8" texture = "menu_bar_blue.dds" >
<BasisSkin type="MainSkin" offset = "0 0 16 8" align = "ALIGN_STRETCH">
<State name="normal" offset = "0 8 16 8"/>
</BasisSkin>
</Skin>
<Skin name = "MW_BarTrack_Gray" size = "16 8" texture = "menu_bar_gray.dds" >
<BasisSkin type="MainSkin" offset = "0 0 16 8" align = "ALIGN_STRETCH">
<State name="normal" offset = "0 8 16 8"/>
<Skin name = "MW_BarTrack_Blue" size = "4 8" texture = "smallbars.png" >
<BasisSkin type="MainSkin" offset = "0 0 4 8" align = "ALIGN_STRETCH">
<State name="normal" offset = "0 8 4 8"/>
</BasisSkin>
</Skin>
@ -74,12 +69,4 @@
<Child type="Widget" skin="BlackBG" offset = "2 2 60 8" align = "ALIGN_STRETCH" name="Client"/>
</Skin>
<Skin name="MW_EnergyBar_Gray" size="64 12">
<Property key="TrackSkin" value = "MW_BarTrack_Gray" />
<Property key="TrackWidth" value = "1" />
<Child type="Widget" skin="MW_BarFrame" offset="0 0 64 12" align="ALIGN_STRETCH"/>
<Child type="Widget" skin="BlackBG" offset = "2 2 60 8" align = "ALIGN_STRETCH" name="Client"/>
</Skin>
</MyGUI>

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<!-- The entire screen -->
<Widget type="Widget" layer="MainMenu" position="0 0 300 300" name="_Main">
<!-- Centered box containing the buttons -->
<Widget type="Widget" position="86 12 128 276" align="Center">
<!-- Menu boxes -->
<Widget type="Button" skin="ReturnButton" position="0 0 128 64" align="Top Left" name="Return"/>
<Widget type="Button" skin="NewButton" position="0 46 128 64" align="Top Left" name="New"/>
<Widget type="Button" skin="SaveButton" position="0 92 128 64" align="Top Left" name="Save"/>
<Widget type="Button" skin="LoadButton" position="0 138 128 64" align="Top Left" name="Load"/>
<Widget type="Button" skin="OptionsButton" position="0 184 128 64" align="Top Left" name="Options"/>
<Widget type="Button" skin="ExitButton" position="0 230 128 64" align="Top Left" name="Exit"/>
</Widget>
</Widget>
</MyGUI>

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Skin">
<Skin name="ReturnButton" size="128 64" texture="menu_return.dds">
<BasisSkin type="MainSkin" offset = "0 0 128 64">
<State name="normal" offset = "0 0 128 64"/>
</BasisSkin>
</Skin>
<Skin name="NewButton" size="128 64" texture="menu_newgame.dds">
<BasisSkin type="MainSkin" offset = "0 0 128 64">
<State name="normal" offset = "0 0 128 64"/>
</BasisSkin>
</Skin>
<Skin name="SaveButton" size="128 64" texture="menu_savegame.dds">
<BasisSkin type="MainSkin" offset = "0 0 128 64">
<State name="normal" offset = "0 0 128 64"/>
</BasisSkin>
</Skin>
<Skin name="LoadButton" size="128 64" texture="menu_loadgame.dds">
<BasisSkin type="MainSkin" offset = "0 0 128 64">
<State name="normal" offset = "0 0 128 64"/>
</BasisSkin>
</Skin>
<Skin name="OptionsButton" size="128 64" texture="menu_options.dds">
<BasisSkin type="MainSkin" offset = "0 0 128 64">
<State name="normal" offset = "0 0 128 64"/>
</BasisSkin>
</Skin>
<Skin name="ExitButton" size="128 64" texture="menu_exitgame.dds">
<BasisSkin type="MainSkin" offset = "0 0 128 64">
<State name="normal" offset = "0 0 128 64"/>
</BasisSkin>
</Skin>
</MyGUI>

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="Window" skin="MW_Window" layer="Windows" position="0 0 300 300" name="_Main">
<Widget type="StaticImage" skin="StaticImage" position="0 0 284 264" align="ALIGN_STRETCH" name="Map"/>
<Widget type="StaticImage" skin="StaticImage" position="126 116 32 32" align="Center" name="Compass"/>
<Widget type="Button" skin="MW_Button" position="213 233 61 22" align="ALIGN_BOTTOM ALIGN_RIGHT" name="WorldButton"/>
</Widget>
</MyGUI>

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Skin">
<!-- Progress bar track, various colors -->
<Skin name = "MW_BigTrack_Red" size = "2 14" texture = "bigbars.png" >
<BasisSkin type="MainSkin" offset = "0 0 2 14" align = "ALIGN_STRETCH">
<State name="normal" offset = "0 0 2 14"/>
</BasisSkin>
</Skin>
<Skin name = "MW_BigTrack_Green" size = "2 14" texture = "bigbars.png" >
<BasisSkin type="MainSkin" offset = "0 0 2 14" align = "ALIGN_STRETCH">
<State name="normal" offset = "0 14 2 14"/>
</BasisSkin>
</Skin>
<Skin name = "MW_BigTrack_Blue" size = "2 14" texture = "bigbars.png" >
<BasisSkin type="MainSkin" offset = "0 0 2 14" align = "ALIGN_STRETCH">
<State name="normal" offset = "0 28 2 14"/>
</BasisSkin>
</Skin>
<Skin name = "ProgressText" size = "16 16">
<Property key="FontName" value = "MyGUI_CoreFont.18" />
<Property key="FontHeight" value = "18" />
<Property key="AlignText" value = "ALIGN_CENTER" />
<Property key="Colour" value = "0.35 0.6 0.75" />
<BasisSkin type="SimpleText" offset = "0 0 16 16" align = "ALIGN_STRETCH"/>
</Skin>
<!-- Main energy bar widget definitions. There's one for each color.-->
<Skin name="MW_Progress_Red" size="64 12">
<Property key="TrackSkin" value = "MW_BigTrack_Red" />
<Property key="TrackWidth" value = "1" />
<Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="ALIGN_STRETCH"/>
<Child type="Widget" skin="BlackBG" offset = "2 2 60 8" align = "ALIGN_STRETCH" name="Client"/>
</Skin>
<Skin name="MW_Progress_Green" size="64 12">
<Property key="TrackSkin" value = "MW_BigTrack_Green" />
<Property key="TrackWidth" value = "1" />
<Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="ALIGN_STRETCH"/>
<Child type="Widget" skin="BlackBG" offset = "2 2 60 8" align = "ALIGN_STRETCH" name="Client"/>
</Skin>
<Skin name="MW_Progress_Blue" size="64 12">
<Property key="TrackSkin" value = "MW_BigTrack_Blue" />
<Property key="TrackWidth" value = "1" />
<Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="ALIGN_STRETCH"/>
<Child type="Widget" skin="BlackBG" offset = "2 2 60 8" align = "ALIGN_STRETCH" name="Client"/>
</Skin>
</MyGUI>

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="Window" skin="MW_Window" layer="Windows" position="0 0 500 342" name="_Main">
<!-- Player health stats -->
<Widget type="Widget" skin="MW_Box" position="8 8 212 62">
<Widget type="StaticText" skin="NormalText" position="4 4 70 18" name="Health_str"/>
<Widget type="StaticText" skin="NormalText" position="4 22 70 18" name="Magicka_str"/>
<Widget type="StaticText" skin="NormalText" position="4 40 70 18" name="Fatigue_str"/>
<Widget type="Progress" skin="MW_Progress_Red" position="78 4 130 18" name="HBar"/>
<Widget type="Progress" skin="MW_Progress_Blue" position="78 22 130 18" name="MBar"/>
<Widget type="Progress" skin="MW_Progress_Green" position="78 40 130 18" name="FBar"/>
<Widget type="StaticText" skin="ProgressText" position="78 4 130 18" align="Center" name="HBarT"/>
<Widget type="StaticText" skin="ProgressText" position="78 22 130 18" align="Center" name="MBarT"/>
<Widget type="StaticText" skin="ProgressText" position="78 40 130 18" align="Center" name="FBarT"/>
</Widget>
<!-- Player level, race and class -->
<Widget type="Widget" skin="MW_Box" position="8 78 212 62">
<Widget type="StaticText" skin="NormalText" position="4 4 100 18" name="Level_str"/>
<Widget type="StaticText" skin="NormalText" position="4 22 100 18" name="Race_str"/>
<Widget type="StaticText" skin="NormalText" position="4 40 100 18" name="Class_str"/>
<Widget type="StaticText" skin="SandTextRight" position="104 4 104 18" name="LevelText"/>
<Widget type="StaticText" skin="SandTextRight" position="104 22 104 18" name="RaceText"/>
<Widget type="StaticText" skin="SandTextRight" position="104 40 104 18" name="ClassText"/>
</Widget>
<Widget type="Widget" skin="MW_Box" position="8 148 212 152">
<Widget type="StaticText" skin="SandText" position="4 4 100 18" name="Attrib1"/>
<Widget type="StaticText" skin="SandTextRight" position="104 4 104 18" name="AttribVal1"/>
<Widget type="StaticText" skin="SandText" position="4 22 100 18" name="Attrib2"/>
<Widget type="StaticText" skin="SandTextRight" position="104 22 104 18" name="AttribVal2"/>
<Widget type="StaticText" skin="SandText" position="4 40 100 18" name="Attrib3"/>
<Widget type="StaticText" skin="SandTextRight" position="104 40 104 18" name="AttribVal3"/>
<Widget type="StaticText" skin="SandText" position="4 58 100 18" name="Attrib4"/>
<Widget type="StaticText" skin="SandTextRight" position="104 58 104 18" name="AttribVal4"/>
<Widget type="StaticText" skin="SandText" position="4 76 100 18" name="Attrib5"/>
<Widget type="StaticText" skin="SandTextRight" position="104 76 104 18" name="AttribVal5"/>
<Widget type="StaticText" skin="SandText" position="4 94 100 18" name="Attrib6"/>
<Widget type="StaticText" skin="SandTextRight" position="104 94 104 18" name="AttribVal6"/>
<Widget type="StaticText" skin="SandText" position="4 112 100 18" name="Attrib7"/>
<Widget type="StaticText" skin="SandTextRight" position="104 112 104 18" name="AttribVal7"/>
<Widget type="StaticText" skin="SandText" position="4 130 100 18" name="Attrib8"/>
<Widget type="StaticText" skin="SandTextRight" position="104 130 104 18" name="AttribVal8"/>
</Widget>
<Widget type="Widget" skin="MW_Box" position="228 8 248 292" align="ALIGN_LEFT ALIGN_VSTRETCH">
</Widget>
</Widget>
</MyGUI>

@ -1,17 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Skin">
<Skin name = "DaedricText" size = "16 16">
<Property key="FontName" value = "daedric" />
<Skin name = "NormalText" size = "16 16">
<Property key="FontName" value = "MyGUI_CoreFont.18" />
<Property key="FontHeight" value = "18" />
<Property key="AlignText" value = "ALIGN_LEFT ALIGN_BOTTOM" />
<Property key="Colour" value = "0.62 0.78 0.87" />
<BasisSkin type="SimpleText" offset = "0 0 16 16" align = "ALIGN_STRETCH"/>
</Skin>
<Skin name = "SandText" size = "16 16">
<Property key="FontName" value = "MyGUI_CoreFont.18" />
<Property key="FontHeight" value = "18" />
<Property key="AlignText" value = "ALIGN_LEFT ALIGN_BOTTOM" />
<Property key="Colour" value = "0.35 0.6 0.75" />
<BasisSkin type="SimpleText" offset = "0 0 16 16" align = "ALIGN_STRETCH"/>
</Skin>
<Skin name = "SandTextRight" size = "16 16">
<Property key="FontName" value = "MyGUI_CoreFont.18" />
<Property key="FontHeight" value = "18" />
<Property key="AlignText" value = "ALIGN_RIGHT ALIGN_BOTTOM" />
<Property key="Colour" value = "0.35 0.6 0.75" />
<BasisSkin type="SimpleText" offset = "0 0 16 16" align = "ALIGN_STRETCH"/>
</Skin>
<Skin name = "DaedricText" size = "16 16">
<Property key="FontName" value = "daedric36" />
<Property key="FontHeight" value = "36" />
<Property key="AlignText" value = "ALIGN_DEFAULT" />
<Property key="Colour" value = "1 1 1" />
<BasisSkin type="SimpleText" offset = "0 0 16 16" align = "ALIGN_STRETCH"/>
</Skin>
<Skin name = "DaedricText_orig" size = "16 16">
<Property key="FontName" value = "daedric_orig" />
<Property key="FontHeight" value = "18" />
<Property key="FontName" value = "daedric_orig36" />
<Property key="FontHeight" value = "36" />
<Property key="AlignText" value = "ALIGN_DEFAULT" />
<Property key="Colour" value = "1 1 1" />
<BasisSkin type="SimpleText" offset = "0 0 16 16" align = "ALIGN_STRETCH"/>

@ -2,7 +2,7 @@
<MyGUI type="Skin">
<!-- Defines a pure black background -->
<Skin name = "BlackBG" size = "8 8" texture = "black.png">
<Skin name = "BlackBG" size = "8 8" texture = "transparent.png">
<BasisSkin type="MainSkin" offset = "0 0 8 8">
<State name="normal" offset = "0 0 8 8"/>
</BasisSkin>
@ -63,49 +63,6 @@
</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">
@ -213,7 +170,7 @@
<Property key="Colour" value = "0.8 0.8 0.8" />
<Property key="ToStick" value = "true" />
<Child type="Widget" skin="BlackBG" offset = "6 26 244 22" align = "ALIGN_STRETCH" name = "Client"/>
<Child type="Widget" skin="BlackBG" offset = "8 28 240 18" align = "ALIGN_STRETCH" name = "Client"/>
<!-- Outer orders -->
<Child type="Widget" skin="TB_T" offset="4 0 248 4" align="ALIGN_TOP ALIGN_HSTRETCH" name="Action">
@ -243,14 +200,30 @@
</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"/>
<Child type="Widget" skin="TB_T" offset="8 24 240 4" align="ALIGN_TOP ALIGN_HSTRETCH" name="Action">
<Property key="Scale" value = "0 1 0 -1"/>
</Child>
<Child type="Widget" skin="TB_L" offset="4 28 4 18" align="ALIGN_LEFT ALIGN_VSTRETCH" name="Action">
<Property key="Scale" value = "1 0 -1 0"/>
</Child>
<Child type="Widget" skin="TB_B" offset="8 46 240 4" align="ALIGN_BOTTOM ALIGN_HSTRETCH" name="Action">
<Property key="Scale" value = "0 0 0 1"/>
</Child>
<Child type="Widget" skin="TB_R" offset="248 28 4 18" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="Action">
<Property key="Scale" value = "0 0 1 0"/>
</Child>
<Child type="Widget" skin="TB_BR" offset="248 46 4 4" align="ALIGN_BOTTOM ALIGN_RIGHT" name="Action">
<Property key="Scale" value = "0 0 1 1"/>
</Child>
<Child type="Widget" skin="TB_BL" offset="4 46 4 4" align="ALIGN_BOTTOM ALIGN_LEFT" name="Action">
<Property key="Scale" value = "1 0 -1 1"/>
</Child>
<Child type="Widget" skin="TB_TR" offset="248 24 4 4" align="ALIGN_TOP ALIGN_RIGHT" name="Action">
<Property key="Scale" value = "0 1 1 -1"/>
</Child>
<Child type="Widget" skin="TB_TL" offset="4 24 4 4" align="ALIGN_TOP ALIGN_LEFT" name="Action">
<Property key="Scale" value = "1 1 -1 -1"/>
</Child>
<!-- Caption -->
<Child type="Widget" skin="HB_ALL" offset="4 4 248 20" align = "ALIGN_TOP ALIGN_HSTRETCH">

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/
@ -811,32 +811,17 @@ class LiteralExpr : Expression
return;
}
bool hasPercent()
{
int i = value.str.find('%');
if(i == -1) return false;
// Make sure it is at the end
if(i != value.str.length-1)
fail("Number literals can only have a percentage sign (%) at the end. Perhaps you meant the reminder operator '%%' ?", value.loc);
return true;
}
// Numeric literal.
if(value.type == TT.NumberLiteral)
{
// Parse number strings. Simple hack for now, assume it's an
// int unless it contains a period, then it's a float. TODO:
// Improve this later, see how it is done elsewhere.
if(value.str.find('.') != -1 || hasPercent())
if(value.str.find('.') != -1)
{
type = BasicType.getFloat;
fval = atof(value.str);
if(hasPercent())
fval /= 100;
return;
}

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/
@ -43,7 +43,7 @@ bool validIdentChar(char c)
}
// Same as above, except numbers are not allowed as the first
// character. Will extend to support UTF8 later.
// character. Will extend to support full Unicode later.
bool validFirstIdentChar(char c)
{
if((c >= 'a' && c <= 'z') ||
@ -104,7 +104,7 @@ enum TT
Import, Clone, Override, Final, Function, With,
This, New, Static, Const, Out, Ref, Abstract, Idle,
Public, Private, Protected, True, False, Native, Null,
Goto, Var, In,
Goto, Var,
Last, // Tokens after this do not have a specific string
// associated with them.
@ -247,7 +247,6 @@ const char[][] tokenList =
TT.Null : "null",
TT.Goto : "goto",
TT.Var : "var",
TT.In : "in",
// These are only used in error messages
TT.StringLiteral : "string literal",
@ -540,10 +539,6 @@ class StreamTokenizer
// also explicitly allow '.' dots.
int len = 1;
bool lastDot = false; // Was the last char a '.'?
// I've tried with percentage literals (10% = 0.10), but it
// conflicts with the remainder division operator (which
// shouldn't change), so I've disabled it for now.
//bool lastPer = false; // Was it a '%'?
foreach(char ch; line[1..$])
{
if(ch == '.')
@ -557,19 +552,6 @@ class StreamTokenizer
}
lastDot = true;
}
/*
else if(ch == '%')
{
// Ditto for percentage signs. We allow '%' but not
// '%%'
if(lastPer)
{
len--;
break;
}
lastPer = true;
}
*/
else
{
if(!validIdentChar(ch)) break;

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,31 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/
This file (all.d) is part of the Monster script language
package.
Monster is distributed as free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License
version 3, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
version 3 along with this program. If not, see
http://www.gnu.org/licenses/ .
*/
module monster.modules.all;
import monster.modules.io;
import monster.modules.math;
import monster.modules.timer;
import monster.modules.frames;
import monster.modules.random;
@ -13,4 +38,5 @@ void initAllModules()
initFramesModule();
initThreadModule();
initRandomModule();
initMathModule();
}

@ -1,3 +1,27 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/
This file (frames.d) is part of the Monster script language
package.
Monster is distributed as free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License
version 3, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
version 3 along with this program. If not, see
http://www.gnu.org/licenses/ .
*/
// Provides some simple numbers and functions regarding the rendering
// frames of the application. It's up to the user to some degree to

@ -1,9 +1,32 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/
This file (io.d) is part of the Monster script language
package.
Monster is distributed as free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License
version 3, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
version 3 along with this program. If not, see
http://www.gnu.org/licenses/ .
*/
// This module provides simple output functions for Monster. The 'i'
// part (input) isn't really there yet.
// (input) part of 'io' isn't really there yet.
module monster.modules.io;
import std.stdio;
import monster.monster;
const char[] moduleDef =
@ -16,6 +39,29 @@ native writelns(char[][] args...);
native print(char[][] args...);
"; //"
// Use tango library functions directly, since flushing the
// minibos-versions will give weird effects when mixing with other
// tango output.
version(Tango)
{
import tango.io.Stdout;
void doWrite(bool space)
{
AIndex[] args = stack.popAArray();
char[] form = "{}";
if(space) form = "{} ";
foreach(AIndex ind; args)
Stdout.format(form, arrays.getRef(ind).carr);
Stdout.flush();
}
void writefln() { Stdout.newline; }
}
else
{ // Phobos
import std.stdio;
void doWrite(bool space)
{
AIndex[] args = stack.popAArray();
@ -28,7 +74,7 @@ void doWrite(bool space)
fflush(stdout);
}
}
void initIOModule()
{
static MonsterClass mc;

@ -5,8 +5,13 @@
module io;
// Write to console, with or without a newline
native write(char[][] args...);
native writeln(char[][] args...);
// Automatically inserts spaces between arguments
native writes(char[][] args...);
native writelns(char[][] args...);
// Identical to writelns
native print(char[][] args...);

@ -0,0 +1,165 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/
This file (math.d) is part of the Monster script language
package.
Monster is distributed as free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License
version 3, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
version 3 along with this program. If not, see
http://www.gnu.org/licenses/ .
*/
// Simple math functions
module monster.modules.math;
import monster.monster;
import std.math;
const char[] moduleDef =
"module math;
double E = 2.7182818284590452354;
double PI = 3.141592653589793238;
double DEGTORAD = 3.141592653590/180;
double RADTODEG = 180/3.141592653590;
native double sin(double x);
native double cos(double x);
native double tan(double x);
native double asin(double x);
native double acos(double x);
native double atan(double x);
native double atan2(double y, double x); // = atan(y/x)
native double sinh(double x);
native double cosh(double x);
native double tanh(double x);
native double asinh(double x);
native double acosh(double x);
native double atanh(double x);
native double sqrt(double x);
native double exp(double x); // e^x
native double exp2(double x); // 2^x
native double log(double x); // base e
native double log10(double x);// base 10
native double log2(double x); // base 2
native double pow(double x, double y); // x^y
native double ipow(double x, int n); // x^n (faster than pow)
native int abs(int x);
native double fabs(double x);
native double ceil(double x);
native double floor(double x);
native double round(double x); // rounds to nearest integer
native double trunc(double x);
native double hypot(double x, double y); // = sqrt(x*x+y*y)
native double cbrt(double x); // cube root
// Calculates polynomial a0 + x*a1 + x^2*a2 + x^3*a3 + ...
native double poly(double x, float[] A);
"; //"
version(Tango)
{
double fabs(double x) { return abs(x); }
}
void initMathModule()
{
static MonsterClass mc;
if(mc !is null) return;
mc = new MonsterClass(MC.String, moduleDef, "math");
mc.bind("sin", { stack.pushDouble(sin(stack.popDouble)); });
mc.bind("cos", { stack.pushDouble(cos(stack.popDouble)); });
mc.bind("tan", { stack.pushDouble(tan(stack.popDouble)); });
mc.bind("asin", { stack.pushDouble(asin(stack.popDouble)); });
mc.bind("acos", { stack.pushDouble(acos(stack.popDouble)); });
mc.bind("atan", { stack.pushDouble(atan(stack.popDouble)); });
mc.bind("sinh", { stack.pushDouble(sinh(stack.popDouble)); });
mc.bind("cosh", { stack.pushDouble(cosh(stack.popDouble)); });
mc.bind("tanh", { stack.pushDouble(tanh(stack.popDouble)); });
mc.bind("asinh", { stack.pushDouble(asinh(stack.popDouble)); });
mc.bind("acosh", { stack.pushDouble(acosh(stack.popDouble)); });
mc.bind("atanh", { stack.pushDouble(atanh(stack.popDouble)); });
mc.bind("atan2",
{
// Remember to pop the variables in the reverse order
auto x = stack.popDouble;
stack.pushDouble(atan2(stack.popDouble, x));
});
mc.bind("sqrt", { stack.pushDouble(sqrt(stack.popDouble)); });
mc.bind("exp", { stack.pushDouble(exp(stack.popDouble)); });
mc.bind("exp2", { stack.pushDouble(exp2(stack.popDouble)); });
mc.bind("log", { stack.pushDouble(log(stack.popDouble)); });
mc.bind("log2", { stack.pushDouble(log2(stack.popDouble)); });
mc.bind("log10", { stack.pushDouble(log10(stack.popDouble)); });
mc.bind("pow",
{
auto x = stack.popDouble;
stack.pushDouble(pow(stack.popDouble, x));
});
mc.bind("ipow",
{
auto x = stack.popInt;
stack.pushDouble(pow(cast(real)stack.popDouble, x));
});
mc.bind("abs", { stack.pushDouble(abs(stack.popDouble)); });
mc.bind("fabs", { stack.pushDouble(fabs(stack.popDouble)); });
mc.bind("ceil", { stack.pushDouble(ceil(stack.popDouble)); });
mc.bind("floor", { stack.pushDouble(floor(stack.popDouble)); });
mc.bind("round", { stack.pushDouble(round(stack.popDouble)); });
mc.bind("trunc", { stack.pushDouble(trunc(stack.popDouble)); });
// Order doesn't matter here
mc.bind("hypot", { stack.pushDouble(hypot(stack.popDouble,
stack.popDouble)); });
mc.bind("cbrt", { stack.pushDouble(cbrt(stack.popDouble)); });
mc.bind("poly", &npoly);
}
// Implement this ourselves, since phobos doesn't use the types we
// want
double poly(double x, float A[])
{
// Use 'real' internally for higher precision
real r = A[$-1];
foreach_reverse(c; A[0..$-1])
{
r *= x;
r += c;
}
return r;
}
// double poly(double x, float[] A);
void npoly()
{
auto arf = stack.popArray();
assert(arf.elemSize == 1);
stack.pushDouble(poly(stack.popDouble, arf.farr));
}

@ -0,0 +1,43 @@
module math;
double E = 2.7182818284590452354;
double PI = 3.141592653589793238;
double DEGTORAD = 3.141592653590/180;
double RADTODEG = 180/3.141592653590;
native double sin(double x);
native double cos(double x);
native double tan(double x);
native double asin(double x);
native double acos(double x);
native double atan(double x);
native double atan2(double y, double x); // = atan(y/x)
native double sinh(double x);
native double cosh(double x);
native double tanh(double x);
native double asinh(double x);
native double acosh(double x);
native double atanh(double x);
native double sqrt(double x);
native double exp(double x); // e^x
native double exp2(double x); // 2^x
native double log(double x); // base e
native double log10(double x);// base 10
native double log2(double x); // base 2
native double pow(double x, double y); // x^y
native double ipow(double x, int n); // x^n (faster than pow)
native int abs(int x);
native double fabs(double x);
native double ceil(double x);
native double floor(double x);
native double round(double x); // rounds to nearest integer
native double trunc(double x);
native double hypot(double x, double y); // = sqrt(x*x+y*y)
native double cbrt(double x); // cube root
// Calculates polynomial a0 + x*a1 + x^2*a2 + x^3*a3 + ...
native double poly(double x, float[] A);

@ -1,3 +1,25 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/
This file (random.d) is part of the Monster script language package.
Monster is distributed as free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License
version 3, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
version 3 along with this program. If not, see
http://www.gnu.org/licenses/ .
*/
// This module provides simple random number generation. Since this is
// intended for game development, speed and simplicity is favored over

@ -1,3 +1,27 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/
This file (threads.d) is part of the Monster script language
package.
Monster is distributed as free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License
version 3, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
version 3 along with this program. If not, see
http://www.gnu.org/licenses/ .
*/
// This module provides an interface to the virtual threading API in
// Monster.

@ -1,3 +1,27 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/
This file (timer.d) is part of the Monster script language
package.
Monster is distributed as free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License
version 3, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
version 3 along with this program. If not, see
http://www.gnu.org/licenses/ .
*/
// This module contains (or will contain) various routines for
// timing. It is also home of the ubiquitous "sleep" idle function.

@ -4,4 +4,6 @@
*/
singleton timer;
// Sleep the given number of seconds
idle sleep(float secs);

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2004, 2007, 2008 Nicolay Korslund
Copyright (C) 2004, 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/
@ -47,11 +47,11 @@ import monster.vm.iterators;
import monster.vm.error;
import monster.vm.fstack;
import std.math : floor;
// Used for array copy below. It handles overlapping data for us.
extern(C) void* memmove(void *dest, void *src, size_t n);
extern(C) double floor(double d);
import monster.util.list;
alias _lstNode!(Thread) _tmp1;
alias __FreeNode!(Thread) _tmp2;

@ -1,6 +1,6 @@
/*
Monster - an advanced game scripting language
Copyright (C) 2007, 2008 Nicolay Korslund
Copyright (C) 2007-2009 Nicolay Korslund
Email: <korslund@gmail.com>
WWW: http://monster.snaptoad.com/

@ -1,38 +1,36 @@
// Small script that prints the FPS to screen with regular intervals.
class FPSTicker;
import frames;
// Set the FPS widget text
native setText(char[][] args...);
run()
{
// Sleep one frame. This makes sure that we won't start running until
// the rendering begins. Not critically important, but it prevents the
// first printed value from being 'nan'.
fsleep(1);
// Set up the text widget
Widget txt = gui.text("StaticText",
gui.getWidth()-90, 10, 120, 30,
"Statistic");
txt.setNeedMouseFocus(false);
txt.setTextColor(1,1,1);
txt.setCaption("hello!");
setText("hello!");
// Sleep one frame. This makes sure we only start running after
// rendering begins. It prevents the first printed value from being
// 'nan'
fsleep(1);
// counter and totalTime (in the 'frames' module) are updated
// automatically by the system.
ulong lastFrame = counter;
float lastTime = totalTime;
// counter and totalTime (in the 'frames' module) are updated
// automatically by the system.
ulong lastFrame = counter;
float lastTime = totalTime;
float delay = 1.5;
float delay = 1.5;
while(true)
{
sleep(delay);
while(true)
{
sleep(delay);
// Calculate differences since last frame
ulong fdiff = counter-lastFrame;
float tdiff = totalTime-lastTime;
// Calculate differences since last frame
ulong fdiff = counter-lastFrame;
float tdiff = totalTime-lastTime;
setText("fps: ", fdiff / tdiff);
txt.setCaption("fps: ", fdiff/tdiff);
lastFrame = counter;
lastTime = totalTime;
}
lastFrame = counter;
lastTime = totalTime;
}

@ -0,0 +1,5 @@
/*
Widget hud;
hud = gui.loadLayout("openmw_hud_layout.xml");
hud.setCoord(10,10,500,500);
*/

@ -0,0 +1,11 @@
// GUI module. Only covers some very basic functions.
module gui;
// Later, we'll have singleton gui : Widget; with most of the
// functions defined in Widget.
native Widget loadLayout(char[] file);
native Widget text(char[] skin, int x, int y, int w, int h,
char[] layer);
native int getWidth();
native int getHeight();

@ -0,0 +1,10 @@
class Widget;
native setNeedMouseFocus(bool b);
native setTextColor(float r, float g, float b);
native setCoord(int x, int y, int w, int h);
native setCaption(char[][] str...);
// Find a named child widget
native Widget get(char[] name);

@ -28,7 +28,7 @@ import monster.compiler.scopes : global;
import monster.modules.timer;
import core.config;
import ogre.bindings;
import ogre.gui;
import std.string;
@ -50,24 +50,20 @@ void initMonsterScripts()
// Get the Config singleton object
config.mo = (new MonsterClass("Config")).getSing();
// Run the fps ticker
//vm.run("fpsticker.mn");
auto mc = new MonsterClass("fpsticker.mn");
mc.bind("setText", &setFpsText);
mc.createObject().call("run");
// Set up the GUI Monster module
setupGUIScripts();
// Run the test script
vm.run("test.mn");
}
void setFpsText()
// Run the GUI scripts. These should be run only after the
// GUI/rendering system has been initialized
void runGUIScripts()
{
AIndex[] args = stack.popAArray();
char[] res;
// Create the HUD and windows
vm.run("makegui.mn");
foreach(AIndex ind; args)
res ~= format("%s", arrays.getRef(ind).carr);
gui_setFpsText(res.ptr);
// Run the fps ticker
vm.run("fpsticker.mn");
}

@ -163,7 +163,27 @@ 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);
// Test
// GUI functions. Under development.
typedef void* WidgetPtr;
void gui_setupGUI();
void gui_toggleGui();
void gui_setFpsText(char *str);
void gui_setCellName(char *str);
// Get the widget type, as a string
char *gui_widgetType(WidgetPtr);
// Get the height or width of a widget. If the argument is null,
// return the size of the screen.
int gui_getHeight(WidgetPtr);
int gui_getWidth(WidgetPtr);
// Set various properties of a given widget
void gui_setCaption(WidgetPtr, char*);
void gui_setNeedMouseFocus(WidgetPtr, int);
void gui_setTextColor(WidgetPtr, float,float,float);
void gui_setCoord(WidgetPtr, int,int,int,int);
// Various ways to get or create widgets
WidgetPtr gui_loadLayout(char *file, char *prefix, WidgetPtr parent);
WidgetPtr gui_getChild(WidgetPtr, char*);
WidgetPtr gui_createText(char *skin, int x, int y, int w, int h, char *layer);

@ -1,37 +1,82 @@
MyGUI::WidgetPtr FPSText;
// TODO: KILLME
char *cellName;
extern "C" void gui_setCellName(char *str)
{
cellName = str;
}
MyGUI::WindowPtr mwindow;
// Get the widget type, as a string
extern "C" const char *gui_widgetType(MyGUI::WidgetPtr p)
{ return p->getTypeName().c_str(); }
OIS::MouseState state;
extern "C" int32_t gui_getHeight(MyGUI::WidgetPtr p)
{
if(p == NULL) mWindow->getHeight();
return p->getHeight();
}
extern "C" void gui_toggleGui()
extern "C" int32_t gui_getWidth(MyGUI::WidgetPtr p)
{
if(guiMode == 1)
{
guiMode = 0;
mGUI->hidePointer();
if(mwindow)
mwindow->setVisible(false);
state = mMouse->getMouseState();
}
else
{
// Restore the GUI mouse position. This is a hack because silly
// OIS doesn't allow us to set the mouse position ourselves.
*((OIS::MouseState*)&(mMouse->getMouseState())) = state;
mGUI->injectMouseMove(state.X.abs, state.Y.abs, 0);
if(p == NULL) return mWindow->getWidth();
return p->getWidth();
}
guiMode = 1;
mGUI->showPointer();
if(mwindow)
mwindow->setVisible(true);
}
// Set various properties of a given widget
extern "C" void gui_setCaption(MyGUI::WidgetPtr p, char* s)
{ p->setCaption(s); }
extern "C" void gui_setNeedMouseFocus(MyGUI::WidgetPtr p, int32_t b)
{ p->setNeedMouseFocus(b); }
extern "C" void gui_setTextColor(MyGUI::WidgetPtr p, float r,float g,float b)
{ p->setTextColour(Ogre::ColourValue(b,g,r)); }
extern "C" void gui_setCoord(MyGUI::WidgetPtr p,
int32_t x,int32_t y,int32_t w,int32_t h)
{ p->setCoord(x,y,w,h); }
// Various ways to get or create widgets
extern "C" MyGUI::WidgetPtr gui_loadLayout(char *file, char *prefix,
MyGUI::WidgetPtr parent)
{
// Get the list of Widgets in this layout
MyGUI::VectorWidgetPtr wlist;
wlist = MyGUI::LayoutManager::getInstance().
loadLayout(file, prefix, parent);
MyGUI::VectorWidgetPtr::iterator iter;
iter = wlist.begin();
// Return null if the list is empty
if(wlist.end() == iter)
return NULL;
MyGUI::WidgetPtr res = *iter;
++iter;
if(iter != wlist.end())
std::cout << "WARNING: Layout '" << file
<< "' has more than one root widget. Ignored.\n";
return res;
}
void turnGuiOff(MyGUI::WidgetPtr sender)
extern "C" MyGUI::WidgetPtr gui_getChild(MyGUI::WidgetPtr p, char* name)
{
guiMode = 1;
gui_toggleGui();
return p->findWidget(name);
}
extern "C" MyGUI::WidgetPtr gui_createText(const char *skin,
int32_t x, int32_t y,
int32_t w, int32_t h,
const char *layer)
{
return mGUI->createWidget<MyGUI::StaticText>
(skin,
x,y,w,h,
MyGUI::ALIGN_LEFT | MyGUI::ALIGN_TOP,
layer);
}
// Copied from MyGUI demo code, with a few modifications
@ -110,11 +155,37 @@ public:
mMainWidget->setCoord(x,y,w,h);
}
void setVisible(bool b)
{
mMainWidget->setVisible(b);
}
virtual ~Layout()
{
shutdown();
}
void setText(const char* name, const char* caption)
{
MyGUI::WidgetPtr pt;
getWidget(pt, name);
pt->setCaption(caption);
}
void setColor(const char* name, float r, float g, float b)
{
MyGUI::WidgetPtr pt;
getWidget(pt, name);
pt->setTextColour(Ogre::ColourValue(b,g,r));
}
void setImage(const char* name, const char* imgName)
{
MyGUI::StaticImagePtr pt;
getWidget(pt, name);
pt->setImageTexture(imgName);
}
protected:
MyGUI::WidgetPtr mMainWidget;
@ -197,7 +268,135 @@ public:
MyGUI::StaticImagePtr compass;
};
class MapWindow : public Layout
{
public:
MapWindow()
: Layout("openmw_map_window_layout.xml")
{
setCoord(500,0,320,300);
mMainWidget->setCaption(cellName);
setText("WorldButton", "World");
setColor("WorldButton", 0.75, 0.6, 0.35);
setImage("Compass", "compass.dds");
}
};
class MainMenu : public Layout
{
public:
MainMenu()
: Layout("openmw_mainmenu_layout.xml")
{
setCoord(0,0,
mWindow->getWidth(),
mWindow->getHeight());
}
};
class StatsWindow : public Layout
{
public:
void setBar(const char* name, const char* tname, int val, int max)
{
MyGUI::ProgressPtr pt;
getWidget(pt, name);
pt->setProgressRange(max);
pt->setProgressPosition(val);
std::stringstream out;
out << val << "/" << max;
setText(tname, out.str().c_str());
}
StatsWindow()
: Layout("openmw_stats_window_layout.xml")
{
setCoord(0,0,498, 342);
mMainWidget->setCaption("Playername");
setText("Health_str", "Health");
setText("Magicka_str", "Magicka");
setText("Fatigue_str", "Fatigue");
setText("Level_str", "Level");
setText("Race_str", "Race");
setText("Class_str", "Class");
setText("LevelText", "5");
setText("RaceText", "Wood Elf");
setText("ClassText", "Pilgrim");
setBar("HBar", "HBarT", 60, 100);
setBar("MBar", "MBarT", 30, 100);
setBar("FBar", "FBarT", 80, 100);
setText("Attrib1", "Strength");
setText("Attrib2", "Intelligence");
setText("Attrib3", "Willpower");
setText("Attrib4", "Agility");
setText("Attrib5", "Speed");
setText("Attrib6", "Endurance");
setText("Attrib7", "Personality");
setText("Attrib8", "Luck");
setText("AttribVal1", "30");
setText("AttribVal2", "40");
setText("AttribVal3", "30");
setText("AttribVal4", "75");
setText("AttribVal5", "50");
setText("AttribVal6", "40");
setText("AttribVal7", "50");
setText("AttribVal8", "40");
}
};
HUD *hud;
StatsWindow *stats;
MapWindow *map;
MyGUI::WidgetPtr FPSText;
MyGUI::WindowPtr mwindow;
OIS::MouseState state;
// KILLME
extern "C" void gui_toggleGui()
{
if(guiMode == 1)
{
guiMode = 0;
mGUI->hidePointer();
if(mwindow)
mwindow->setVisible(false);
if(stats)
stats->setVisible(false);
if(map)
map->setVisible(false);
state = mMouse->getMouseState();
}
else
{
// Restore the GUI mouse position. This is a hack because silly
// OIS doesn't allow us to set the mouse position ourselves.
*((OIS::MouseState*)&(mMouse->getMouseState())) = state;
mGUI->injectMouseMove(state.X.abs, state.Y.abs, 0);
guiMode = 1;
mGUI->showPointer();
if(mwindow)
mwindow->setVisible(true);
if(stats)
stats->setVisible(true);
if(map)
map->setVisible(true);
}
}
// KILLME
void turnGuiOff(MyGUI::WidgetPtr sender)
{
guiMode = 1;
gui_toggleGui();
}
extern "C" void gui_setupGUI()
{
@ -209,29 +408,19 @@ extern "C" void gui_setupGUI()
int mWidth = mWindow->getWidth();
int mHeight = mWindow->getHeight();
int width = 120;
int height = 30;
// FPS Ticker
FPSText = mGUI->createWidget<MyGUI::Widget>
("StaticText",
mWidth - width -10, 10, // Position
width, height, // Size
MyGUI::ALIGN_RIGHT | MyGUI::ALIGN_TOP,
"Statistic");
FPSText->setTextAlign(MyGUI::ALIGN_RIGHT);
FPSText->setNeedMouseFocus(false);
FPSText->setTextColour(Ogre::ColourValue::White);
stats = new StatsWindow();
map = new MapWindow();
/*
// Window with Morrowind skin
mwindow = mGUI->createWidget<MyGUI::Window>
("MW_Window",
(mWidth-width)/4, (mHeight-height)/4, // Position
300, 190, // Size
(mWidth-width)/2, (mHeight-height)/2, // Position
400, 190, // Size
MyGUI::ALIGN_DEFAULT, "Windows");
mwindow->setCaption("Skin test");
mwindow->setMinSize(120, 140);
mwindow->getClientWidget()->setAlpha(0.6);
MyGUI::WidgetPtr tmp;
tmp = mwindow->createWidget<MyGUI::Button>
@ -242,23 +431,23 @@ extern "C" void gui_setupGUI()
"MWButton1");
tmp->setCaption("Close");
tmp->eventMouseButtonClick = MyGUI::newDelegate(&turnGuiOff);
tmp->setInheritsAlpha(false);
tmp = mwindow->createWidget<MyGUI::StaticText>
("DaedricText_orig",
10,70,
300, 20,
20,80,
500, 30,
MyGUI::ALIGN_LEFT | MyGUI::ALIGN_TOP,
"Daed1");
tmp->setCaption("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
tmp = mwindow->createWidget<MyGUI::StaticText>
("DaedricText",
10,100,
300, 20,
20,130,
500, 30,
MyGUI::ALIGN_LEFT | MyGUI::ALIGN_TOP,
"Daed2");
tmp->setCaption("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
*/
// Turn the GUI off at startup
turnGuiOff(NULL);
@ -266,8 +455,7 @@ extern "C" void gui_setupGUI()
state.X.abs = mWidth / 2;
state.Y.abs = mHeight / 2;
MyGUI::ProgressPtr prog;
//*
// Set up the HUD
hud = new HUD();
@ -281,10 +469,7 @@ extern "C" void gui_setupGUI()
hud->setSpellStatus(65, 100);
hud->setEffect("icons\\s\\tx_s_chameleon.dds");
}
//*/
extern "C" void gui_setFpsText(char *str)
{
if(FPSText != NULL)
FPSText->setCaption(str);
//new MainMenu();
}

@ -0,0 +1,255 @@
/*
OpenMW - The completely unofficial reimplementation of Morrowind
Copyright (C) 2008-2009 Nicolay Korslund
Email: < korslund@gmail.com >
WWW: http://openmw.snaptoad.com/
This file (gui.d) is part of the OpenMW package.
OpenMW is distributed as free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License
version 3, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
version 3 along with this program. If not, see
http://www.gnu.org/licenses/ .
*/
module ogre.gui;
import monster.monster;
import ogre.bindings;
import std.string;
// Widget class and gui module
MonsterClass
gmc, // GUI module
wid_mc, // Widget
but_mc, // Button
tex_mc, // StaticText
img_mc, // StaticImage
pro_mc, // Progress
win_mc; // Window
MWidget[WidgetPtr] gui_store;
class MWidget
{
WidgetPtr widget;
MonsterObject *mo;
// Used for layouts
bool isLayout;
char[] prefix;
// For layouts
this(char[] layout, WidgetPtr parent = null)
{
assert(layout.length);
isLayout = true;
prefix = format("%s", cast(void*)this);
widget = gui_loadLayout(layout.ptr, prefix.ptr, parent);
if(widget is null)
fail("Layout " ~ layout ~ " is empty");
this();
}
// For normal widgets
this(WidgetPtr w)
{
isLayout = false;
widget = w;
assert(widget !is null);
this();
}
private this()
{
assert(widget !is null);
// Create the object from the right class
mo = toClass(widget).createObject();
// But store the pointer in the Widget's pointer slot
mo.getExtra(wid_mc).obj = this;
// Also store a lookup for later
gui_store[widget] = this;
}
MWidget getChild(char[] name)
{
if(prefix.length)
name = prefix ~ name;
// Get the child widget
auto pt = gui_getChild(widget, name.ptr);
if(pt is null)
fail("Widget has no child named " ~ name);
// Return the MWidget
return get(pt);
}
// Return the MonsterClass corresponding to a given widget.
private static MonsterClass toClass(WidgetPtr p)
{
switch(widgetType(p))
{
/*
case "Button": return but_mc;
case "StaticText": return tex_mc;
case "StaticImage": return img_mc;
case "Progress": return pro_mc;
case "Window": return win_mc;
*/
default:
// Use "Widget" for all unimplemented types
case "Widget": return wid_mc;
}
}
// Get the MWidget (and associatied MonsterObject) corresponding to
// a given Widget.
static MWidget get(WidgetPtr wid)
{
// First, check if the instance exists
auto p = wid in gui_store;
if(p) return *p;
// No MWidget exists. We have to create one.
return new MWidget(wid);
}
};
char[] widgetType(WidgetPtr p)
{
return toString(gui_widgetType(p));
}
MWidget getMWOwner(MonsterObject *mo)
{
return (cast(MWidget)mo.getExtra(wid_mc).obj);
}
MWidget getMWOwner()
{
return getMWOwner(params.obj());
}
WidgetPtr getOwner(MonsterObject *mo)
{
return getMWOwner(mo).widget;
}
WidgetPtr getOwner()
{
return getMWOwner().widget;
}
// Widget functions
void setCaption()
{
AIndex[] args = stack.popAArray();
char[] res;
foreach(AIndex ind; args)
res ~= format("%s", arrays.getRef(ind).carr);
gui_setCaption(getOwner(), res.ptr);
}
void setNeedMouseFocus()
{ gui_setNeedMouseFocus(getOwner(), stack.popBool); }
void setTextColor()
{
float b = stack.popFloat();
float g = stack.popFloat();
float r = stack.popFloat();
gui_setTextColor(getOwner(), r,g,b);
}
void setCoord()
{
int h = stack.popInt();
int w = stack.popInt();
int y = stack.popInt();
int x = stack.popInt();
gui_setCoord(getOwner(), x,y,w,h);
}
void get()
{
// Get the owner MWidget
auto mw = getMWOwner();
// Get the child
mw = mw.getChild(stack.popString8());
// Push the object
stack.pushObject(mw.mo);
}
// TODO: These are all written to be used with the 'gui' module. Later
// they should be part of Widget, and create child widgets. When used
// with 'gui' they create root widgets.
void loadLayout()
{
MWidget mw = new MWidget(stack.popString8());
stack.pushObject(mw.mo);
}
void text()
{
char[] layer = stack.popString8();
int h = stack.popInt();
int w = stack.popInt();
int y = stack.popInt();
int x = stack.popInt();
char[] skin = stack.popString8();
WidgetPtr ptr = gui_createText(skin.ptr,
x,y,w,h,
layer.ptr);
assert(widgetType(ptr) == "StaticText");
MWidget mw = new MWidget(ptr);
stack.pushObject(mw.mo);
}
void getWidth()
{
stack.pushInt(gui_getWidth(null));
}
void getHeight()
{
stack.pushInt(gui_getHeight(null));
}
void setupGUIScripts()
{
vm.addPath("mscripts/gui/");
vm.addPath("mscripts/gui/module/");
gmc = new MonsterClass("gui", "gui.mn");
wid_mc = new MonsterClass("Widget", "widget.mn");
/*
but_mc = new MonsterClass("Button", "button.mn");
tex_mc = new MonsterClass("Text", "text.mn");
img_mc = new MonsterClass("Image", "image.mn");
pro_mc = new MonsterClass("Progress", "progress.mn");
win_mc = new MonsterClass("Window", "window.mn");
*/
wid_mc.bind("setCaption", &setCaption);
wid_mc.bind("setNeedMouseFocus", &setNeedMouseFocus);
wid_mc.bind("setTextColor", &setTextColor);
wid_mc.bind("setCoord", &setCoord);
wid_mc.bind("get", &get);
gmc.bind("text", &text);
gmc.bind("loadLayout", &loadLayout);
gmc.bind("getWidth", &getWidth);
gmc.bind("getHeight", &getHeight);
}

@ -1,6 +1,6 @@
/*
OpenMW - The completely unofficial reimplementation of Morrowind
Copyright (C) 2008 Nicolay Korslund
Copyright (C) 2008-2009 Nicolay Korslund
Email: < korslund@gmail.com >
WWW: http://openmw.snaptoad.com/
@ -27,6 +27,8 @@ import core.resource;
import core.config;
import ogre.bindings;
import mscripts.setup;
import bullet.bindings;
import util.uniquename;
import std.stdio;
@ -116,9 +118,12 @@ void setupOgre()
// exterior cells differently, etc.
ogre_makeScene();
// Load the GUI elements
// Load the GUI system
gui_setupGUI();
// Run the GUI scripts
runGUIScripts();
ogreSetup = true;
}

@ -224,6 +224,10 @@ void main(char[][] args)
return null;
}
if(cd.inCell !is null)
// Set the name for the GUI (temporary hack)
gui_setCellName(cd.inCell.id.ptr);
if(render)
{
// Warm up OGRE

Loading…
Cancel
Save