Merge with trunk

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13097 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
unitraxx 2013-07-06 00:38:39 +00:00
commit bf13bed7a2
64 changed files with 692 additions and 1073 deletions

View File

@ -5,16 +5,16 @@
<div x="0" y="0" width="100%" layout="horizontal-row" height="8%">
<icon-button id="back" height="100%" icon="gui/back.png"/>
<header text_align="center" proportion="1" text="SuperTuxKart Addons" align="center"/>
<button id="reload" I18N="Reload button to reload addon data" text="Reload" />
<icon-button id="reload" height="90%" icon="gui/restart.png"/>
</div>
<box id="filter_box" width="97%" height="75" layout="vertical-row" align="center">
<div x="0" y="0" width="98%" height="100%" layout="horizontal-row" align="center">
<textbox id="filter_name" proportion="9" align="center" />
<spacer width="10" />
<label text="Updated" align="center" />
<label text="Updated" align="center" I18N="In addons screen, in the filtering bar, to enable a filter that will show only recently updated items"/>
<spinner id="filter_date" proportion="5" align="center" min_value="0" wrap_around="true"/>
<label text="Rating >=" align="center"/>
<label text="Rating >=" align="center" I18N="In addons screen, in the filtering bar, to enable a filter that will show only recently items with good rating"/>
<spinner id="filter_rating" proportion="3" align="center" min_value="0" wrap_around="true"/>
<icon-button id="filter_search" height="100%" icon="gui/search.png"/>
</div>

View File

@ -9,7 +9,7 @@
<spacer width="20" height="5" />
<box proportion="1" width="100%" layout="vertical-row">
<box proportion="1" width="100%" layout="vertical-row" padding="2">
<ribbon_grid id="tracks" proportion="1" width="100%" square_items="true"
label_location="bottom" align="center" child_width="160" child_height="120" />
<spacer width="20" height="13" />

View File

@ -1,14 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
<div x="5%" y="2%" width="90%" height="96%" layout="vertical-row" >
<div x="2%" y="2%" width="98%" height="96%" layout="vertical-row" >
<icon id="logo" align="center" proportion="4" width="100%" icon="gui/logo_slim.png"/>
<header I18N="Title in credits screen" text="Credits" width="100%" />
<box id="animated_area" width="100%" proportion="10">
<box id="animated_area" width="100%" proportion="10" padding="0">
</box>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,6 @@
<stkgui>
<div x="2%" y="1%" width="96%" height="99%" layout="vertical-row" >
<div x="1%" y="1%" width="98%" height="99%" layout="vertical-row" >
<header width="80%"
I18N="In the kart selection (player setup) screen"
@ -13,13 +13,13 @@
<spacer height="15" width="25"/>
<box proportion="2" width="100%" layout="vertical-row">
<box proportion="2" width="100%" layout="vertical-row" padding="2">
<ribbon_grid id="karts" proportion="1" square_items="true" width="100%" align="center"
child_width="90" child_height="90" max_rows="3"/>
</box>
<!-- Groups will be added dynamically at runtime -->
<tabs width="100%" height="25" id="kartgroups">
<tabs width="98%" x="1%" height="25" id="kartgroups">
</tabs>
<spacer width="100%" height="2%"/>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -1,11 +1,11 @@
<stkgui>
<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" >
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/>
<spacer height="15" width="10"/>
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
<tabs id="options_choice" height="10%" max_height="110" x="2%" width="98%"" align="center">
<icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"
I18N="Section in the settings menu" text="Audio"/>
@ -16,7 +16,7 @@
<box proportion="1" width="100%" layout="vertical-row">
<spacer height="15" width="10"/>
<spacer height="5" width="10"/>
<!-- ******** Music ******** -->
<label width="100%" I18N="Section in the audio/video settings submenu" text="Music"/>

View File

@ -1,11 +1,11 @@
<stkgui>
<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" >
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/>
<spacer height="15" width="10"/>
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
<tabs id="options_choice" height="10%" max_height="110" x="2%" width="98%" align="center">
<icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"/>
@ -28,6 +28,7 @@
<spacer width="50" height="20" />
<div proportion="2" width="100%" layout="horizontal-row">
<spacer width="7" height="5"/>
<div height="100%" width="fit" layout="vertical-row">
<button id="delete"
I18N="To delete a keyboard configuration" text="Delete Configuration"/>

View File

@ -1,11 +1,11 @@
<stkgui>
<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" >
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/>
<spacer height="15" width="10"/>
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
<tabs id="options_choice" height="10%" max_height="110" x="2%" width="98%" align="center">
<icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"/>
@ -15,9 +15,6 @@
</tabs>
<box proportion="1" width="100%" layout="vertical-row">
<spacer width="5" height="5"/>
<label width="100%"
I18N="In key bindings configuration menu"
text="Press enter or double-click on a device to configure it"

View File

@ -1,11 +1,11 @@
<stkgui>
<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" >
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/>
<spacer height="15" width="10"/>
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
<tabs id="options_choice" height="10%" max_height="110" x="2%" width="98%" align="center">
<icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"/>

View File

@ -1,11 +1,11 @@
<stkgui>
<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" >
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/>
<spacer height="15" width="10"/>
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
<tabs id="options_choice" height="10%" max_height="110" x="2%" width="98%" align="center">
<icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"
@ -16,7 +16,7 @@
<box proportion="1" width="100%" layout="vertical-row">
<spacer height="18" width="10"/>
<spacer height="5" width="10"/>
<!-- ************ SKIN CHOICE ************ -->
<div layout="horizontal-row" width="100%" height="fit">

View File

@ -1,11 +1,11 @@
<stkgui>
<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" >
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/>
<spacer height="15" width="10"/>
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
<tabs id="options_choice" height="10%" max_height="110" x="2%" width="98%" align="center">
<icon-button id="tab_video" width="128" height="128" icon="gui/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/>

View File

@ -181,12 +181,12 @@ when the border that intersect at this corner are enabled.
<!-- Stateless -->
<element type="section" image="glass/glass_section.png"
left_border="15" right_border="15" top_border="15" bottom_border="15"
hborder_out_portion="1.0" vborder_out_portion="0.2" />
hborder_out_portion="0.0" vborder_out_portion="0.0" />
<!-- Stateless -->
<element type="rounded_section" image="glass/glass_rsection.png"
left_border="15" right_border="15" top_border="15" bottom_border="15"
hborder_out_portion="1.0" vborder_out_portion="0.2" />
hborder_out_portion="0.0" vborder_out_portion="0.0" />
<!-- Stateless -->
<element type="window" image="glass/dialog.png"

View File

@ -181,12 +181,12 @@ when the border that intersect at this corner are enabled.
<!-- Stateless -->
<element type="section" image="ocean/glass_section.png"
left_border="15" right_border="15" top_border="15" bottom_border="15"
hborder_out_portion="1.0" vborder_out_portion="0.2" />
hborder_out_portion="0.0" vborder_out_portion="0.0" />
<!-- Stateless -->
<element type="rounded_section" image="glass/glass_rsection.png"
left_border="15" right_border="15" top_border="15" bottom_border="15"
hborder_out_portion="1.0" vborder_out_portion="0.2" />
hborder_out_portion="0.0" vborder_out_portion="0.0" />
<!-- Stateless -->
<element type="window" image="ocean/dialog.png"

View File

@ -180,12 +180,12 @@ when the border that intersect at this corner are enabled.
<!-- Stateless -->
<element type="section" image="peach/glass_section.png"
left_border="15" right_border="15" top_border="15" bottom_border="15"
hborder_out_portion="1.0" vborder_out_portion="0.2" />
hborder_out_portion="0.0" vborder_out_portion="0.0" />
<!-- Stateless -->
<element type="rounded_section" image="glass/glass_rsection.png"
left_border="15" right_border="15" top_border="15" bottom_border="15"
hborder_out_portion="1.0" vborder_out_portion="0.2" />
hborder_out_portion="0.0" vborder_out_portion="0.0" />
<!-- Stateless -->
<element type="window" image="peach/dialog.png"

View File

