massive improvements to looks of options and help menus

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3456 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-05-03 16:16:11 +00:00
parent 99c171e3f4
commit 720bbbaee0
14 changed files with 565 additions and 430 deletions

BIN
data/gui/glass_section.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -1,44 +1,48 @@
<div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" > <div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" >
<label align="center" text="SuperTuxKart Help"/> <label align="center" text="SuperTuxKart Help"/>
<tabs id="category" height="10%" max_height="110" width="100%" align="center"> <tabs id="category" height="10%" max_height="110" width="100%" align="center">
<icon-button id="page1" width="128" height="128" icon="gui/track_random.png" text="General"/> <icon-button id="page1" width="128" height="128" icon="gui/track_random.png" text="General"/>
<icon-button id="page2" width="128" height="128" icon="gui/mode_normal.png" text="Weapons"/> <icon-button id="page2" width="128" height="128" icon="gui/mode_normal.png" text="Weapons"/>
<icon-button id="page3" width="128" height="128" icon="gui/mode_ftl.png" text="Game Modes"/> <icon-button id="page3" width="128" height="128" icon="gui/mode_ftl.png" text="Game Modes"/>
</tabs> </tabs>
<spacer proportion="1" width="10" proportion="1"/> <box proportion="1" width="100%" layout="vertical-row">
<label align="center" text="Make your rivals bite dust!"/>
<label align="center" text="Make your rivals bite dust!"/> <spacer height="25" width="10"/>
<spacer height="25" width="10"/> <div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="textures/bonusblock2.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true"
text="Collect blue boxes : they will give you weapons or other powerups"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row"> <div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="textures/bonusblock2.png"/> <icon align="center" icon="textures/nitro-particle.png"/>
<spacer width="25" height="25"/> <spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="Collect blue boxes : they will give you weapons or other powerups"/> <label proportion="1" height="100%" align="left" word_wrap="true"
</div> text="Collecting nitro allows you to get speed boosts whenever you wish by pressing the appropriate key. You can see your current level of nitro in the bar at the right of the game screen."/>
</div>
<div width="100%" proportion="1" layout="horizontal-row"> <div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="textures/nitro-particle.png"/> <icon align="center" icon="textures/gui_lock.png"/>
<spacer width="25" height="25"/> <spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="Collecting nitro allows you to get speed boosts whenever you wish by pressing the appropriate key. You can see your current level of nitro in the bar at the right of the game screen."/> <label proportion="1" height="100%" align="left" word_wrap="true"
</div> text="If you see a button with a lock like this one, you need to complete a challenge to unlock it."/>
</div>
<div width="100%" proportion="1" layout="horizontal-row"> <label align="left" word_wrap="true" width="100%" proportion="1" text="The 'sharp turn' key allows you to do sharp turns and have better control in tight curves"/>
<icon align="center" icon="textures/gui_lock.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="If you see a button with a lock like this one, you need to complete a challenge to unlock it."/>
</div>
<label align="left" word_wrap="true" width="100%" proportion="1" text="The 'sharp turn' key allows you to do sharp turns and have better control in tight curves"/> <spacer proportion="1" width="10" proportion="1"/>
<spacer proportion="1" width="10" proportion="1"/> <label align="center" text="* Current key bindings can be seen/changed in menu Options"/>
<label align="center" text="* Current key bindings can be seen/changed in menu Options"/> </box>
<spacer width="50" height="45" />
<spacer width="50" height="45" />
</div> </div>
<button id="back" x="20" y="-40" width="250" height="35" align="left" text="Back to main menu"/> <button id="back" x="20" y="-40" width="250" height="35" align="left" text="Back to main menu"/>

View File

@ -1,56 +1,57 @@
<div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" > <div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" >
<label align="center" text="SuperTuxKart Help"/> <label align="center" text="SuperTuxKart Help"/>
<tabs id="category" height="10%" max_height="110" width="100%" align="center"> <tabs id="category" height="10%" max_height="110" width="100%" align="center">
<icon-button id="page1" width="128" height="128" icon="gui/track_random.png" text="General"/> <icon-button id="page1" width="128" height="128" icon="gui/track_random.png" text="General"/>
<icon-button id="page2" width="128" height="128" icon="gui/mode_normal.png" text="Weapons"/> <icon-button id="page2" width="128" height="128" icon="gui/mode_normal.png" text="Weapons"/>
<icon-button id="page3" width="128" height="128" icon="gui/mode_ftl.png" text="Game Modes"/> <icon-button id="page3" width="128" height="128" icon="gui/mode_ftl.png" text="Game Modes"/>
</tabs> </tabs>
<spacer proportion="1" width="10" proportion="1"/> <box proportion="1" width="100%" layout="vertical-row">
<label align="center" text="To help you win, there are some powerups you can collect :"/>
<label align="center" text="To help you win, there are some powerups you can collect :"/>
<spacer height="25" width="10"/>
<spacer height="25" width="10"/>
<div width="100%" proportion="1" layout="horizontal-row">
<div width="100%" proportion="1" layout="horizontal-row"> <icon align="center" icon="textures/bubblegum-icon.png"/>
<icon align="center" icon="textures/bubblegum-icon.png"/> <spacer width="25" height="25"/>
<spacer width="25" height="25"/> <label proportion="1" height="100%" align="left" word_wrap="true" text="BubbleGum - leave a sticky pink puddle behind you"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="BubbleGum - leave a sticky pink puddle behind you"/> </div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="textures/cake-icon.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true"
text="Cake - thrown at the closest rival, best on short ranges and long straights"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="textures/plunger-icon.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="Plunger - throw straight to pull an opponent back, or throw while looking back to make one lose sight!"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="textures/bowling-icon.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true"
text="Bowling Ball - bounces off walls. If you are looking back,\nit will be thrown backwards."/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="textures/parachute.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="Parachute - slows down all karts in a better position!"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="textures/anchor-icon.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="Anchor - slows down greatly the kart in the first position"/>
</div>
</box>
<spacer width="50" height="45" />
</div> </div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="textures/cake-icon.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="Cake - thrown at the closest rival, best on short ranges and long straights"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="textures/plunger-icon.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="Plunger - throw straight to pull an opponent back, or throw while looking back to make one lose sight!"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="textures/bowling-icon.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="Bowling Ball - bounces off walls. If you are looking back,\nit will be thrown backwards."/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="textures/parachute.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="Parachute - slows down all karts in a better position!"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="textures/anchor-icon.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="Anchor - slows down greatly the kart in the first position"/>
</div>
<spacer width="50" height="45" />
</div>
<button id="back" x="20" y="-40" width="250" height="35" align="left" text="Back to main menu"/> <button id="back" x="20" y="-40" width="250" height="35" align="left" text="Back to main menu"/>

View File