@ -1,69 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<div x="5%" y="5%" width="90%" height="90%" layout="vertical-row">
<label id="name" width="100%" text_align="center"/>
<div x="1%" y="1%" width="99%" height="99%">
<spacer width="1" height="5%"/>
<div x="2%" y="2%" width="96%" height="96%" layout="vertical-row">
<div width="95%" proportion="5" layout="horizontal-row">
<!-- Left pane -->
<div proportion="1" height="100%" layout="vertical-row">
<label id="highscores" width="100%" text_align="center" text="= Highscores ="/>
<spacer width="1" height="2%"/>
<div width="95%" height="fit" layout="horizontal-row">
<icon id="iconscore1" icon="gui/random_kart.png" width="font" height="font"/>
<spacer width="2%" height="1"/>
<label id="highscore1" proportion="1" text="(Empty)"/>
</div>
<spacer width="1" height="2%"/>
<div width="95%" height="fit" layout="horizontal-row">
<icon id="iconscore2" icon="gui/random_kart.png" width="font" height="font"/>
<spacer width="2%" height="1"/>
<label id="highscore2" proportion="1" text="(Empty)"/>
</div>
<spacer width="1" height="2%"/>
<div width="95%" height="fit" layout="horizontal-row">
<icon id="iconscore3" icon="gui/random_kart.png" width="font" height="font"/>
<spacer width="2%" height="1"/>
<label id="highscore3" proportion="1" text="(Empty)"/>
</div>
<spacer width="1" proportion="1"/>
<label id="author" width="100%" text_align="center" word_wrap="true"/>
<label id="name" width="100%" text_align="center"/>
<spacer width="1" height="5%"/>
<div width="95%" proportion="5" layout="horizontal-row">
<!-- Left pane -->
<div proportion="1" height="100%" layout="vertical-row">
<label id="highscores" width="100%" text_align="center" text="= Highscores ="/>
<spacer width="1" height="2%"/>
<div width="95%" height="fit" layout="horizontal-row">
<icon id="iconscore1" icon="gui/random_kart.png" width="font" height="font"/>
<spacer width="2%" height="1"/>
<label id="highscore1" proportion="1" text="(Empty)"/>
</div>
<spacer width="1" height="2%"/>
<div width="95%" height="fit" layout="horizontal-row">
<icon id="iconscore2" icon="gui/random_kart.png" width="font" height="font"/>
<spacer width="2%" height="1"/>
<label id="highscore2" proportion="1" text="(Empty)"/>
</div>
<spacer width="1" height="2%"/>
<div width="95%" height="fit" layout="horizontal-row">
<icon id="iconscore3" icon="gui/random_kart.png" width="font" height="font"/>
<spacer width="2%" height="1"/>
<label id="highscore3" proportion="1" text="(Empty)"/>
</div>
<spacer width="1" proportion="1"/>
<label id="author" width="100%" text_align="center" word_wrap="true"/>
</div>
<!-- Right pane -->
<div proportion="1" height="100%" layout="vertical-row">
<placeholder proportion="1" width="100%" height="100%" id="screenshot_div">
</placeholder>
<div width="75%" height="fit" layout="horizontal-row" >
<spacer proportion="1" height="2" />
<checkbox id="reverse"/>
<spacer width="20" height="2" />
<label id="reverse-text" height="100%" I18N="Drive the track reverse" text="Reverse"/>
<spacer proportion="1" height="2" />
</div>
</div>
</div>
<spacer width="1" height="5%"/>
<spinner id="lapcountspinner" width="50%" min_value="1" max_value="20" align="center" wrap_around="true"
I18N="In the track setup screen (number of laps choice, where %i is the number)" text="%i laps"/>
<spacer width="1" height="5%"/>
<button id="start" text="Start Race" align="center"/>
<spacer width="1" height="2%"/>
</div>
<!-- Right pane -->
<div proportion="1" height="100%" layout="vertical-row">
<placeholder proportion="1" width="100%" height="100%" id="screenshot_div">
</placeholder>
<div width="75%" height="fit" layout="horizontal-row" >
<spacer width="40" height="2" />
<checkbox id="reverse"/>
<spacer width="20" height="2" />
<label id="reverse-text" height="100%" I18N="Drive the track reverse" text="Reverse"/>
</div>
</div>
</div>
<spacer width="1" height="5%"/>
<spinner id="lapcountspinner" width="50%" min_value="1" max_value="20" align="center" wrap_around="true"
I18N="In the track setup screen (number of laps choice, where %i is the number)" text="%i laps"/>
<spacer width="1" height="5%"/>
<button id="start" text="Start Race" align="center"/>
<spacer width="1" height="1%"/>
<icon-button id="closePopup" x="0" y="0" width="8%" height="8%" icon="gui/back.png"/>
</div>
</stkgui>

View File

@ -7,7 +7,7 @@
<header width="80%" I18N="Section in track selection screen" text="Grand Prix"
align="center" text_align="center" />
<box width="100%" height="195">
<box width="100%" height="195" padding="0">
<scrollable_toolbar id="gps" height="175" y="10" x="10" width="98%" align="center" label_location="each"
square_items="true" child_width="160" child_height="120" />
</box>
@ -15,7 +15,7 @@
<header width="100%" I18N="Section in track selection screen" text="All Tracks"
align="center" text_align="center" />
<box proportion="1" width="100%" layout="vertical-row">
<box proportion="1" width="100%" layout="vertical-row" padding="1">
<ribbon_grid id="tracks" proportion="1" width="100%" square_items="true"
label_location="bottom" align="center" max_rows="4"
child_width="160" child_height="120" />

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
// Jean-manuel clemencon supertuxkart
// Creates a cone lightbeam effect by smoothing edges
// Original idea: http://udn.epicgames.com/Three/VolumetricLightbeamTutorial.html
// TODO: Soft edges when it intesects geometry
// Some artefacts are still visible
uniform sampler2D main_texture;
uniform float transparency;
varying vec2 uv;
varying vec3 eyeVec;
varying vec3 normal;
void main()
{
float inter = dot(normal, eyeVec);
float m = texture2D(main_texture, vec2(0.5, uv.y)).r;
gl_FragColor = vec4(1.0,1.0,0.8, 1.0);
gl_FragColor.a = inter * inter * inter * inter * m;
}

View File

@ -0,0 +1,22 @@
// Jean-manuel clemencon supertuxkart
// Creates a cone lightbeam effect by smoothing edges
uniform float time;
varying vec2 uv;
varying vec3 eyeVec;
varying vec3 normal;
void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = gl_ModelViewMatrix * gl_Vertex;
eyeVec = normalize(-gl_Position).xyz;
normal = gl_NormalMatrix * gl_Normal;
gl_Position = ftransform();
uv = gl_TexCoord[0].st;
}

View File