@ -1,48 +1,52 @@
<div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" > <div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" >
<label align="center" text="SuperTuxKart Help"/> <label align="center" text="SuperTuxKart Help"/>
<tabs id="category" height="10%" max_height="110" width="100%" align="center">
<icon-button id="page1" width="128" height="128" icon="gui/track_random.png" text="General"/>
<icon-button id="page2" width="128" height="128" icon="gui/mode_normal.png" text="Weapons"/>
<icon-button id="page3" width="128" height="128" icon="gui/mode_ftl.png" text="Game Modes"/>
</tabs>
<box proportion="1" width="100%" layout="vertical-row">
<label align="center" text="SuperTuxKart features several game modes (TO BE UPDATED FOR NEW GUI LAYOUT!!)"/>
<spacer height="25" width="10"/>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="gui/mode_normal.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true"
text="Regular Race (TODO - find a better name :( ) - all blows allowed, so catch weapons and make clever use of them!"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="gui/mode_tt.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true"
text="Time Trial: Contains no powerups, so only your driving skills matter!"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="gui/mode_ftl.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true"
text="Follow the leader: run for second place, as the last kart will be disqualified every time the counter hits zero. Beware : going in front of the leader will get you eliminated too!"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="gui/mode_3strikes.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true"
text="3 Strikes Battle : only in multiplayer games. Hit others with weapons until they lose all their lives."/>
</div>
<label proportion="1" width="100%" align="left" word_wrap="true" text="* Most of these game modes can also be played in a Grand Prix fashion : instead of playing a single race, you play many in a row. The better you rank, the more points you get. In the end, the player with the most points wins the cup."/>
<tabs id="category" height="10%" max_height="110" width="100%" align="center"> </box>
<icon-button id="page1" width="128" height="128" icon="gui/track_random.png" text="General"/> <spacer width="50" height="45" />
<icon-button id="page2" width="128" height="128" icon="gui/mode_normal.png" text="Weapons"/>
<icon-button id="page3" width="128" height="128" icon="gui/mode_ftl.png" text="Game Modes"/>
</tabs>
<spacer proportion="1" width="10" proportion="1"/>
<label align="center" text="SuperTuxKart features several game modes (TO BE UPDATED FOR NEW GUI LAYOUT!!)"/>
<spacer height="25" width="10"/>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="gui/mode_normal.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="Regular Race (TODO - find a better name :( ) - all blows allowed, so catch weapons and make clever use of them!"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="gui/mode_tt.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="Time Trial: Contains no powerups, so only your driving skills matter!"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="gui/mode_ftl.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="Follow the leader: run for second place, as the last kart will be disqualified every time the counter hits zero. Beware : going in front of the leader will get you eliminated too!"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="gui/mode_3strikes.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="3 Strikes Battle : only in multiplayer games. Hit others with weapons until they lose all their lives."/>
</div>
<label proportion="1" width="100%" align="left" word_wrap="true" text="* Most of these game modes can also be played in a Grand Prix fashion : instead of playing a single race, you play many in a row. The better you rank, the more points you get. In the end, the player with the most points wins the cup."/>
<spacer width="50" height="45" />
</div> </div>
<button id="back" x="20" y="-40" width="250" height="35" align="left" text="Back to main menu"/> <button id="back" x="20" y="-40" width="250" height="35" align="left" text="Back to main menu"/>

View File

@ -1,52 +1,59 @@
<div x="5%" y="2%" width="90%" height="96%" layout="vertical-row" > <div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" >
<label align="center" text="SuperTuxKart Options"/>
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
<icon-button id="audio_video" width="128" height="128" icon="gui/options_audio_video.png" text="Audio/Video"/>
<icon-button id="players" width="128" height="128" icon="gui/options_players.png" text="Players"/>
<icon-button id="controls" width="128" height="128" icon="gui/options_input.png" text="Controls"/>
</tabs>
<spacer height="25" width="10"/>
<div width="75%" height="40" layout="horizontal-row" >
<label proportion="2" height="100%" text="Music"/>
<checkbox id="music_enabled" width="40" icon="gui/glasscheckbox.png" height="40"/>
<spacer width="20" height="100%" />
<label proportion="1" height="100%" text="Enabled"/>
</div>
<div width="75%" height="30" layout="horizontal-row" >
<spacer proportion="1" height="100%"/>
<gauge id="music_volume" proportion="1" height="100%"/>
</div>
<spacer height="25" width="10"/>
<div width="75%" height="40" layout="horizontal-row" >
<label proportion="2" height="100%" text="Sound Effects"/>
<checkbox id="sfx_enabled" width="40" height="40"/>
<spacer width="20" height="100%" />
<label proportion="1" height="100%" text="Enabled"/>
</div>
<div width="75%" height="30" layout="horizontal-row" >
<spacer proportion="1" height="100%"/>
<gauge id="sfx_volume" proportion="1" height="100%"/>
</div>
<spacer proportion="1" width="10"/>
<div width="75%" height="40" layout="horizontal-row" >
<label proportion="2" height="100%" text="Video"/>
<checkbox id="fullscreen" width="40" height="40"/>
<spacer width="20" height="100%" />
<label proportion="1" height="100%" text="Fullscreen"/>
</div>
<scrollable_ribbon id="resolutions" proportion="2" text="all" width="100%" square_items="false" align="center" child_width="128" child_height="128" />
<button id="apply_resolution" width="20%" height="30" text="Apply video changes" />
<label align="center" text="SuperTuxKart Options"/>
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
<icon-button id="audio_video" width="128" height="128" icon="gui/options_audio_video.png" text="Audio/Video"/>
<icon-button id="players" width="128" height="128" icon="gui/options_players.png" text="Players"/>
<icon-button id="controls" width="128" height="128" icon="gui/options_input.png" text="Controls"/>
</tabs>
<box proportion="1" width="100%" layout="vertical-row">
<spacer height="15" width="10"/>
<div width="75%" height="40" layout="horizontal-row" >
<label proportion="2" height="100%" text="Music"/>
<checkbox id="music_enabled" width="40" icon="gui/glasscheckbox.png" height="40"/>
<spacer width="20" height="100%" />
<label proportion="1" height="100%" text="Enabled"/>
</div>
<div width="75%" height="30" layout="horizontal-row" >
<spacer proportion="1" height="100%"/>
<gauge id="music_volume" proportion="1" height="100%"/>
</div>
<spacer height="15" width="10"/>
<div width="75%" height="40" layout="horizontal-row" >
<label proportion="2" height="100%" text="Sound Effects"/>
<checkbox id="sfx_enabled" width="40" height="40"/>
<spacer width="20" height="100%" />
<label proportion="1" height="100%" text="Enabled"/>
</div>
<div width="75%" height="30" layout="horizontal-row" >
<spacer proportion="1" height="100%"/>
<gauge id="sfx_volume" proportion="1" height="100%"/>
</div>
<spacer height="20" width="10"/>
<div width="75%" height="40" layout="horizontal-row" >
<label proportion="2" height="100%" text="Video"/>
<checkbox id="fullscreen" width="40" height="40"/>
<spacer width="20" height="100%" />
<label proportion="1" height="100%" text="Fullscreen"/>
</div>
<scrollable_ribbon id="resolutions" proportion="2" text="all" width="100%" square_items="false"
align="center" child_width="128" child_height="128" max_height="150" />
<button id="apply_resolution" width="20%" height="30" text="Apply video changes" />
</box>
<spacer height="15" width="10"/>
</div> </div>

View File

@ -1,80 +1,83 @@
<div x="5%" y="2%" width="90%" height="96%" layout="vertical-row" > <div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" >
<label align="center" text="SuperTuxKart Options"/> <label align="center" text="SuperTuxKart Options"/>
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center"> <tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
<icon-button id="audio_video" width="128" height="128" icon="gui/options_audio_video.png" text="Audio/Video"/> <icon-button id="audio_video" width="128" height="128" icon="gui/options_audio_video.png" text="Audio/Video"/>
<icon-button id="players" width="128" height="128" icon="gui/options_players.png" text="Players"/> <icon-button id="players" width="128" height="128" icon="gui/options_players.png" text="Players"/>
<icon-button id="controls" width="128" height="128" icon="gui/options_input.png" text="Controls"/> <icon-button id="controls" width="128" height="128" icon="gui/options_input.png" text="Controls"/>
</tabs> </tabs>
<spacer height="15" width="10" /> <box proportion="1" width="100%" layout="vertical-row">
<scrollable_ribbon id="devices" proportion="3" text="all" width="100%" square_items="false" align="center" child_width="256" child_height="128" /> <scrollable_ribbon id="devices" proportion="3" text="all" width="100%" square_items="false" align="center" child_width="256" child_height="128" />
<div width="75%" proportion="1" layout="horizontal-row" > <div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Accelerate"/> <label proportion="2" height="100%" text="Accelerate"/>
<spacer width="20" height="100%" /> <spacer width="20" height="100%" />
<button id="binding_up" proportion="1" height="100%" text="[none]"/> <button id="binding_up" proportion="1" height="100%" text="[none]"/>
</div> </div>
<spacer height="5" width="10"/> <spacer height="5" width="10"/>
<div width="75%" proportion="1" layout="horizontal-row" > <div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Brake"/> <label proportion="2" height="100%" text="Brake"/>
<spacer width="20" height="100%" /> <spacer width="20" height="100%" />
<button id="binding_down" proportion="1" height="100%" text="[none]"/> <button id="binding_down" proportion="1" height="100%" text="[none]"/>
</div> </div>
<spacer height="5" width="10"/> <spacer height="5" width="10"/>
<div width="75%" proportion="1" layout="horizontal-row" > <div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Left"/> <label proportion="2" height="100%" text="Left"/>
<spacer width="20" height="100%" /> <spacer width="20" height="100%" />
<button id="binding_left" proportion="1" height="100%" text="[none]"/> <button id="binding_left" proportion="1" height="100%" text="[none]"/>
</div> </div>
<spacer height="5" width="10"/> <spacer height="5" width="10"/>
<div width="75%" proportion="1" layout="horizontal-row" > <div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Right"/> <label proportion="2" height="100%" text="Right"/>
<spacer width="20" height="100%" /> <spacer width="20" height="100%" />
<button id="binding_right" proportion="1" height="100%" text="[none]"/> <button id="binding_right" proportion="1" height="100%" text="[none]"/>
</div> </div>
<spacer height="5" width="10"/> <spacer height="5" width="10"/>
<div width="75%" proportion="1" layout="horizontal-row" > <div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Fire"/> <label proportion="2" height="100%" text="Fire"/>
<spacer width="20" height="100%" /> <spacer width="20" height="100%" />
<button id="binding_fire" proportion="1" height="100%" text="[none]"/> <button id="binding_fire" proportion="1" height="100%" text="[none]"/>
</div> </div>
<spacer height="5" width="10"/> <spacer height="5" width="10"/>
<div width="75%" proportion="1" layout="horizontal-row" > <div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Nitro"/> <label proportion="2" height="100%" text="Nitro"/>
<spacer width="20" height="100%" /> <spacer width="20" height="100%" />
<button id="binding_nitro" proportion="1" height="100%" text="[none]"/> <button id="binding_nitro" proportion="1" height="100%" text="[none]"/>
</div> </div>
<spacer height="5" width="10"/> <spacer height="5" width="10"/>
<div width="75%" proportion="1" layout="horizontal-row" > <div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Sharp Turn"/> <label proportion="2" height="100%" text="Sharp Turn"/>
<spacer width="20" height="100%" /> <spacer width="20" height="100%" />
<button id="binding_drift" proportion="1" height="100%" text="[none]"/> <button id="binding_drift" proportion="1" height="100%" text="[none]"/>
</div> </div>
<spacer height="5" width="10"/> <spacer height="5" width="10"/>
<div width="75%" proportion="1" layout="horizontal-row" > <div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Rescue"/> <label proportion="2" height="100%" text="Rescue"/>
<spacer width="20" height="100%" /> <spacer width="20" height="100%" />
<button id="binding_rescue" proportion="1" height="100%" text="[none]"/> <button id="binding_rescue" proportion="1" height="100%" text="[none]"/>
</div> </div>
<spacer height="5" width="10"/> <spacer height="5" width="10"/>
<div width="75%" proportion="1" layout="horizontal-row" > <div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Look Back"/> <label proportion="2" height="100%" text="Look Back"/>
<spacer width="20" height="100%" /> <spacer width="20" height="100%" />
<button id="binding_look_back" proportion="1" height="100%" text="[none]"/> <button id="binding_look_back" proportion="1" height="100%" text="[none]"/>
</div> </div>
</box>
<spacer height="15" width="10"/>
</div> </div>

View File

@ -1,15 +1,19 @@
<div x="5%" y="2%" width="90%" height="96%" layout="vertical-row" > <div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" >
<label align="center" text="SuperTuxKart Options"/> <label align="center" text="SuperTuxKart Options"/>
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
<icon-button id="audio_video" width="128" height="128" icon="gui/options_audio_video.png" text="Audio/Video"/>
<icon-button id="players" width="128" height="128" icon="gui/options_players.png" text="Players"/>
<icon-button id="controls" width="128" height="128" icon="gui/options_input.png" text="Controls"/>
</tabs>
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center"> <box proportion="1" width="100%" layout="vertical-row">
<icon-button id="audio_video" width="128" height="128" icon="gui/options_audio_video.png" text="Audio/Video"/> <spacer width="20" height="20"/>
<icon-button id="players" width="128" height="128" icon="gui/options_players.png" text="Players"/> <list id="players" proportion="5" width="75%" align="center"/>
<icon-button id="controls" width="128" height="128" icon="gui/options_input.png" text="Controls"/> <spacer width="20" height="20"/>
</tabs> </box>
<spacer proportion="1" width="10" proportion="1"/> <spacer height="15" width="10"/>
<list id="players" proportion="5" width="75%" align="center"/>
</div> </div>

View File

@ -12,7 +12,7 @@
namespace GUIEngine namespace GUIEngine
{ {
IGUIEnvironment* g_env; IGUIEnvironment* g_env;
IGUISkin* g_skin = NULL; Skin* g_skin = NULL;
IGUIFont* g_font; IGUIFont* g_font;
IrrlichtDevice* g_device; IrrlichtDevice* g_device;
irr::video::IVideoDriver* g_driver; irr::video::IVideoDriver* g_driver;
@ -173,16 +173,19 @@ void init(IrrlichtDevice* device_a, IVideoDriver* driver_a, void (*eventCallback
//g_skin->setFont(g_env->getBuiltInFont(), EGDF_TOOLTIP); //g_skin->setFont(g_env->getBuiltInFont(), EGDF_TOOLTIP);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/** transmit event to user event callback (out of encapsulated GUI module) */
void transmitEvent(Widget* widget, std::string& name) void transmitEvent(Widget* widget, std::string& name)
{ {
assert(g_event_callback != NULL); assert(g_event_callback != NULL);
g_event_callback(widget, name); g_event_callback(widget, name);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void render(float elapsed_time) void render(float elapsed_time)
{ {
GUIEngine::dt = elapsed_time; GUIEngine::dt = elapsed_time;
// ---- background image
// on one end, making these static is not too clean. // on one end, making these static is not too clean.
// on another end, these variables are really only used locally, // on another end, these variables are really only used locally,
// and making them static avoids doing the same stupid computations every frame // and making them static avoids doing the same stupid computations every frame
@ -224,6 +227,10 @@ void render(float elapsed_time)
//GUIEngine::getDriver()->draw2DRectangle( SColor(255, 0, 150, 0), rect ); //GUIEngine::getDriver()->draw2DRectangle( SColor(255, 0, 150, 0), rect );
// ---- render sections (bounding boxes)
g_skin->renderSections();
// ---- let irrLicht do the rest (the Skin object will be called for further render)
g_env->drawAll(); g_env->drawAll();
} }

View File

@ -23,6 +23,8 @@ namespace GUIEngine
class Screen : public IEventReceiver class Screen : public IEventReceiver
{ {
friend class Skin;
bool m_loaded; bool m_loaded;
std::string m_filename; std::string m_filename;
ptr_vector<Widget, HOLD> m_widgets; ptr_vector<Widget, HOLD> m_widgets;

View File

@ -38,6 +38,13 @@ void parseScreenFileDiv(irr::io::IrrXMLReader* xml, ptr_vector<Widget>& append_t
type = WTYPE_DIV; type = WTYPE_DIV;
append_to.push_back(new Widget()); append_to.push_back(new Widget());
} }
else if (!strcmp("box", xml->getNodeName()))
{
type = WTYPE_DIV;
Widget* w = new Widget();
w->m_show_bounding_box = true;
append_to.push_back(w);
}
else if (!strcmp("ribbon", xml->getNodeName())) else if (!strcmp("ribbon", xml->getNodeName()))
{ {
type = WTYPE_RIBBON; type = WTYPE_RIBBON;
@ -162,6 +169,8 @@ if(prop_name != NULL) widget.m_properties[prop_flag] = prop_name; else widget.m_
// we're done parsing this 'div', return one step back in the recursive call // we're done parsing this 'div', return one step back in the recursive call
if (!strcmp("div", xml->getNodeName())) if (!strcmp("div", xml->getNodeName()))
return; return;
if (!strcmp("box", xml->getNodeName()))
return;
// we're done parsing this 'ribbon', return one step back in the recursive call // we're done parsing this 'ribbon', return one step back in the recursive call
if (!strcmp("ribbon", xml->getNodeName()) || if (!strcmp("ribbon", xml->getNodeName()) ||

View File

@ -38,6 +38,8 @@ Skin::Skin(IGUISkin* fallback_skin)
m_tex_fcheckbox = GUIEngine::getDriver()->getTexture( (file_manager->getGUIDir() + "/glasscheckbox_focus.png").c_str() ); m_tex_fcheckbox = GUIEngine::getDriver()->getTexture( (file_manager->getGUIDir() + "/glasscheckbox_focus.png").c_str() );
m_tex_dcheckbox = GUIEngine::getDriver()->getTexture( (file_manager->getGUIDir() + "/glasscheckbox_checked.png").c_str() ); m_tex_dcheckbox = GUIEngine::getDriver()->getTexture( (file_manager->getGUIDir() + "/glasscheckbox_checked.png").c_str() );
m_tex_dfcheckbox = GUIEngine::getDriver()->getTexture( (file_manager->getGUIDir() + "/glasscheckbox_checked_focus.png").c_str() ); m_tex_dfcheckbox = GUIEngine::getDriver()->getTexture( (file_manager->getGUIDir() + "/glasscheckbox_checked_focus.png").c_str() );
m_tex_section = GUIEngine::getDriver()->getTexture( (file_manager->getGUIDir() + "/glass_section.png").c_str() );
} }
Skin::~Skin() Skin::~Skin()
@ -46,12 +48,35 @@ Skin::~Skin()
} }
void Skin::drawBoxFromStretchableTexture(const core::rect< s32 > &dest, ITexture* source,
const int left_border, const int right_border, /** load default values */
const int top_border, const int bottom_border, BoxRenderParams::BoxRenderParams()
const bool preserve_h_aspect_ratios,
const float border_out_portion, int areas, const bool vertical_flip)
{ {
left_border = 0;
right_border = 0;
top_border = 0;
bottom_border = 0;
preserve_h_aspect_ratios = false;
hborder_out_portion = 0.5;
vborder_out_portion = 1.0;
areas = BODY | LEFT | RIGHT | TOP | BOTTOM;
vertical_flip = false;
}
void Skin::drawBoxFromStretchableTexture(const core::rect< s32 > &dest, ITexture* source, const BoxRenderParams& params)
{
const int left_border = params.left_border;
const int right_border = params.right_border;
const int top_border = params.top_border;
const int bottom_border = params.bottom_border;
const bool preserve_h_aspect_ratios = params.preserve_h_aspect_ratios;
const float hborder_out_portion = params.hborder_out_portion;
const float vborder_out_portion = params.vborder_out_portion;
int areas = params.areas;
const bool vertical_flip = params.vertical_flip;
// FIXME? - lots of things here will be re-calculated every frame, which is useless since // FIXME? - lots of things here will be re-calculated every frame, which is useless since
// widgets won't move, so they'd only need to be calculated once. // widgets won't move, so they'd only need to be calculated once.
const int texture_w = source->getSize().Width; const int texture_w = source->getSize().Width;
@ -95,7 +120,7 @@ void Skin::drawBoxFromStretchableTexture(const core::rect< s32 > &dest, ITexture
/* /*
The dest area is split this way. Borders can go a bit beyond the given area so The dest area is split this way. Borders can go a bit beyond the given area so
components inside don't go over the borders components inside don't go over the borders
(how much it exceeds horizontally is specified in 'border_out_portion'. vertically is always the totality) (how much it exceeds horizontally is specified in 'hborder_out_portion'. vertically is always the totality)
a----b--------------------c----+ a----b--------------------c----+
| | | | | | | |
@ -131,28 +156,22 @@ void Skin::drawBoxFromStretchableTexture(const core::rect< s32 > &dest, ITexture
} }
int dest_top_border = (int)(top_border *std::min<float>(yscale, 1.0)); int dest_top_border = (int)(top_border *std::min<float>(yscale, 1.0));
int dest_bottom_border = (int)(bottom_border*std::min<float>(yscale, 1.0)); int dest_bottom_border = (int)(bottom_border*std::min<float>(yscale, 1.0));
/* const float hborder_in_portion = 1 - hborder_out_portion;
if(vertical_flip) const float vborder_in_portion = 1 - vborder_out_portion;
{
int temp = dest_bottom_border;
dest_bottom_border = dest_top_border;
dest_top_border = temp;
}*/
const float border_in_portion = 1 - border_out_portion; const int ax = (int)(dest_x - dest_left_border*hborder_out_portion);
const int ay = (int)(dest_y - dest_top_border*vborder_out_portion);
const int ax = (int)(dest_x - dest_left_border*border_out_portion); const int bx = (int)(dest_x + dest_left_border*hborder_in_portion);
const int ay = dest_y - dest_top_border;
const int bx = (int)(dest_x + dest_left_border*border_in_portion);
const int by = ay; const int by = ay;
const int cx = (int)(dest_x2 - dest_right_border*border_in_portion); const int cx = (int)(dest_x2 - dest_right_border*hborder_in_portion);
const int cy = ay; const int cy = ay;
const int dx = ax; const int dx = ax;
const int dy = dest_y; const int dy = (int)(dest_y + dest_top_border*vborder_in_portion);
const int ex = bx; const int ex = bx;
const int ey = dy; const int ey = dy;
@ -160,11 +179,11 @@ void Skin::drawBoxFromStretchableTexture(const core::rect< s32 > &dest, ITexture
const int fx = cx; const int fx = cx;
const int fy = dy; const int fy = dy;
const int gx = (int)(dest_x2 + dest_right_border*border_out_portion); const int gx = (int)(dest_x2 + dest_right_border*hborder_out_portion);
const int gy = dy; const int gy = dy;
const int hx = ax; const int hx = ax;
const int hy = dest_y2; const int hy = (int)(dest_y2 - dest_bottom_border*vborder_in_portion);
const int ix = bx; const int ix = bx;
const int iy = hy; const int iy = hy;
@ -176,7 +195,7 @@ void Skin::drawBoxFromStretchableTexture(const core::rect< s32 > &dest, ITexture
const int ky = hy; const int ky = hy;
const int lx = bx; const int lx = bx;
const int ly = dest_y2 + dest_bottom_border; const int ly = (int)(dest_y2 + dest_bottom_border*vborder_out_portion);
const int mx = cx; const int mx = cx;
const int my = ly; const int my = ly;
@ -235,51 +254,51 @@ X.LowerRightCorner.Y = y1;}
#undef FLIP_Y #undef FLIP_Y
} }
if((areas & LEFT) != 0) if((areas & BoxRenderParams::LEFT) != 0)
{ {
GUIEngine::getDriver()->draw2DImage(source, dest_area_left, source_area_left, GUIEngine::getDriver()->draw2DImage(source, dest_area_left, source_area_left,
0 /* no clipping */, 0, true /* alpha */); 0 /* no clipping */, 0, true /* alpha */);
} }
if((areas & BODY) != 0) if((areas & BoxRenderParams::BODY) != 0)
{ {
GUIEngine::getDriver()->draw2DImage(source, dest_area_center, source_area_center, GUIEngine::getDriver()->draw2DImage(source, dest_area_center, source_area_center,
0 /* no clipping */, 0, true /* alpha */); 0 /* no clipping */, 0, true /* alpha */);
} }
if((areas & RIGHT) != 0) if((areas & BoxRenderParams::RIGHT) != 0)
{ {
GUIEngine::getDriver()->draw2DImage(source, dest_area_right, source_area_right, GUIEngine::getDriver()->draw2DImage(source, dest_area_right, source_area_right,
0 /* no clipping */, 0, true /* alpha */); 0 /* no clipping */, 0, true /* alpha */);
} }
if((areas & TOP) != 0) if((areas & BoxRenderParams::TOP) != 0)
{ {
GUIEngine::getDriver()->draw2DImage(source, dest_area_top, source_area_top, GUIEngine::getDriver()->draw2DImage(source, dest_area_top, source_area_top,
0 /* no clipping */, 0, true /* alpha */); 0 /* no clipping */, 0, true /* alpha */);
} }
if((areas & BOTTOM) != 0) if((areas & BoxRenderParams::BOTTOM) != 0)
{ {
GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom, source_area_bottom, GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom, source_area_bottom,
0 /* no clipping */, 0, true /* alpha */); 0 /* no clipping */, 0, true /* alpha */);
} }
if( ((areas & LEFT) != 0) && ((areas & TOP) != 0) ) if( ((areas & BoxRenderParams::LEFT) != 0) && ((areas & BoxRenderParams::TOP) != 0) )
{ {
GUIEngine::getDriver()->draw2DImage(source, dest_area_top_left, source_area_top_left, GUIEngine::getDriver()->draw2DImage(source, dest_area_top_left, source_area_top_left,
0 /* no clipping */, 0, true /* alpha */); 0 /* no clipping */, 0, true /* alpha */);
} }
if( ((areas & RIGHT) != 0) && ((areas & TOP) != 0) ) if( ((areas & BoxRenderParams::RIGHT) != 0) && ((areas & BoxRenderParams::TOP) != 0) )
{ {
GUIEngine::getDriver()->draw2DImage(source, dest_area_top_right, source_area_top_right, GUIEngine::getDriver()->draw2DImage(source, dest_area_top_right, source_area_top_right,
0 /* no clipping */, 0, true /* alpha */); 0 /* no clipping */, 0, true /* alpha */);
} }
if( ((areas & LEFT) != 0) && ((areas & BOTTOM) != 0) ) if( ((areas & BoxRenderParams::LEFT) != 0) && ((areas & BoxRenderParams::BOTTOM) != 0) )
{ {
GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom_left, source_area_bottom_left, GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom_left, source_area_bottom_left,
0 /* no clipping */, 0, true /* alpha */); 0 /* no clipping */, 0, true /* alpha */);
} }
if( ((areas & RIGHT) != 0) && ((areas & BOTTOM) != 0) ) if( ((areas & BoxRenderParams::RIGHT) != 0) && ((areas & BoxRenderParams::BOTTOM) != 0) )
{ {
GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom_right, source_area_bottom_right, GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom_right, source_area_bottom_right,
0 /* no clipping */, 0, true /* alpha */); 0 /* no clipping */, 0, true /* alpha */);
@ -290,15 +309,17 @@ X.LowerRightCorner.Y = y1;}
void Skin::drawButton(const core::rect< s32 > &rect, const bool pressed, const bool focused) void Skin::drawButton(const core::rect< s32 > &rect, const bool pressed, const bool focused)
{ {
// FIXME - move these numbers to a config file static BoxRenderParams params;
const int left_border = 80;
const int right_border = 80;
const int border_above = 0;
const int border_below = 36;
drawBoxFromStretchableTexture(rect, (focused ? m_tex_fbutton : m_tex_button), // FIXME - move these numbers to a config file
left_border, right_border, params.left_border = 80;
border_above, border_below, true /* horizontal aspect ratio kept */); params.right_border = 80;
params.top_border = 0;
params.bottom_border = 36;
params.preserve_h_aspect_ratios = true;
drawBoxFromStretchableTexture(rect, (focused ? m_tex_fbutton : m_tex_button), params);
} }
void Skin::drawRibbon(const core::rect< s32 > &rect, const Widget* widget, const bool pressed, bool focused) void Skin::drawRibbon(const core::rect< s32 > &rect, const Widget* widget, const bool pressed, bool focused)
@ -344,11 +365,12 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, const Widget* widget,
{ {
// ribbons containing buttons are actually tabs // ribbons containing buttons are actually tabs
static BoxRenderParams params;
// FIXME - specify in file, don't hardcode // FIXME - specify in file, don't hardcode
int left_border = 75; params.left_border = 75;
int right_border = 75; params.right_border = 75;
int border_above = 0; params.top_border = 0;
int border_below = 15; params.bottom_border = 15;
// automatically guess from position on-screen if tabs go up or down // automatically guess from position on-screen if tabs go up or down
const bool vertical_flip = rect.UpperLeftCorner.Y < GUIEngine::getDriver()->getCurrentRenderTargetSize().Height/2; const bool vertical_flip = rect.UpperLeftCorner.Y < GUIEngine::getDriver()->getCurrentRenderTargetSize().Height/2;
@ -362,6 +384,8 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, const Widget* widget,
core::rect< s32 > rect2 = rect; core::rect< s32 > rect2 = rect;
params.hborder_out_portion = portion_out;
params.vertical_flip = vertical_flip;
if (mark_selected) if (mark_selected)
{ {
@ -371,10 +395,7 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, const Widget* widget,
else else
rect2.LowerRightCorner.Y += 10; rect2.LowerRightCorner.Y += 10;
drawBoxFromStretchableTexture(rect2, (focused || parent_focused ? m_tex_ftab : m_tex_dtab), drawBoxFromStretchableTexture(rect2, (focused || parent_focused ? m_tex_ftab : m_tex_dtab), params);
left_border, right_border,
border_above, border_below, false /* horizontal aspect ratio not kept */, portion_out,
BODY | LEFT | RIGHT | TOP | BOTTOM, vertical_flip);
/* /*
GUIEngine::getDriver()->draw2DLine( core::position2d< s32 >(rect2.UpperLeftCorner.X,rect2.LowerRightCorner.Y), GUIEngine::getDriver()->draw2DLine( core::position2d< s32 >(rect2.UpperLeftCorner.X,rect2.LowerRightCorner.Y),
@ -388,10 +409,7 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, const Widget* widget,
} }
else else
{ {
drawBoxFromStretchableTexture(rect2, m_tex_tab, drawBoxFromStretchableTexture(rect2, m_tex_tab, params);
left_border, right_border,
border_above, border_below, false /* horizontal aspect ratio not kept */, portion_out,
BODY | LEFT | RIGHT | TOP | BOTTOM, vertical_flip);
} }
} }
@ -471,10 +489,14 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, const Widget* widget,
core::rect<s32> source_area = core::rect<s32>(0, 0, texture_w, texture_h); core::rect<s32> source_area = core::rect<s32>(0, 0, texture_w, texture_h);
drawBoxFromStretchableTexture(rect, m_tex_squarefocus, static BoxRenderParams params;
6 /* left border */, 6 /* rightborder */, params.left_border = 6;
6 /* top border */, 6 /* bottom border */, params.right_border = 6;
false /* horizontal aspect ratio not kept */, 1); params.top_border = 6;
params.bottom_border = 6;
params.hborder_out_portion = 1.0;
drawBoxFromStretchableTexture(rect, m_tex_squarefocus, params);
} }
} // end if mark_selected } // end if mark_selected
@ -484,12 +506,6 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, const Widget* widget,
void Skin::drawSpinnerBody(const core::rect< s32 > &rect, const Widget* widget, const bool pressed, bool focused) void Skin::drawSpinnerBody(const core::rect< s32 > &rect, const Widget* widget, const bool pressed, bool focused)
{ {
// FIXME - move these numbers to a config file
const int left_border = 110;
const int right_border = 110;
const int border_above = 0;
const int border_below = 36;
if(!focused) if(!focused)
{ {
IGUIElement* focused_widget = GUIEngine::getGUIEnv()->getFocus(); IGUIElement* focused_widget = GUIEngine::getGUIEnv()->getFocus();
@ -505,18 +521,22 @@ void Skin::drawSpinnerBody(const core::rect< s32 > &rect, const Widget* widget,
} }
} }
drawBoxFromStretchableTexture(rect, (focused || pressed ? m_tex_fspinner : m_tex_spinner), static BoxRenderParams params;
left_border, right_border, // FIXME - move these numbers to a config file
border_above, border_below, true /* horizontal aspect ratio kept */, 0); params.left_border = 110;
params.right_border = 110;
params.top_border = 0;
params.bottom_border = 36;
params.preserve_h_aspect_ratios = true;
params.hborder_out_portion = 0.0f;
drawBoxFromStretchableTexture(rect, (focused || pressed ? m_tex_fspinner : m_tex_spinner), params);
} }
void Skin::drawSpinnerChild(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused) void Skin::drawSpinnerChild(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused)
{ {
// FIXME - move these numbers to a config file
const int left_border = 110;
const int right_border = 110;
const int border_above = 0;
const int border_below = 36;
if(pressed) if(pressed)
{ {
@ -525,19 +545,26 @@ void Skin::drawSpinnerChild(const core::rect< s32 > &rect, Widget* widget, const
//std::cout << "drawing spinner child " << widget->m_properties[PROP_ID].c_str() << std::endl; //std::cout << "drawing spinner child " << widget->m_properties[PROP_ID].c_str() << std::endl;
if (widget->m_properties[PROP_ID] == "left") areas = LEFT; if (widget->m_properties[PROP_ID] == "left") areas = BoxRenderParams::LEFT;
else if (widget->m_properties[PROP_ID] == "right") areas = RIGHT; else if (widget->m_properties[PROP_ID] == "right") areas = BoxRenderParams::RIGHT;
else return; else return;
core::rect< s32 > rect2 = core::rect< s32 >( spinner->x, spinner->y, core::rect< s32 > rect2 = core::rect< s32 >( spinner->x, spinner->y,
spinner->x + spinner->w, spinner->x + spinner->w,
spinner->y + spinner->h ); spinner->y + spinner->h );
drawBoxFromStretchableTexture(rect2, m_tex_dspinner, static BoxRenderParams params;
left_border, right_border, // FIXME - move these numbers to a config file
border_above, border_below, params.left_border = 110;
true /* horizontal aspect ratio kept */, params.right_border = 110;
0, areas); params.top_border = 0;
params.bottom_border = 36;
params.preserve_h_aspect_ratios = true;
params.hborder_out_portion = 0.0f;
params.areas = areas;
drawBoxFromStretchableTexture(rect2, m_tex_dspinner, params);
} }
@ -545,16 +572,16 @@ void Skin::drawSpinnerChild(const core::rect< s32 > &rect, Widget* widget, const
void Skin::drawGauge(const core::rect< s32 > &rect, Widget* widget, bool focused) void Skin::drawGauge(const core::rect< s32 > &rect, Widget* widget, bool focused)
{ {
static BoxRenderParams params;
// FIXME - move these numbers to a config file // FIXME - move these numbers to a config file
const int left_border = 110; params.left_border = 110;
const int right_border = 110; params.right_border = 110;
const int border_above = 0; params.top_border = 0;
const int border_below = 36; params.bottom_border = 36;
drawBoxFromStretchableTexture(rect, (focused ? m_tex_fspinner : m_tex_spinner), params.hborder_out_portion = -0.9;
left_border, right_border,
border_above, border_below, drawBoxFromStretchableTexture(rect, (focused ? m_tex_fspinner : m_tex_spinner), params);
false /* horizontal aspect ratio kept */, -0.9);
} }
void Skin::drawGaugeFill(const core::rect< s32 > &rect, Widget* widget, bool focused) void Skin::drawGaugeFill(const core::rect< s32 > &rect, Widget* widget, bool focused)
{ {
@ -608,6 +635,57 @@ void Skin::drawCheckBox(const core::rect< s32 > &rect, Widget* widget, bool focu
} }
} }
/** recusrive function to render all sections (recursion allows to easily travesre the tree of children and sub-children) */
void Skin::renderSections(ptr_vector<Widget>* within_vector)
{
if(within_vector == NULL) within_vector = &getCurrentScreen()->m_widgets;
const unsigned short widgets_amount = within_vector->size();
for(int n=0; n<widgets_amount; n++)
{
Widget& widget = (*within_vector)[n];
if(widget.m_type == WTYPE_DIV)
{
if(widget.m_show_bounding_box)
{
core::rect< s32 > rect = core::rect<s32>( widget.x, widget.y, widget.x + widget.w, widget.y + widget.h );
//getDriver()->draw2DImage(g_skin->m_tex_section, rect, source_area,
// 0 /* no clipping */, 0, true /* alpha */);
static BoxRenderParams params;
params.left_border = 15;
params.right_border = 15;
params.top_border = 15;
params.bottom_border = 15;
params.hborder_out_portion = 1.0;
params.vborder_out_portion = 0.2;
drawBoxFromStretchableTexture( rect, m_tex_section, params );
/*
void drawBoxFromStretchableTexture(const core::rect< s32 > &dest, ITexture* source,
const int left_border, const int right_border,
const int top_border, const int bottom_border,
const bool preserve_h_aspect_ratios=false,
const float hborder_out_portion = 0.5,
int areas = BODY | LEFT | RIGHT | TOP | BOTTOM,
const bool vertical_flip=false);
*/
}
else
{
renderSections( &widget.m_children );
}
}
} // next
}
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark irrlicht skin functions #pragma mark irrlicht skin functions

View File

@ -2,6 +2,8 @@
#define HEADER_SKIN_HPP #define HEADER_SKIN_HPP
#include <irrlicht.h> #include <irrlicht.h>
#include "ptr_vector.hpp"
using namespace irr; using namespace irr;
using namespace core; using namespace core;
using namespace scene; using namespace scene;
@ -11,90 +13,103 @@ using namespace gui;
namespace GUIEngine namespace GUIEngine
{ {
class Widget; class Widget;
// areas /** class containing render params for the 'drawBoxFromStretchableTexture' function */
const int BODY = 1; class BoxRenderParams
const int LEFT = 2; {
const int RIGHT = 4; public:
const int TOP = 8; int left_border, right_border, top_border, bottom_border;
const int BOTTOM = 16; bool preserve_h_aspect_ratios;
float hborder_out_portion, vborder_out_portion;
bool vertical_flip;
/** bitmap containing which areas to render */
int areas;
// possible values in areas
static const int BODY = 1;
static const int LEFT = 2;
static const int RIGHT = 4;
static const int TOP = 8;
static const int BOTTOM = 16;
BoxRenderParams();
};
class Skin : public IGUISkin class Skin : public IGUISkin
{ {
IGUISkin* m_fallback_skin; IGUISkin* m_fallback_skin;
/* f : focused; d : down state */ /* f : focused; d : down state */
ITexture* m_tex_button; ITexture* m_tex_button;
ITexture* m_tex_fbutton; ITexture* m_tex_fbutton;
ITexture* m_tex_spinner; ITexture* m_tex_spinner;
ITexture* m_tex_fspinner; ITexture* m_tex_fspinner;
ITexture* m_tex_dspinner; ITexture* m_tex_dspinner;
ITexture* m_tex_tab; ITexture* m_tex_tab;
ITexture* m_tex_ftab; ITexture* m_tex_ftab;
ITexture* m_tex_dtab; ITexture* m_tex_dtab;
ITexture* m_tex_ficonhighlight; ITexture* m_tex_ficonhighlight;
ITexture* m_tex_bubble; ITexture* m_tex_bubble;
ITexture* m_tex_squarefocus; ITexture* m_tex_squarefocus;
ITexture* m_tex_gaugefill; ITexture* m_tex_gaugefill;
ITexture* m_tex_gauge; ITexture* m_tex_gauge;
ITexture* m_tex_checkbox; ITexture* m_tex_checkbox;
ITexture* m_tex_fcheckbox; ITexture* m_tex_fcheckbox;
ITexture* m_tex_dcheckbox; ITexture* m_tex_dcheckbox;
ITexture* m_tex_dfcheckbox; ITexture* m_tex_dfcheckbox;
void drawBoxFromStretchableTexture(const core::rect< s32 > &dest, ITexture* source,
const int left_border, const int right_border, void drawBoxFromStretchableTexture(const core::rect< s32 > &dest, ITexture* source, const BoxRenderParams& params);
const int top_border, const int bottom_border,
const bool preserve_h_aspect_ratios=false, public:
const float border_out_portion = 0.5, ITexture* m_tex_section;
int areas = BODY | LEFT | RIGHT | TOP | BOTTOM,
const bool vertical_flip=false); Skin(IGUISkin* fallback_skin);
~Skin();
public:
Skin(IGUISkin* fallback_skin); // my utility methods, to work around irrlicht's very Windows-95-like-look-enforcing skin system
~Skin(); void process3DPane(IGUIElement *element, const core::rect< s32 > &rect, const bool pressed);
void drawButton(const core::rect< s32 > &rect, const bool pressed, const bool focused);
// my utility methods, to work around irrlicht's very Windows-95-like-look-enforcing skin system void drawRibbon(const core::rect< s32 > &rect, const Widget* widget, const bool pressed, bool focused);
void process3DPane(IGUIElement *element, const core::rect< s32 > &rect, const bool pressed); void drawRibbonChild(const core::rect< s32 > &rect, const Widget* widget, const bool pressed, bool focused);
void drawButton(const core::rect< s32 > &rect, const bool pressed, const bool focused); void drawSpinnerChild(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused);
void drawRibbon(const core::rect< s32 > &rect, const Widget* widget, const bool pressed, bool focused); void drawSpinnerBody(const core::rect< s32 > &rect, const Widget* widget, const bool pressed, bool focused);
void drawRibbonChild(const core::rect< s32 > &rect, const Widget* widget, const bool pressed, bool focused); void drawGauge(const core::rect< s32 > &rect, Widget* widget, bool focused);
void drawSpinnerChild(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused); void drawGaugeFill(const core::rect< s32 > &rect, Widget* widget, bool focused);
void drawSpinnerBody(const core::rect< s32 > &rect, const Widget* widget, const bool pressed, bool focused); void drawCheckBox(const core::rect< s32 > &rect, Widget* widget, bool focused);
void drawGauge(const core::rect< s32 > &rect, Widget* widget, bool focused);
void drawGaugeFill(const core::rect< s32 > &rect, Widget* widget, bool focused); void renderSections(ptr_vector<Widget>* within_vector=NULL);
void drawCheckBox(const core::rect< s32 > &rect, Widget* widget, bool focused);
// irrlicht's callbacks
// irrlicht's callbacks virtual void draw2DRectangle (IGUIElement *element, const video::SColor &color, const core::rect< s32 > &pos, const core::rect< s32 > *clip);
virtual void draw2DRectangle (IGUIElement *element, const video::SColor &color, const core::rect< s32 > &pos, const core::rect< s32 > *clip); virtual void draw3DButtonPanePressed (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip);
virtual void draw3DButtonPanePressed (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip); virtual void draw3DButtonPaneStandard (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip);
virtual void draw3DButtonPaneStandard (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip); virtual void draw3DMenuPane (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip);
virtual void draw3DMenuPane (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip); virtual void draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, bool flat, bool fillBackGround, const core::rect< s32 > &rect, const core::rect< s32 > *clip);
virtual void draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, bool flat, bool fillBackGround, const core::rect< s32 > &rect, const core::rect< s32 > *clip); virtual void draw3DTabBody (IGUIElement *element, bool border, bool background, const core::rect< s32 > &rect, const core::rect< s32 > *clip, s32 tabHeight=-1, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT);
virtual void draw3DTabBody (IGUIElement *element, bool border, bool background, const core::rect< s32 > &rect, const core::rect< s32 > *clip, s32 tabHeight=-1, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT); virtual void draw3DTabButton (IGUIElement *element, bool active, const core::rect< s32 > &rect, const core::rect< s32 > *clip, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT);
virtual void draw3DTabButton (IGUIElement *element, bool active, const core::rect< s32 > &rect, const core::rect< s32 > *clip, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT); virtual void draw3DToolBar (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip);
virtual void draw3DToolBar (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip); virtual core::rect< s32 > draw3DWindowBackground (IGUIElement *element, bool drawTitleBar, video::SColor titleBarColor, const core::rect< s32 > &rect, const core::rect< s32 > *clip);
virtual core::rect< s32 > draw3DWindowBackground (IGUIElement *element, bool drawTitleBar, video::SColor titleBarColor, const core::rect< s32 > &rect, const core::rect< s32 > *clip); virtual void drawIcon (IGUIElement *element, EGUI_DEFAULT_ICON icon, const core::position2di position, u32 starttime, u32 currenttime, bool loop=false, const core::rect< s32 > *clip=NULL);
virtual void drawIcon (IGUIElement *element, EGUI_DEFAULT_ICON icon, const core::position2di position, u32 starttime, u32 currenttime, bool loop=false, const core::rect< s32 > *clip=NULL); virtual video::SColor getColor (EGUI_DEFAULT_COLOR color) const;
virtual video::SColor getColor (EGUI_DEFAULT_COLOR color) const; virtual const wchar_t * getDefaultText (EGUI_DEFAULT_TEXT text) const;
virtual const wchar_t * getDefaultText (EGUI_DEFAULT_TEXT text) const; virtual IGUIFont * getFont (EGUI_DEFAULT_FONT which=EGDF_DEFAULT) const ;
virtual IGUIFont * getFont (EGUI_DEFAULT_FONT which=EGDF_DEFAULT) const ; virtual u32 getIcon (EGUI_DEFAULT_ICON icon) const ;
virtual u32 getIcon (EGUI_DEFAULT_ICON icon) const ; virtual s32 getSize (EGUI_DEFAULT_SIZE size) const ;
virtual s32 getSize (EGUI_DEFAULT_SIZE size) const ; virtual IGUISpriteBank * getSpriteBank () const ;
virtual IGUISpriteBank * getSpriteBank () const ; //virtual EGUI_SKIN_TYPE getType () const;
//virtual EGUI_SKIN_TYPE getType () const; virtual void setColor (EGUI_DEFAULT_COLOR which, video::SColor newColor);
virtual void setColor (EGUI_DEFAULT_COLOR which, video::SColor newColor); virtual void setDefaultText (EGUI_DEFAULT_TEXT which, const wchar_t *newText);
virtual void setDefaultText (EGUI_DEFAULT_TEXT which, const wchar_t *newText); virtual void setFont (IGUIFont *font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT);
virtual void setFont (IGUIFont *font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT); virtual void setIcon (EGUI_DEFAULT_ICON icon, u32 index);
virtual void setIcon (EGUI_DEFAULT_ICON icon, u32 index); virtual void setSize (EGUI_DEFAULT_SIZE which, s32 size);
virtual void setSize (EGUI_DEFAULT_SIZE which, s32 size); virtual void setSpriteBank (IGUISpriteBank *bank);
virtual void setSpriteBank (IGUISpriteBank *bank);
};
};
} }
#endif #endif

View File

@ -43,6 +43,7 @@ Widget::Widget()
m_type = WTYPE_NONE; m_type = WTYPE_NONE;
m_selected = false; m_selected = false;
m_event_handler = NULL; m_event_handler = NULL;
m_show_bounding_box = false;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/** /**

View File

@ -108,8 +108,11 @@ namespace GUIEngine
static bool convertToCoord(std::string& x, int* absolute, int* percentage); static bool convertToCoord(std::string& x, int* absolute, int* percentage);
public: public:
Widget();
virtual ~Widget() {} virtual ~Widget() {}
bool m_show_bounding_box;
/** /**
* If this widget has any children, they go here. Children can be either * If this widget has any children, they go here. Children can be either
* specified in the XML file (e.g. Ribbon or Div children), or can also * specified in the XML file (e.g. Ribbon or Div children), or can also
@ -139,9 +142,6 @@ namespace GUIEngine
/** A map that holds values for all specified widget properties (in the XML file)*/ /** A map that holds values for all specified widget properties (in the XML file)*/
std::map<Property, std::string> m_properties; std::map<Property, std::string> m_properties;
Widget();
static void resetIDCounters(); static void resetIDCounters();
bool isSelected() const { return m_selected; } bool isSelected() const { return m_selected; }