@ -351,7 +351,7 @@ struct SEvent
AXIS_R, // e.g. rudder, or analog 2 stick 2 top to bottom
AXIS_U,
AXIS_V,
NUMBER_OF_AXES
NUMBER_OF_AXES = 32
};
/** A bitmap of button states. You can use IsButtonPressed() to

View File

@ -191,7 +191,6 @@ src/states_screens/help_screen_3.cpp
src/states_screens/help_screen_4.cpp
src/states_screens/kart_selection.cpp
src/states_screens/main_menu_screen.cpp
src/states_screens/minimal_race_gui.cpp
src/states_screens/networking_lobby.cpp
src/states_screens/networking_lobby_settings.cpp
src/states_screens/online_screen.cpp
@ -460,7 +459,6 @@ src/states_screens/help_screen_3.hpp
src/states_screens/help_screen_4.hpp
src/states_screens/kart_selection.hpp
src/states_screens/main_menu_screen.hpp
src/states_screens/minimal_race_gui.hpp
src/states_screens/networking_lobby.hpp
src/states_screens/networking_lobby_settings.hpp
src/states_screens/online_screen.hpp

View File

@ -399,8 +399,6 @@ supertuxkart_SOURCES = \
states_screens/kart_selection.hpp \
states_screens/main_menu_screen.cpp \
states_screens/main_menu_screen.hpp \
states_screens/minimal_race_gui.cpp \
states_screens/minimal_race_gui.hpp \
states_screens/options_screen_audio.cpp \
states_screens/options_screen_audio.hpp \
states_screens/options_screen_input.cpp \

View File

@ -101,8 +101,6 @@ private:
void loadSfx();
bool loadVorbisBuffer(const std::string &name,
ALuint buffer);
public:
SFXManager();
virtual ~SFXManager();

View File

@ -47,6 +47,7 @@ irr::core::stringw DeviceConfig::getMappingIdString (const PlayerAction action)
const Input::InputType type = m_bindings[action].getType();
const int id = m_bindings[action].getId();
const Input::AxisDirection dir = m_bindings[action].getDirection();
const Input::AxisRange range = m_bindings[action].getRange();
switch (type)
{
@ -60,6 +61,8 @@ irr::core::stringw DeviceConfig::getMappingIdString (const PlayerAction action)
returnString += id;
returnString += "$";
returnString += dir;
returnString += "$";
returnString += range;
break;
case Input::IT_STICKBUTTON:
@ -114,9 +117,10 @@ void DeviceConfig::setBinding ( const PlayerAction action,
const Input::InputType type,
const int id,
Input::AxisDirection direction,
Input::AxisRange range,
wchar_t character)
{
m_bindings[action].set(type, id, direction, character);
m_bindings[action].set(type, id, direction, range, character);
}
//------------------------------------------------------------------------------
@ -124,7 +128,7 @@ void DeviceConfig::setBinding ( const PlayerAction action,
// Don't call this directly unless you are KeyboardDevice or GamepadDevice
bool DeviceConfig::getGameAction(Input::InputType type,
const int id,
const int value,
int* value, /* inout */
PlayerAction* action /* out */ )
{
return doGetAction(type, id, value, PA_FIRST_GAME_ACTION, PA_LAST_GAME_ACTION, action);
@ -135,7 +139,7 @@ bool DeviceConfig::getGameAction(Input::InputType type,
// Don't call this directly unless you are KeyboardDevice or GamepadDevice
bool DeviceConfig::getMenuAction(Input::InputType type,
const int id,
const int value,
int* value,
PlayerAction* action /* out */ )
{
return doGetAction(type, id, value, PA_FIRST_MENU_ACTION, PA_LAST_MENU_ACTION, action);
@ -145,7 +149,7 @@ bool DeviceConfig::getMenuAction(Input::InputType type,
bool DeviceConfig::doGetAction(Input::InputType type,
const int id,
const int value,
int* value, /* inout */
const PlayerAction firstActionToCheck,
const PlayerAction lastActionToCheck,
PlayerAction* action /* out */ )
@ -162,13 +166,30 @@ bool DeviceConfig::doGetAction(Input::InputType type,
if (type == Input::IT_STICKMOTION)
{
if ( ((m_bindings[n].getDirection() == Input::AD_POSITIVE)
&& (value > 0)) ||
((m_bindings[n].getDirection() == Input::AD_NEGATIVE)
&& (value < 0)) )
if(m_bindings[n].getRange() == Input::AR_HALF)
{
success = true;
*action = (PlayerAction)n;
if ( ((m_bindings[n].getDirection() == Input::AD_POSITIVE)
&& (*value > 0)) ||
((m_bindings[n].getDirection() == Input::AD_NEGATIVE)
&& (*value < 0)) )
{
success = true;
*action = (PlayerAction)n;
}
}
else
{
if ( ((m_bindings[n].getDirection() == Input::AD_POSITIVE)
&& (*value != -Input::MAX_VALUE)) ||
((m_bindings[n].getDirection() == Input::AD_NEGATIVE)
&& (*value != Input::MAX_VALUE)) )
{
success = true;
*action = (PlayerAction)n;
if(m_bindings[n].getDirection() == Input::AD_NEGATIVE)
*value = -*value;
*value = (*value + Input::MAX_VALUE) / 2;
}
}
}
else

View File

@ -68,7 +68,7 @@ protected:
*/
bool doGetAction(Input::InputType type,
const int id,
const int value,
int* value, /* inout */
const PlayerAction firstActionToCheck,
const PlayerAction lastActionToCheck,
PlayerAction* action /* out */ );
@ -92,6 +92,7 @@ public:
const Input::InputType type,
const int id,
Input::AxisDirection direction = Input::AD_NEUTRAL,
Input::AxisRange range = Input::AR_HALF,
wchar_t character=0);
void setPlugged () { m_plugged++; }
@ -106,7 +107,7 @@ public:
*/
bool getGameAction (Input::InputType type,
const int id,
const int value,
int* value, /* inout */
PlayerAction* action /* out */);
/**
@ -117,7 +118,7 @@ public:
*/
bool getMenuAction (Input::InputType type,
const int id,
const int value,
int* value,
PlayerAction* action /* out */);
Binding& getBinding (int i) {return m_bindings[i];}

View File

@ -99,7 +99,7 @@ private:
* get attached to another kart if a kart is elimiated). */
AbstractKart *m_original_kart;
/** The list of viewports for this cameras. */
/** The viewport for this camera (portion of the game window covered by this camera) */
core::recti m_viewport;
/** The scaling necessary for each axis. */

View File

@ -164,8 +164,8 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2
size->get("max", &m_max_size);
}
bool has_x = size->get("x-increase-factor", &m_scale_affector_factor_x);
bool has_y = size->get("y-increase-factor", &m_scale_affector_factor_y);
bool has_x = size->get("x-increase-factor", &m_scale_affector_factor_x)==1;
bool has_y = size->get("y-increase-factor", &m_scale_affector_factor_y)==1;
m_has_scale_affector = (has_x || has_y);
//std::cout << "m_particle_size = " << m_particle_size << "\n";

View File

@ -479,6 +479,13 @@ namespace GUIEngine
Currently used for spinners only. Value can be "true" or "false"
\n
\subsection prop19 PROP_DIV_PADDING
<em> Name in XML files: </em> \c "padding"
Used on divs, indicate by how many pixels to pad contents
\n
<HR>
\section code Using the engine in code

View File

@ -615,7 +615,9 @@ EventPropagation EventHandler::onWidgetActivated(GUIEngine::Widget* w, const int
{
if (w->m_deactivated) return EVENT_BLOCK;
if (ModalDialog::isADialogActive())
Widget* parent = w->m_event_handler;
if (ModalDialog::isADialogActive() && (parent == NULL || parent->m_type != GUIEngine::WTYPE_RIBBON))
{
if (ModalDialog::getCurrent()->processEvent(w->m_properties[PROP_ID]) == EVENT_BLOCK)
{
@ -626,7 +628,6 @@ EventPropagation EventHandler::onWidgetActivated(GUIEngine::Widget* w, const int
//std::cout << "**** widget activated : " << w->m_properties[PROP_ID].c_str() << " ****" << std::endl;
Widget* parent = w->m_event_handler;
if (w->m_event_handler != NULL)
{
/* Find all parents. Stop looping if a widget event handler's is itself, to not fall

View File

@ -308,7 +308,19 @@ void LayoutManager::applyCoords(Widget* self, AbstractTopLevelContainer* topLeve
parent_x = parent->m_x;
parent_y = parent->m_y;
}
if (parent != NULL && parent->getType() == WTYPE_DIV && parent->m_show_bounding_box)
{
int padding = 15;
if (parent->m_properties[PROP_DIV_PADDING].length() > 0)
padding = atoi(parent->m_properties[PROP_DIV_PADDING].c_str());
parent_x += padding;
parent_y += padding;
parent_w -= padding*2;
parent_h -= padding*2;
}
if (self->m_absolute_x > -1) self->m_x = parent_x + self->m_absolute_x;
else if (self->m_absolute_reverse_x > -1) self->m_x = parent_x + (parent_w - self->m_absolute_reverse_x);
else if (self->m_relative_x > -1) self->m_x = (int)(parent_x + parent_w*self->m_relative_x/100);
@ -418,8 +430,23 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
break;
}
const int w = parent->m_w, h = parent->m_h;
int x = parent->m_x;
int y = parent->m_y;
int w = parent->m_w;
int h = parent->m_h;
if (parent != NULL && parent->getType() == WTYPE_DIV && parent->m_show_bounding_box)
{
int padding = 15;
if (parent->m_properties[PROP_DIV_PADDING].length() > 0)
padding = atoi(parent->m_properties[PROP_DIV_PADDING].c_str());
x += padding;
y += padding;
w -= padding*2;
h -= padding*2;
}
// find space left after placing all absolutely-sized widgets in a row
// (the space left will be divided between remaining widgets later)
int left_space = (horizontal ? w : h);
@ -445,8 +472,6 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
}
// ---- lay widgets in row
int x = parent->m_x;
int y = parent->m_y;
for (int n=0; n<widgets_amount; n++)
{
std::string prop = widgets[n].m_properties[ PROP_PROPORTION ];
@ -694,7 +719,10 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
// ----- also deal with containers' children
for (int n=0; n<widgets_amount; n++)
{
if (widgets[n].m_type == WTYPE_DIV) doCalculateLayout(widgets[n].m_children, topLevelContainer, &widgets[n]);
if (widgets[n].m_type == WTYPE_DIV)
{
doCalculateLayout(widgets[n].m_children, topLevelContainer, &widgets[n]);
}
}
} // calculateLayout

View File

@ -220,6 +220,7 @@ if(prop_name != NULL) widget.m_properties[prop_flag] = core::stringc(prop_name).
READ_PROPERTY(label_location, PROP_LABELS_LOCATION);
READ_PROPERTY(max_rows, PROP_MAX_ROWS);
READ_PROPERTY(wrap_around, PROP_WRAP_AROUND);
READ_PROPERTY(padding, PROP_DIV_PADDING);
#undef READ_PROPERTY
const wchar_t* text = xml->getAttributeValue( L"text" );

View File

@ -101,7 +101,8 @@ namespace GUIEngine
PROP_EXTEND_LABEL,
PROP_LABELS_LOCATION,
PROP_MAX_ROWS,
PROP_WRAP_AROUND
PROP_WRAP_AROUND,
PROP_DIV_PADDING
};
bool isWithinATextBox();

View File

@ -154,6 +154,8 @@ void TextBoxWidget::unfocused(const int playerID, Widget* new_focus)
assert(playerID == 0); // No support for multiple players in text areas!
setWithinATextBox(false);
GUIEngine::getGUIEnv()->removeFocus(m_element);
}
// -----------------------------------------------------------------------------

View File

@ -288,7 +288,6 @@
<ClCompile Include="..\..\states_screens\dialogs\custom_video_settings.cpp" />
<ClCompile Include="..\..\states_screens\dialogs\select_challenge.cpp" />
<ClCompile Include="..\..\states_screens\dialogs\tutorial_message_dialog.cpp" />
<ClCompile Include="..\..\states_screens\minimal_race_gui.cpp" />
<ClCompile Include="..\..\states_screens\options_screen_ui.cpp" />
<ClCompile Include="..\..\states_screens\race_gui_base.cpp" />
<ClCompile Include="..\..\states_screens\race_gui_overworld.cpp" />
@ -546,7 +545,6 @@
<ClInclude Include="..\..\states_screens\dialogs\custom_video_settings.hpp" />
<ClInclude Include="..\..\states_screens\dialogs\select_challenge.hpp" />
<ClInclude Include="..\..\states_screens\dialogs\tutorial_message_dialog.hpp" />
<ClInclude Include="..\..\states_screens\minimal_race_gui.hpp" />
<ClInclude Include="..\..\states_screens\options_screen_ui.hpp" />
<ClInclude Include="..\..\states_screens\race_gui_overworld.hpp" />
<ClInclude Include="..\..\states_screens\soccer_setup_screen.hpp" />

View File

@ -672,9 +672,6 @@
<ClCompile Include="..\..\physics\btKartRaycast.cpp">
<Filter>Source Files\physics</Filter>
</ClCompile>
<ClCompile Include="..\..\states_screens\minimal_race_gui.cpp">
<Filter>Source Files\states_screens</Filter>
</ClCompile>
<ClCompile Include="..\..\graphics\rain.cpp">
<Filter>Source Files\graphics</Filter>
</ClCompile>
@ -1448,9 +1445,6 @@
<ClInclude Include="..\..\physics\btKartRaycast.hpp">
<Filter>Header Files\physics</Filter>
</ClInclude>
<ClInclude Include="..\..\states_screens\minimal_race_gui.hpp">
<Filter>Header Files\states_screens</Filter>
</ClInclude>
<ClInclude Include="..\..\graphics\rain.hpp">
<Filter>Header Files\graphics</Filter>
</ClInclude>

View File

@ -292,7 +292,6 @@
<ClCompile Include="..\..\states_screens\dialogs\custom_video_settings.cpp" />
<ClCompile Include="..\..\states_screens\dialogs\select_challenge.cpp" />
<ClCompile Include="..\..\states_screens\dialogs\tutorial_message_dialog.cpp" />
<ClCompile Include="..\..\states_screens\minimal_race_gui.cpp" />
<ClCompile Include="..\..\states_screens\options_screen_ui.cpp" />
<ClCompile Include="..\..\states_screens\race_gui_base.cpp" />
<ClCompile Include="..\..\states_screens\race_gui_overworld.cpp" />
@ -548,7 +547,6 @@
<ClInclude Include="..\..\states_screens\dialogs\custom_video_settings.hpp" />
<ClInclude Include="..\..\states_screens\dialogs\select_challenge.hpp" />
<ClInclude Include="..\..\states_screens\dialogs\tutorial_message_dialog.hpp" />
<ClInclude Include="..\..\states_screens\minimal_race_gui.hpp" />
<ClInclude Include="..\..\states_screens\options_screen_ui.hpp" />
<ClInclude Include="..\..\states_screens\race_gui_overworld.hpp" />
<ClInclude Include="..\..\states_screens\soccer_setup_screen.hpp" />

View File

@ -672,9 +672,6 @@
<ClCompile Include="..\..\physics\btKartRaycast.cpp">
<Filter>Source Files\physics</Filter>
</ClCompile>
<ClCompile Include="..\..\states_screens\minimal_race_gui.cpp">
<Filter>Source Files\states_screens</Filter>
</ClCompile>
<ClCompile Include="..\..\graphics\rain.cpp">
<Filter>Source Files\graphics</Filter>
</ClCompile>
@ -1448,9 +1445,6 @@
<ClInclude Include="..\..\physics\btKartRaycast.hpp">
<Filter>Header Files\physics</Filter>
</ClInclude>
<ClInclude Include="..\..\states_screens\minimal_race_gui.hpp">
<Filter>Header Files\states_screens</Filter>
</ClInclude>
<ClInclude Include="..\..\graphics\rain.hpp">
<Filter>Header Files\graphics</Filter>
</ClInclude>

View File

@ -1421,10 +1421,6 @@
RelativePath="..\..\states_screens\main_menu_screen.cpp"
>
</File>
<File
RelativePath="..\..\states_screens\minimal_race_gui.cpp"
>
</File>
<File
RelativePath="..\..\states_screens\options_screen_audio.cpp"
>
@ -2627,10 +2623,6 @@
RelativePath="..\..\states_screens\main_menu_screen.hpp"
>
</File>
<File
RelativePath="..\..\states_screens\minimal_race_gui.hpp"
>
</File>
<File
RelativePath="..\..\states_screens\options_screen_audio.hpp"
>

View File

@ -31,10 +31,11 @@ void Binding::serialize(std::ofstream& stream) const
<< "event=\"" << m_type << "\" "
<< "character=\"" << m_character << "\" ";
// Only serialize the direction for stick motions
// Only serialize the direction and the range for stick motions
if (m_type == Input::IT_STICKMOTION)
{
stream << "direction=\"" << m_dir << "\" ";
stream << "range=\"" << m_range << "\" ";
}
} // serialize
@ -44,6 +45,7 @@ bool Binding::deserialize(irr::io::IrrXMLReader* xml)
const char *id_string = xml->getAttributeValue("id");
const char *event_string = xml->getAttributeValue("event");
const char *dir_string = xml->getAttributeValue("direction");
const char *range_string = xml->getAttributeValue("range");
const char *character = xml->getAttributeValue("character");
// Proceed only if neccesary tags were found
@ -67,7 +69,18 @@ bool Binding::deserialize(irr::io::IrrXMLReader* xml)
printf("WARNING: IT_STICKMOTION without direction, ignoring.\n");
return false;
}
m_dir = (Input::AxisDirection)atoi(dir_string);
// If the action is a stick motion & a range is defined
if (range_string == NULL)
{
m_range = Input::AR_HALF;
}
else
{
m_range = (Input::AxisRange)atoi(range_string);
}
m_dir = (Input::AxisDirection)atoi(dir_string);
} // if m_type!=stickmotion
return true;
@ -263,7 +276,14 @@ irr::core::stringw Binding::getAsString() const
else
{
//I18N: to appear in input configuration screen, for gamepad axes
s = _("Axis %d %s", m_id, (m_dir == Input::AD_NEGATIVE) ? L"-" : L"+");
if (m_range == Input::AR_HALF)
s = _("Axis %d %s", m_id, (m_dir == Input::AD_NEGATIVE) ? L"-" : L"+");
else
{
irr::core::stringw inv = _("inverted");
s = _("Axis %d %s", m_id, (m_dir == Input::AD_NEGATIVE) ? inv : L"");
}
}
break;
case Input::IT_STICKBUTTON:

View File

@ -36,6 +36,7 @@ private:
Input::InputType m_type;
int m_id;
Input::AxisDirection m_dir;
Input::AxisRange m_range;
wchar_t m_character;
public:
/** Returns the type of device this binding is using. */
@ -47,12 +48,16 @@ public:
/** Returns the direction this binding is using. */
Input::AxisDirection getDirection() const {return m_dir;}
// ------------------------------------------------------------------------
/** Returns the range this binding is using. */
Input::AxisRange getRange() const {return m_range;}
// ------------------------------------------------------------------------
/** Defines all values of this binding. */
void set(Input::InputType type, int id,
Input::AxisDirection dir,
Input::AxisRange range,
wchar_t character)
{
m_type = type; m_id=id; m_dir=dir; m_character=character;
m_type = type; m_id=id; m_dir=dir; m_range=range; m_character=character;
} // set
// ------------------------------------------------------------------------

View File

@ -322,7 +322,7 @@ InputDevice *DeviceManager::mapGamepadInput( Input::InputType type,
int deviceID,
int btnID,
int axisDir,
int value,
int *value /* inout */,
InputManager::InputDriverMode mode,
StateManager::ActivePlayer **player /* out */,
PlayerAction *action /* out */)
@ -361,14 +361,14 @@ bool DeviceManager::translateInput( Input::InputType type,
int deviceID,
int btnID,
int axisDir,
int value,
int* value /* inout */,
InputManager::InputDriverMode mode,
StateManager::ActivePlayer** player /* out */,
PlayerAction* action /* out */ )
{
if (GUIEngine::getCurrentScreen() != NULL)
{
GUIEngine::getCurrentScreen()->filterInput(type, deviceID, btnID, axisDir, value);
GUIEngine::getCurrentScreen()->filterInput(type, deviceID, btnID, axisDir, *value);
}
InputDevice *device = NULL;
@ -406,7 +406,7 @@ bool DeviceManager::translateInput( Input::InputType type,
// Return true if input was successfully translated to an action and player
if (device != NULL && abs(value) > Input::MAX_VALUE/2)
if (device != NULL && abs(*value) > Input::MAX_VALUE/2)
{
m_latest_used_device = device;
}

View File

@ -74,7 +74,7 @@ private:
int deviceID,
int btnID,
int axisDir,
int value,
int* value /* inout */,
InputManager::InputDriverMode mode,
StateManager::ActivePlayer **player /* out */,
PlayerAction *action /* out */);
@ -151,7 +151,7 @@ public:
int deviceID,
int btnID,
int axisDir,
int value,
int *value /* inout */,
InputManager::InputDriverMode mode,
StateManager::ActivePlayer** player /* out */,
PlayerAction* action /* out */ );

View File

@ -51,6 +51,12 @@ struct Input
AD_NEUTRAL
};
enum AxisRange
{
AR_HALF,
AR_FULL
};
enum InputType
{
IT_NONE = 0,
@ -67,6 +73,7 @@ struct Input
int m_device_id;
int m_button_id; // or axis ID for gamepads axes
int m_axis_direction;
int m_axis_range;
wchar_t m_character;
Input()

View File

@ -162,7 +162,7 @@ void GamePadDevice::resetAxisDirection(const int axis,
// ----------------------------------------------------------------------------
bool GamePadDevice::processAndMapInput(Input::InputType type, const int id,
const int value,
int* value, /* inout */
InputManager::InputDriverMode mode,
StateManager::ActivePlayer* player,
PlayerAction* action /* out */)
@ -180,13 +180,13 @@ bool GamePadDevice::processAndMapInput(Input::InputType type, const int id,
if (player != NULL)
{
// going to negative from positive
if (value < 0 && m_prevAxisDirections[id] == Input::AD_POSITIVE)
if (*value < 0 && m_prevAxisDirections[id] == Input::AD_POSITIVE)
{
// set positive id to 0
resetAxisDirection(id, Input::AD_POSITIVE, player);
}
// going to positive from negative
else if (value > 0 &&
else if (*value > 0 &&
m_prevAxisDirections[id] == Input::AD_NEGATIVE)
{
// set negative id to 0
@ -194,17 +194,17 @@ bool GamePadDevice::processAndMapInput(Input::InputType type, const int id,
}
}
if (value > 0) m_prevAxisDirections[id] = Input::AD_POSITIVE;
else if(value < 0) m_prevAxisDirections[id] = Input::AD_NEGATIVE;
if (*value > 0) m_prevAxisDirections[id] = Input::AD_POSITIVE;
else if(*value < 0) m_prevAxisDirections[id] = Input::AD_NEGATIVE;
if (!m_axis_ok[id])
{
if (m_prevAxisValue[id] == -1)
{
// first value we get from this axis
m_prevAxisValue[id] = value;
m_prevAxisValue[id] = *value;
}
else if (m_prevAxisValue[id] != value)
else if (m_prevAxisValue[id] != *value)
{
// second different value we get from this axis, consider it OK
m_axis_ok[id] = true;
@ -212,7 +212,7 @@ bool GamePadDevice::processAndMapInput(Input::InputType type, const int id,
}
// check if within deadzone
if(value > -m_deadzone && value < m_deadzone && player != NULL)
if(*value > -m_deadzone && *value < m_deadzone && player != NULL)
{
// Axis stands still: This is reported once for digital axes and
// can be called multipled times for analog ones. Uses the
@ -247,7 +247,7 @@ bool GamePadDevice::processAndMapInput(Input::InputType type, const int id,
{
success = m_configuration->getGameAction(type, id, value, action);
}
else if (abs(value) > Input::MAX_VALUE/2)
else if (abs(*value) > Input::MAX_VALUE/2)
{
// bindings can only be accessed in game and menu modes
assert(mode == InputManager::MENU);

View File

@ -132,7 +132,7 @@ public:
* \return Whether the pressed key/button is bound with an action
*/
bool processAndMapInput(Input::InputType type, const int id,
const int value,
int* value,
InputManager::InputDriverMode mode,
StateManager::ActivePlayer* player,
PlayerAction* action);

View File

@ -379,6 +379,8 @@ void InputManager::inputSensing(Input::InputType type, int deviceID,
!= m_sensed_input_high_gamepad.end();
bool inverse_id_was_high = m_sensed_input_high_gamepad.find(-input_id)
!= m_sensed_input_high_gamepad.end();
bool id_was_zero = m_sensed_input_zero_gamepad.find(button)
!= m_sensed_input_zero_gamepad.end();
// A stick was pushed far enough (for the first time) to count as
// 'triggered' - save the axis (coded with direction in the button
@ -388,31 +390,56 @@ void InputManager::inputSensing(Input::InputType type, int deviceID,
// to register this as soon as the value is high enough.
if (!id_was_high && abs(value) > Input::MAX_VALUE*6.0f/7.0f)
{
m_sensed_input_high_gamepad.insert(input_id);
if(inverse_id_was_high && !id_was_zero) {
Input sensed_input;
sensed_input.m_type = type;
sensed_input.m_device_id = deviceID;
sensed_input.m_button_id = button;
sensed_input.m_axis_direction = (value>=0) ? Input::AD_POSITIVE
: Input::AD_NEGATIVE;
sensed_input.m_axis_range = Input::AR_FULL;
sensed_input.m_character = deviceID;
OptionsScreenInput2::getInstance()->gotSensedInput(sensed_input);
}
else m_sensed_input_high_gamepad.insert(input_id);
}
else if ( abs(value) < Input::MAX_VALUE/8.0f && id_was_high )
else if ( abs(value) < Input::MAX_VALUE/8.0f )
{
Input sensed_input;
sensed_input.m_type = type;
sensed_input.m_device_id = deviceID;
sensed_input.m_button_id = button;
sensed_input.m_axis_direction = value>=0 ? Input::AD_POSITIVE
: Input::AD_NEGATIVE;
sensed_input.m_character = deviceID;
OptionsScreenInput2::getInstance()->gotSensedInput(sensed_input);
}
else if ( abs(value) < Input::MAX_VALUE/8.0f && inverse_id_was_high )
{
Input sensed_input;
sensed_input.m_type = type;
sensed_input.m_device_id = deviceID;
sensed_input.m_button_id = button;
// Since the inverse direction was high (i.e. stick went from
// +30000 to -100), we have to inverse the sign
sensed_input.m_axis_direction = value>=0 ? Input::AD_NEGATIVE
: Input::AD_POSITIVE;
sensed_input.m_character = deviceID;
OptionsScreenInput2::getInstance()->gotSensedInput(sensed_input);
if( id_was_high )
{
Input sensed_input;
sensed_input.m_type = type;
sensed_input.m_device_id = deviceID;
sensed_input.m_button_id = button;
sensed_input.m_axis_direction = (value>=0) == id_was_zero
? Input::AD_POSITIVE
: Input::AD_NEGATIVE;
sensed_input.m_axis_range = id_was_zero ? Input::AR_HALF
: Input::AR_FULL;
sensed_input.m_character = deviceID;
OptionsScreenInput2::getInstance()->gotSensedInput(sensed_input);
}
else if( inverse_id_was_high )
{
Input sensed_input;
sensed_input.m_type = type;
sensed_input.m_device_id = deviceID;
sensed_input.m_button_id = button;
// Since the inverse direction was high (i.e. stick went from
// +30000 to -100), we have to inverse the sign
sensed_input.m_axis_direction = (value>=0) == id_was_zero
? Input::AD_NEGATIVE
: Input::AD_POSITIVE;
sensed_input.m_axis_range = id_was_zero ? Input::AR_HALF
: Input::AR_FULL;
sensed_input.m_character = deviceID;
OptionsScreenInput2::getInstance()->gotSensedInput(sensed_input);
}
else
{
m_sensed_input_zero_gamepad.insert(button);
}
}
break;
}
@ -485,7 +512,7 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
PlayerAction action;
bool action_found = m_device_manager->translateInput(type, deviceID,
button, axisDirection,
value, m_mode,
&value, m_mode,
&player, &action);
// in menus, some keyboard keys are standard (before each player selected
@ -968,6 +995,7 @@ void InputManager::setMode(InputDriverMode new_mode)
//irr_driver->showPointer();
m_sensed_input_high_gamepad.clear();
m_sensed_input_zero_gamepad.clear();
m_sensed_input_high_kbd.clear();
// The order is deliberate just in case someone starts

View File

@ -57,6 +57,7 @@ private:
DeviceManager *m_device_manager;
std::set<int> m_sensed_input_high_gamepad;
std::set<int> m_sensed_input_high_kbd;
std::set<int> m_sensed_input_zero_gamepad;
InputDriverMode m_mode;

View File

@ -55,7 +55,6 @@
#include "states_screens/dialogs/race_paused_dialog.hpp"
#include "states_screens/race_gui_base.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/minimal_race_gui.hpp"
#include "states_screens/race_gui.hpp"
#include "states_screens/race_result_gui.hpp"
#include "states_screens/state_manager.hpp"
@ -251,10 +250,10 @@ void World::reset()
void World::createRaceGUI()
{
if(UserConfigParams::m_minimal_race_gui &&
race_manager->getTrackName() != "tutorial")
m_race_gui = new MinimalRaceGUI();
else
//if(UserConfigParams::m_minimal_race_gui &&
// race_manager->getTrackName() != "tutorial")
// m_race_gui = new MinimalRaceGUI();
//else
m_race_gui = new RaceGUI();
}
@ -750,7 +749,7 @@ void World::updateWorld(float dt)
StateManager::get()->enterGameState();
network_manager->setupPlayerKartInfo();
race_manager->startNew(false);
race_manager->startNew(true);
}
else
{

View File

@ -42,15 +42,25 @@ AddonsScreen::AddonsScreen() : Screen("addons_screen.stkgui")
m_selected_index = -1;
// Add date filters.
m_date_filters.push_back((DateFilter) {_("All") , 0, 0, 0});
m_date_filters.push_back((DateFilter) {_("1 week") , 0, 0, 7});
m_date_filters.push_back((DateFilter) {_("2 weeks") , 0, 0, 12});
m_date_filters.push_back((DateFilter) {_("1 month") , 0, 1, 0});
m_date_filters.push_back((DateFilter) {_("3 months") , 0, 3, 0});
m_date_filters.push_back((DateFilter) {_("6 months") , 0, 6, 0});
m_date_filters.push_back((DateFilter) {_("9 months") , 0, 9, 0});
m_date_filters.push_back((DateFilter) {_("1 year") , 1, 0, 0});
m_date_filters.push_back((DateFilter) {_("2 years") , 2, 0, 0});
// I18N: Time filters for add-ons
DateFilter filter_all = {_("All"), 0, 0, 0};
DateFilter filter_1w = {_("1 week"), 0, 0, 7};
DateFilter filter_2w = {_("2 weeks"), 0, 0, 12};
DateFilter filter_1m = {_("1 month"), 0, 1, 0};
DateFilter filter_3m = {_("3 months"), 0, 3, 0};
DateFilter filter_6m = {_("6 months"), 0, 6, 0};
DateFilter filter_9m = {_("9 months"), 0, 9, 0};
DateFilter filter_1y = {_("1 year"), 1, 0, 0};
DateFilter filter_2y = {_("2 years"), 2, 0, 0};
m_date_filters.push_back(filter_all);
m_date_filters.push_back(filter_1w);
m_date_filters.push_back(filter_2w);
m_date_filters.push_back(filter_1m);
m_date_filters.push_back(filter_3m);
m_date_filters.push_back(filter_6m);
m_date_filters.push_back(filter_9m);
m_date_filters.push_back(filter_1y);
m_date_filters.push_back(filter_2y);
} // AddonsScreen
@ -103,13 +113,11 @@ void AddonsScreen::beforeAddingWidget()
w_filter_date->m_properties[GUIEngine::PROP_MAX_VALUE] =
StringUtils::toString(m_date_filters.size() - 1);
for (int n = 0; n < m_date_filters.size(); n++)
for (unsigned int n = 0; n < m_date_filters.size(); n++)
{
w_filter_date->addLabel(m_date_filters[n].label);
}
w_filter_date->setValue(0);
GUIEngine::SpinnerWidget* w_filter_rating =
getWidget<GUIEngine::SpinnerWidget>("filter_rating");
w_filter_rating->m_properties[GUIEngine::PROP_MIN_VALUE] = "0";
@ -119,8 +127,6 @@ void AddonsScreen::beforeAddingWidget()
{
w_filter_rating->addLabel(StringUtils::toWString(1.0 + n / 2.0));
}
w_filter_rating->setValue(0);
}
// ----------------------------------------------------------------------------
@ -150,11 +156,20 @@ void AddonsScreen::init()
m_type = "kart";
if (UserConfigParams::m_internet_status != INetworkHttp::IPERM_ALLOWED)
getWidget<GUIEngine::ButtonWidget>("reload")->setDeactivated();
getWidget<GUIEngine::IconButtonWidget>("reload")->setDeactivated();
else
getWidget<GUIEngine::ButtonWidget>("reload")->setActivated();
getWidget<GUIEngine::IconButtonWidget>("reload")->setActivated();
// Reset filter.
GUIEngine::TextBoxWidget* w_filter_name =
getWidget<GUIEngine::TextBoxWidget>("filter_name");
w_filter_name->setText(L"");
GUIEngine::SpinnerWidget* w_filter_date =
getWidget<GUIEngine::SpinnerWidget>("filter_date");
w_filter_date->setValue(0);
GUIEngine::SpinnerWidget* w_filter_rating =
getWidget<GUIEngine::SpinnerWidget>("filter_rating");
w_filter_rating->setValue(0);
// Set the default sort order
Addon::setSortOrder(Addon::SO_DEFAULT);

View File

@ -245,7 +245,7 @@ void CreditsScreen::init()
assert(w != NULL);
reset();
setArea(w->m_x, w->m_y, w->m_w, w->m_h);
setArea(w->m_x + 15, w->m_y + 8, w->m_w - 30, w->m_h - 16);
} // init
// ----------------------------------------------------------------------------

View File

@ -264,6 +264,11 @@ GUIEngine::EventPropagation TrackInfoDialog::processEvent(const std::string& eve
onEnterPressedInternal();
return GUIEngine::EVENT_BLOCK;
}
else if (eventSource == "closePopup")
{
ModalDialog::dismiss();
return GUIEngine::EVENT_BLOCK;
}
else if (eventSource == "reverse")
{
race_manager->setReverseTrack(m_checkbox->getState());

View File

@ -1,493 +0,0 @@
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2004-2005 Steve Baker <sjbaker1@airmail.net>
// Copyright (C) 2006 Joerg Henrichs, SuperTuxKart-Team, Steve Baker
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// 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
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "states_screens/minimal_race_gui.hpp"
using namespace irr;
#include "config/user_config.hpp"
#include "graphics/camera.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/material_manager.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/modaldialog.hpp"
#include "guiengine/scalable_font.hpp"
#include "io/file_manager.hpp"
#include "input/input.hpp"
#include "input/input_manager.hpp"
#include "items/attachment.hpp"
#include "items/attachment_manager.hpp"
#include "items/powerup_manager.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/controller/controller.hpp"
#include "karts/kart_properties.hpp"
#include "karts/kart_properties_manager.hpp"
#include "modes/follow_the_leader.hpp"
#include "modes/linear_world.hpp"
#include "modes/world.hpp"
#include "race/race_manager.hpp"
#include "tracks/track.hpp"
#include "utils/constants.hpp"
#include "utils/string_utils.hpp"
#include "utils/translation.hpp"
/** The constructor is called before anything is attached to the scene node.
* So rendering to a texture can be done here. But world is not yet fully
* created, so only the race manager can be accessed safely.
*/
MinimalRaceGUI::MinimalRaceGUI()
{
m_enabled = true;
// Ignore item messages.
ignoreUnimportantMessages();
// Originally m_map_height was 100, and we take 480 as minimum res
const float scaling = irr_driver->getFrameSize().Height / 480.0f;
// Marker texture has to be power-of-two for (old) OpenGL compliance
m_marker_rendered_size = 2 << ((int) ceil(1.0 + log(32.0 * scaling)));
m_marker_ai_size = (int)( 24.0f * scaling);
m_marker_player_size = (int)( 34.0f * scaling);
m_map_width = (int)(200.0f * scaling);
m_map_height = (int)(200.0f * scaling);
// The location of the minimap varies with number of
// splitscreen players:
switch(race_manager->getNumLocalPlayers())
{
case 0 : // In case of profile mode
case 1 : // Lower left corner
m_map_left = 10;
m_map_bottom = UserConfigParams::m_height-10;
break;
case 2: // Middle of left side
m_map_left = 10;
m_map_bottom = UserConfigParams::m_height/2 + m_map_height/2;
break;
case 3: // Lower right quarter (which is not used by a player)
m_map_left = UserConfigParams::m_width/2 + 10;
m_map_bottom = UserConfigParams::m_height-10;
break;
case 4: // Middle of the screen.
m_map_left = UserConfigParams::m_width/2-m_map_width/2;
m_map_bottom = UserConfigParams::m_height/2 + m_map_height/2;
break;
}
// Minimap is also rendered bigger via OpenGL, so find power-of-two again
const int map_texture = 2 << ((int) ceil(1.0 + log(128.0 * scaling)));
m_map_rendered_width = map_texture;
m_map_rendered_height = map_texture;
createMarkerTexture();
// Translate strings only one in constructor to avoid calling
// gettext in each frame.
//I18N: Shown at the end of a race
m_string_lap = _("Lap");
m_string_rank = _("Rank");
// Scaled fonts don't look good atm.
m_font_scale = 1.0f; //race_manager->getNumLocalPlayers()==1 ? 1.2f : 1.0f;
//read icon frame picture
// Determine maximum length of the rank/lap text, in order to
// align those texts properly on the right side of the viewport.
gui::ScalableFont* font = GUIEngine::getFont();
float old_scale = font->getScale();
font->setScale(m_font_scale);
m_lap_width = font->getDimension(m_string_lap.c_str()).Width;
m_timer_width = font->getDimension(L"99:99:99").Width;
if(race_manager->getNumberOfKarts()>9)
m_rank_width = font->getDimension(L"99/99").Width;
else
m_rank_width = font->getDimension(L"9/9").Width;
int w;
if (race_manager->getMinorMode()==RaceManager::MINOR_MODE_FOLLOW_LEADER ||
race_manager->getMinorMode()==RaceManager::MINOR_MODE_3_STRIKES ||
race_manager->getNumLaps() > 9)
w = font->getDimension(L" 99/99").Width;
else
w = font->getDimension(L" 9/9").Width;
m_lap_width += w;
font->setScale(old_scale);
} // MinimalRaceGUI
//-----------------------------------------------------------------------------
MinimalRaceGUI::~MinimalRaceGUI()
{
} // ~MinimalRaceGUI
//-----------------------------------------------------------------------------
/** Render all global parts of the race gui, i.e. things that are only
* displayed once even in splitscreen.
* \param dt Timestep sized.
*/
void MinimalRaceGUI::renderGlobal(float dt)
{
RaceGUIBase::renderGlobal(dt);
cleanupMessages(dt);
// Special case : when 3 players play, use 4th window to display such
// stuff (but we must clear it)
if (race_manager->getNumLocalPlayers() == 3 &&
!GUIEngine::ModalDialog::isADialogActive())
{
static video::SColor black = video::SColor(255,0,0,0);
irr_driver->getVideoDriver()
->draw2DRectangle(black,
core::rect<s32>(UserConfigParams::m_width/2,
UserConfigParams::m_height/2,
UserConfigParams::m_width,
UserConfigParams::m_height));
}
World *world = World::getWorld();
assert(world != NULL);
if(world->getPhase() >= WorldStatus::READY_PHASE &&
world->getPhase() <= WorldStatus::GO_PHASE )
{
drawGlobalReadySetGo();
}
// Timer etc. are not displayed unless the game is actually started.
if(!world->isRacePhase()) return;
if (!m_enabled) return;
drawGlobalTimer();
if(world->getPhase() == WorldStatus::GO_PHASE ||
world->getPhase() == WorldStatus::MUSIC_PHASE)
{
drawGlobalMusicDescription();
}
drawGlobalMiniMap();
// in 3 strikes mode we need to see the lives
if (world->getIdent() == IDENT_STRIKES)
{
drawGlobalPlayerIcons(m_map_height);
}
} // renderGlobal
//-----------------------------------------------------------------------------
/** Render the details for a single player, i.e. speed, energy,
* collectibles, ...
* \param kart Pointer to the kart for which to render the view.
*/
void MinimalRaceGUI::renderPlayerView(const Camera *camera, float dt)
{
if (!m_enabled) return;
const core::recti &viewport = camera->getViewport();
core::vector2df scaling = camera->getScaling();
scaling *= viewport.getWidth()/800.0f; // scale race GUI along screen size
const AbstractKart *kart = camera->getKart();
if(!kart) return;
drawPlungerInFace(camera, dt);
drawAllMessages (kart, viewport, scaling);
if(!World::getWorld()->isRacePhase()) return;
drawPowerupIcons (kart, viewport, scaling);
drawEnergyMeter (kart, viewport, scaling);
drawRankLap (kart, viewport);
RaceGUIBase::renderPlayerView(camera, dt);
} // renderPlayerView
//-----------------------------------------------------------------------------
/** Displays the racing time on the screen.s
*/
void MinimalRaceGUI::drawGlobalTimer()
{
assert(World::getWorld() != NULL);
if(!World::getWorld()->shouldDrawTimer()) return;
std::string s = StringUtils::timeToString(World::getWorld()->getTime());
core::stringw sw(s.c_str());
static video::SColor time_color = video::SColor(255, 255, 255, 255);
int x=0,y=0; // initialise to avoid compiler warning
switch(race_manager->getNumLocalPlayers())
{
case 1: x = 10; y=0; break;
case 2: x = 10; y=0; break;
case 3: x = UserConfigParams::m_width - m_timer_width-10;
y = UserConfigParams::m_height/2; break;
case 4: x = UserConfigParams::m_width/2 - m_timer_width/2;
y = 0; break;
} // switch
core::rect<s32> pos(x, y,
UserConfigParams::m_width, y+50);
gui::ScalableFont* font = GUIEngine::getFont();
float old_scale = font->getScale();
font->setScale(m_font_scale);
font->draw(sw.c_str(), pos, time_color, false, false, NULL, true /* ignore RTL */);
font->setScale(old_scale);
} // drawGlobalTimer
//-----------------------------------------------------------------------------
/** Draws the mini map and the position of all karts on it.
*/
void MinimalRaceGUI::drawGlobalMiniMap()
{
World *world = World::getWorld();
// arenas currently don't have a map.
if(world->getTrack()->isArena() || world->getTrack()->isSoccer()) return;
const video::ITexture *mini_map = world->getTrack()->getMiniMap();
int upper_y = m_map_bottom - m_map_height;
int lower_y = m_map_bottom;
if (mini_map != NULL)
{
core::rect<s32> dest(m_map_left, upper_y,
m_map_left + m_map_width, lower_y);
core::rect<s32> source(core::position2di(0, 0), mini_map->getOriginalSize());
irr_driver->getVideoDriver()->draw2DImage(mini_map, dest, source, 0, 0, true);
}
// In the first iteration, only draw AI karts, then only draw
// player karts. This guarantees that player kart icons are always
// on top of AI kart icons.
for(unsigned int only_draw_player_kart=0; only_draw_player_kart<=1;
only_draw_player_kart++)
{
for(unsigned int i=0; i<world->getNumKarts(); i++)
{
const AbstractKart *kart = world->getKart(i);
if(kart->isEliminated()) continue; // don't draw eliminated kart
// Make sure to only draw AI kart icons first, then
// only player karts.
if(kart->getController()->isPlayerController()
!=(only_draw_player_kart==1)) continue;
const Vec3& xyz = kart->getXYZ();
Vec3 draw_at;
world->getTrack()->mapPoint2MiniMap(xyz, &draw_at);
core::rect<s32> source(i *m_marker_rendered_size,
0,
(i+1)*m_marker_rendered_size,
m_marker_rendered_size);
int marker_half_size = (kart->getController()->isPlayerController()
? m_marker_player_size
: m_marker_ai_size )>>1;
core::rect<s32> position(m_map_left+(int)(draw_at.getX()-marker_half_size),
lower_y -(int)(draw_at.getY()+marker_half_size),
m_map_left+(int)(draw_at.getX()+marker_half_size),
lower_y -(int)(draw_at.getY()-marker_half_size));
// Highlight the player icons with some backgorund image.
if (kart->getController()->isPlayerController())
{
video::SColor colors[4];
for (unsigned int i=0;i<4;i++)
{
colors[i]=kart->getKartProperties()->getColor();
}
const core::rect<s32> rect(core::position2d<s32>(0,0),
m_icons_frame->getTexture()->getOriginalSize());
irr_driver->getVideoDriver()->draw2DImage(
m_icons_frame->getTexture(), position, rect,
NULL, colors, true);
} // if isPlayerController
irr_driver->getVideoDriver()->draw2DImage(m_marker, position, source,
NULL, NULL, true);
} // for i<getNumKarts
} // for only_draw_player_kart
} // drawGlobalMiniMap
//-----------------------------------------------------------------------------
/** Energy meter that gets filled with nitro. This function is called from
* drawSpeedAndEnergy, which defines the correct position of the energy
* meter.
* \param x X position of the meter.
* \param y Y position of the meter.
* \param kart Kart to display the data for.
* \param scaling Scaling applied (in case of split screen)
*/
void MinimalRaceGUI::drawEnergyMeter(const AbstractKart *kart,
const core::recti &viewport,
const core::vector2df &scaling)
{
float state = (float)(kart->getEnergy())
/ kart->getKartProperties()->getNitroMax();
if (state < 0.0f) state = 0.0f;
else if (state > 1.0f) state = 1.0f;
int h = (int)(viewport.getHeight()/3);
int w = h/4; // gauge image is so 1:4
// In split screen mode of 3 or 4 players, the players on
// the left side will have the energy meter on the left side
int mirrored = race_manager->getNumLocalPlayers()>=3 &&
viewport.UpperLeftCorner.X==0;
int x = mirrored ? 0 : viewport.LowerRightCorner.X - w;
int y = viewport.UpperLeftCorner.Y + viewport.getHeight()/2- h/2;
// Background
// ----------
core::rect<s32> dest(x+mirrored*w, y+mirrored*h,
x+(1-mirrored)*w, y+(1-mirrored)*h);
irr_driver->getVideoDriver()->draw2DImage(m_gauge_empty, dest,
core::rect<s32>(0, 0, 64, 256) /* source rect */,
NULL /* clip rect */, NULL /* colors */,
true /* alpha */);
// Target
// ------
if (race_manager->getCoinTarget() > 0)
{
float coin_target = (float)race_manager->getCoinTarget()
/ kart->getKartProperties()->getNitroMax();
const int EMPTY_TOP_PIXELS = 4;
const int EMPTY_BOTTOM_PIXELS = 3;
int y1 = y + (int)(EMPTY_TOP_PIXELS +
(h - EMPTY_TOP_PIXELS - EMPTY_BOTTOM_PIXELS)
*(1.0f - coin_target) );
if (state >= 1.0f) y1 = y;
core::rect<s32> clip(x, y1, x + w, y + h);
irr_driver->getVideoDriver()->draw2DImage(m_gauge_goal, core::rect<s32>(x, y, x+w, y+h) /* dest rect */,
core::rect<s32>(0, 0, 64, 256) /* source rect */,
&clip, NULL /* colors */, true /* alpha */);
}
// Filling (current state)
// -----------------------
if (state > 0.0f)
{
const int EMPTY_TOP_PIXELS = 4;
const int EMPTY_BOTTOM_PIXELS = 3;
int y1 = y + (int)(EMPTY_TOP_PIXELS
+ (h - EMPTY_TOP_PIXELS - EMPTY_BOTTOM_PIXELS)
*(1.0f - state) );
if (state >= 1.0f) y1 = y;
core::rect<s32> dest(x+mirrored*w,
mirrored ? y+h : y,
x+(1-mirrored)*w,
mirrored ? y : y + h);
core::rect<s32> clip(x, y1, x + w, y + h);
core::rect<s32> tex_c(0,
mirrored ? 256 : 0,
64,
mirrored ? 0 : 256);
video::ITexture *gauge = kart->getControls().m_nitro
? m_gauge_full_bright : m_gauge_full;
irr_driver->getVideoDriver()->draw2DImage(gauge, dest, tex_c,
&clip, NULL /* colors */,
true /* alpha */);
}
} // drawEnergyMeter
//-----------------------------------------------------------------------------
/** Displays the rank and the lap of the kart.
* \param info Info object c
*/
void MinimalRaceGUI::drawRankLap(const AbstractKart* kart,
const core::recti &viewport)
{
// Don't display laps or ranks if the kart has already finished the race.
if (kart->hasFinishedRace()) return;
core::recti pos;
gui::ScalableFont* font = (race_manager->getNumLocalPlayers() > 2
? GUIEngine::getSmallFont()
: GUIEngine::getFont());
float scale = font->getScale();
font->setScale(m_font_scale);
// Add a black shadow to make the text better readable on
// 'white' tracks (e.g. with snow and ice).
font->setShadow(video::SColor(255, 0, 0, 0));
static video::SColor color = video::SColor(255, 255, 255, 255);
WorldWithRank *world = (WorldWithRank*)(World::getWorld());
if (world->displayRank())
{
pos.UpperLeftCorner.Y = viewport.UpperLeftCorner.Y;
pos.LowerRightCorner.Y = viewport.UpperLeftCorner.Y+50;
// Split screen 3 or 4 players, left side:
if(viewport.LowerRightCorner.X < UserConfigParams::m_width)
{
pos.UpperLeftCorner.X = 10;
pos.LowerRightCorner.X = viewport.LowerRightCorner.X;
}
else
{
pos.UpperLeftCorner.X = viewport.LowerRightCorner.X
- m_rank_width-10;
pos.LowerRightCorner.X = viewport.LowerRightCorner.X;
}
char str[256];
sprintf(str, "%d/%d", kart->getPosition(),
world->getCurrentNumKarts());
font->draw(str, pos, color);
}
// Don't display laps in follow the leader mode
if(world->raceHasLaps())
{
const int lap = world->getKartLaps(kart->getWorldKartId());
// don't display 'lap 0/...'
if(lap>=0)
{
pos.LowerRightCorner.Y = viewport.LowerRightCorner.Y;
pos.UpperLeftCorner.Y = viewport.LowerRightCorner.Y-60;
pos.LowerRightCorner.X = viewport.LowerRightCorner.X;
// Split screen 3 or 4 players, left side:
if(viewport.LowerRightCorner.X < UserConfigParams::m_width)
{
pos.UpperLeftCorner.X = 10;
}
else
{
pos.UpperLeftCorner.X = (int)(viewport.LowerRightCorner.X
- m_lap_width -10 );
}
char str[256];
sprintf(str, "%d/%d", lap+1, race_manager->getNumLaps());
core::stringw s = m_string_lap+" "+str;
font->draw(s.c_str(), pos, color);
}
}
font->setScale(scale);
font->disableShadow();
} // drawRankLap
//-----------------------------------------------------------------------------

View File

@ -1,128 +0,0 @@
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2004-2005 Steve Baker <sjbaker1@airmail.net>
// Copyright (C) 2006 Joerg Henrichs, SuperTuxKart-Team, Steve Baker
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// 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
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_MINIMAL_RACE_GUI_HPP
#define HEADER_MINIMAL_RACE_GUI_HPP
#include <string>
#include <vector>
#include <vector2d.h>
#include <irrString.h>
#include <dimension2d.h>
namespace irr
{
namespace video { class ITexture; }
}
using namespace irr;
#include "config/player.hpp"
#include "states_screens/race_gui_base.hpp"
class AbstractKart;
class InputMap;
class Material;
class RaceSetup;
/**
* \brief Handles the in-race GUI (messages, mini-map, rankings, timer, etc...)
* \ingroup states_screens
*/
class MinimalRaceGUI : public RaceGUIBase
{
private:
/** Translated string 'lap' displayed every frame. */
core::stringw m_string_lap;
/** Length of 'Lap 99/99' */
int m_lap_width;
/** Translated string 'rank' displayed every frame. */
core::stringw m_string_rank;
/** Maximum string length for the timer */
int m_timer_width;
/** The width of the 'X/Y' rank display. */
int m_rank_width;
/** A scaling factor for the font for time, rank, and lap display. */
float m_font_scale;
// Minimap related variables
// -------------------------
/** The mini map of the track. */
video::ITexture *m_mini_map;
/** The size of a single marker on the screen for AI karts,
* need not be a power of 2. */
int m_marker_ai_size;
/** The size of a single marker on the screen or player karts,
* need not be a power of 2. */
int m_marker_player_size;
/** The width of the rendered mini map in pixels, must be a power of 2. */
int m_map_rendered_width;
/** The height of the rendered mini map in pixels, must be a power of 2. */
int m_map_rendered_height;
/** Width of the map in pixels on the screen, need not be a power of 2. */
int m_map_width;
/** Height of the map in pixels on the screen, need not be a power of 2. */
int m_map_height;
/** Distance of map from left side of screen. */
int m_map_left;
/** Distance of map from bottom of screen. */
int m_map_bottom;
/** Used to display messages without overlapping */
int m_max_font_height;
/** previous position of icons */
std::vector< core::vector2d<s32> > m_previous_icons_position;
/* Display informat for one player on the screen. */
void drawEnergyMeter (const AbstractKart *kart,
const core::recti &viewport,
const core::vector2df &scaling);
void drawRankLap (const AbstractKart* kart,
const core::recti &viewport);
/** Display items that are shown once only (for all karts). */
void drawGlobalMiniMap ();
void drawGlobalTimer ();
public:
MinimalRaceGUI();
~MinimalRaceGUI();
virtual void renderGlobal(float dt);
virtual void renderPlayerView(const Camera *camera, float dt);
/** Returns the size of the texture on which to render the minimap to. */
virtual const core::dimension2du getMiniMapSize() const
{ return core::dimension2du(m_map_width, m_map_height); }
}; // MinimalRaceGUI
#endif

View File

@ -257,6 +257,7 @@ void OptionsScreenInput::filterInput(Input::InputType type,
int deviceID,
int btnID,
int axisDir,
int axisRange,
int value)
{
if (type == Input::IT_STICKMOTION || type == Input::IT_STICKBUTTON)

View File

@ -70,6 +70,7 @@ public:
int deviceID,
int btnID,
int axisDir,
int axisRange,
int value);
/** \brief implement callback from parent class GUIEngine::Screen */

View File

@ -350,6 +350,7 @@ void OptionsScreenInput2::gotSensedInput(const Input& sensed_input)
KeyboardConfig* keyboard = (KeyboardConfig*)m_config;
keyboard->setBinding(binding_to_set, Input::IT_KEYBOARD,
sensed_input.m_button_id, Input::AD_NEUTRAL,
Input::AR_HALF,
sensed_input.m_character);
// refresh display
@ -387,7 +388,8 @@ void OptionsScreenInput2::gotSensedInput(const Input& sensed_input)
GamepadConfig* config = (GamepadConfig*)m_config;
config->setBinding(binding_to_set, sensed_input.m_type,
sensed_input.m_button_id,
(Input::AxisDirection)sensed_input.m_axis_direction);
(Input::AxisDirection)sensed_input.m_axis_direction,
(Input::AxisRange)sensed_input.m_axis_range);
// refresh display
updateInputButtons();

View File

@ -64,8 +64,17 @@ RaceGUI::RaceGUI()
m_marker_rendered_size = 2 << ((int) ceil(1.0 + log(32.0 * scaling)));
m_marker_ai_size = (int)( 14.0f * scaling);
m_marker_player_size = (int)( 16.0f * scaling);
m_map_width = (int)(100.0f * scaling);
m_map_height = (int)(100.0f * scaling);
if (UserConfigParams::m_minimal_race_gui)
{
m_map_width = (int)(160.0f * scaling);
m_map_height = (int)(160.0f * scaling);
}
else
{
m_map_width = (int)(100.0f * scaling);
m_map_height = (int)(100.0f * scaling);
}
m_map_left = (int)( 10.0f * scaling);
m_map_bottom = (int)( 10.0f * scaling);
@ -177,7 +186,11 @@ void RaceGUI::renderGlobal(float dt)
drawGlobalMiniMap();
if (!m_is_tutorial) drawGlobalPlayerIcons(m_map_height);
if (!m_is_tutorial &&
(UserConfigParams::m_minimal_race_gui == false || world->getIdent() == IDENT_STRIKES))
{
drawGlobalPlayerIcons(m_map_height);
}
} // renderGlobal
//-----------------------------------------------------------------------------
@ -203,7 +216,9 @@ void RaceGUI::renderPlayerView(const Camera *camera, float dt)
if(!World::getWorld()->isRacePhase()) return;
drawPowerupIcons (kart, viewport, scaling);
drawSpeedAndEnergy (kart, viewport, scaling);
if (UserConfigParams::m_minimal_race_gui == false)
drawSpeedAndEnergy (kart, viewport, scaling);
if (!m_is_tutorial)
drawRankLap (kart, viewport);

View File

@ -287,6 +287,7 @@ void RaceGUIBase::drawAllMessages(const AbstractKart* kart,
// Draw less important messages first, at the very bottom of the screen
// unimportant messages are skipped in multiplayer, they take too much screen space
if (race_manager->getNumLocalPlayers() < 2 &&
UserConfigParams::m_minimal_race_gui == false &&
!m_ignore_unimportant_messages)
{
for (AllMessageType::const_iterator i = m_messages.begin();

View File

@ -574,6 +574,8 @@ TrackObjectPresentationActionTrigger::TrackObjectPresentationActionTrigger(const
xml_node.get("action", &m_action);
m_action_active = true;
if (m_action.size() == 0)
{
fprintf(stderr, "[TrackObject] WARNING: action-trigger has no action defined\n");
@ -584,6 +586,8 @@ TrackObjectPresentationActionTrigger::TrackObjectPresentationActionTrigger(const
void TrackObjectPresentationActionTrigger::onTriggerItemApproached(Item* who)
{
if (!m_action_active) return;
if (m_action == "garage")
{
new RacePausedDialog(0.8f, 0.6f);
@ -593,7 +597,7 @@ void TrackObjectPresentationActionTrigger::onTriggerItemApproached(Item* who)
{
//if (World::getWorld()->getPhase() == World::RACE_PHASE)
{
m_action = "__disabled__";
m_action_active = false;
//World::getWorld()->getRaceGUI()->clearAllMessages();
InputDevice* device = input_manager->getDeviceList()->getLatestUsedDevice();
@ -608,13 +612,13 @@ void TrackObjectPresentationActionTrigger::onTriggerItemApproached(Item* who)
}
else if (m_action == "tutorial_bananas")
{
m_action = "__disabled__";
m_action_active = false;
new TutorialMessageDialog(_("Avoid bananas!"), true);
}
else if (m_action == "tutorial_giftboxes")
{
m_action = "__disabled__";
m_action_active = false;
InputDevice* device = input_manager->getDeviceList()->getLatestUsedDevice();
DeviceConfig* config = device->getConfiguration();
irr::core::stringw fire = config->getBindingAsString(PA_FIRE);
@ -624,14 +628,14 @@ void TrackObjectPresentationActionTrigger::onTriggerItemApproached(Item* who)
}
else if (m_action == "tutorial_nitro_collect")
{
m_action = "__disabled__";
m_action_active = false;
new TutorialMessageDialog(_("Collect nitro bottles (we will use them after the curve)"),
true);
}
else if (m_action == "tutorial_nitro_use")
{
m_action = "__disabled__";
m_action_active = false;
InputDevice* device = input_manager->getDeviceList()->getLatestUsedDevice();
DeviceConfig* config = device->getConfiguration();
irr::core::stringw nitro = config->getBindingAsString(PA_NITRO);
@ -641,7 +645,7 @@ void TrackObjectPresentationActionTrigger::onTriggerItemApproached(Item* who)
}
else if (m_action == "tutorial_rescue")
{
m_action = "__disabled__";
m_action_active = false;
InputDevice* device = input_manager->getDeviceList()->getLatestUsedDevice();
DeviceConfig* config = device->getConfiguration();
irr::core::stringw rescue = config->getBindingAsString(PA_RESCUE);
@ -651,7 +655,7 @@ void TrackObjectPresentationActionTrigger::onTriggerItemApproached(Item* who)
}
else if (m_action == "tutorial_skidding")
{
m_action = "__disabled__";
m_action_active = false;
//World::getWorld()->getRaceGUI()->clearAllMessages();
InputDevice* device = input_manager->getDeviceList()->getLatestUsedDevice();
@ -664,7 +668,7 @@ void TrackObjectPresentationActionTrigger::onTriggerItemApproached(Item* who)
}
else if (m_action == "tutorial_skidding2")
{
m_action = "__disabled__";
m_action_active = false;
World::getWorld()->getRaceGUI()->clearAllMessages();
new TutorialMessageDialog(_("Note that if you manage to skid for several seconds, you will receive a bonus speedup as a reward!"),
@ -672,7 +676,7 @@ void TrackObjectPresentationActionTrigger::onTriggerItemApproached(Item* who)
}
else if (m_action == "tutorial_endmessage")
{
m_action = "__disabled__";
m_action_active = false;
World::getWorld()->getRaceGUI()->clearAllMessages();
new TutorialMessageDialog(_("You are now ready to race. Good luck!"),
@ -683,9 +687,6 @@ void TrackObjectPresentationActionTrigger::onTriggerItemApproached(Item* who)
World::getWorld()->scheduleExitRace();
return;
}
else if (m_action == "__disabled__")
{
}
else
{
fprintf(stderr, "[TrackObject] WARNING: unknown action <%s>\n",

View File

@ -253,6 +253,8 @@ private:
/** For action trigger objects */
std::string m_action;
bool m_action_active;
public:
@ -260,6 +262,8 @@ public:
virtual ~TrackObjectPresentationActionTrigger() {}
virtual void onTriggerItemApproached(Item* who) OVERRIDE;
virtual void reset() OVERRIDE { m_action_active = true; }
};