Turn dos files into unix files

This commit is contained in:
cx384 2024-03-22 00:46:19 +01:00 committed by Lars Müller
parent e79587c934
commit 3a35db6e67
5 changed files with 2512 additions and 2512 deletions

@ -1,66 +1,66 @@
#include <windows.h>
#include <winuser.h>
#include <commctrl.h>
#include <richedit.h>
#ifndef USE_CMAKE_CONFIG_H
#define USE_CMAKE_CONFIG_H
#endif
#include "config.h"
#undef USE_CMAKE_CONFIG_H
#if RUN_IN_PLACE
#define BUILDMODE "RUN_IN_PLACE=1"
#else
#define BUILDMODE "RUN_IN_PLACE=0"
#endif
#ifdef __MINGW32__
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "minetest.exe.manifest"
#endif
LANGUAGE 0, SUBLANG_NEUTRAL
130 ICON "minetest-icon.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
1 VERSIONINFO
FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0
PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0
FILEFLAGSMASK 0x3fL
#ifndef NDEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", ""
VALUE "CompanyName", PROJECT_NAME_C " community"
VALUE "FileDescription", PROJECT_NAME_C " engine"
VALUE "FileVersion", VERSION_STRING
VALUE "InternalName", PROJECT_NAME
VALUE "LegalCopyright", "(c) 2011-2015 celeron55"
VALUE "LegalTrademarks", """Minetest"" is the property of the Minetest community, don't use it without permission!"
VALUE "OriginalFilename", "minetest.exe"
VALUE "PrivateBuild", VERSION_EXTRA
VALUE "ProductName", PROJECT_NAME_C
VALUE "ProductVersion", PRODUCT_VERSION_STRING
VALUE "SpecialBuild", BUILDMODE
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#include <windows.h>
#include <winuser.h>
#include <commctrl.h>
#include <richedit.h>
#ifndef USE_CMAKE_CONFIG_H
#define USE_CMAKE_CONFIG_H
#endif
#include "config.h"
#undef USE_CMAKE_CONFIG_H
#if RUN_IN_PLACE
#define BUILDMODE "RUN_IN_PLACE=1"
#else
#define BUILDMODE "RUN_IN_PLACE=0"
#endif
#ifdef __MINGW32__
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "minetest.exe.manifest"
#endif
LANGUAGE 0, SUBLANG_NEUTRAL
130 ICON "minetest-icon.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
1 VERSIONINFO
FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0
PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0
FILEFLAGSMASK 0x3fL
#ifndef NDEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", ""
VALUE "CompanyName", PROJECT_NAME_C " community"
VALUE "FileDescription", PROJECT_NAME_C " engine"
VALUE "FileVersion", VERSION_STRING
VALUE "InternalName", PROJECT_NAME
VALUE "LegalCopyright", "(c) 2011-2015 celeron55"
VALUE "LegalTrademarks", """Minetest"" is the property of the Minetest community, don't use it without permission!"
VALUE "OriginalFilename", "minetest.exe"
VALUE "PrivateBuild", VERSION_EXTRA
VALUE "ProductName", PROJECT_NAME_C
VALUE "ProductVersion", PRODUCT_VERSION_STRING
VALUE "SpecialBuild", BUILDMODE
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

File diff suppressed because it is too large Load Diff

@ -1,280 +1,280 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#pragma once
#include <IGUIStaticText.h>
#include "irrlicht_changes/static_text.h"
#include "IGUIButton.h"
#include "IGUISpriteBank.h"
#include "ITexture.h"
#include "SColor.h"
#include "guiSkin.h"
#include "StyleSpec.h"
using namespace irr;
class ISimpleTextureSource;
class GUIButton : public gui::IGUIButton
{
public:
//! constructor
GUIButton(gui::IGUIEnvironment* environment, gui::IGUIElement* parent,
s32 id, core::rect<s32> rectangle, ISimpleTextureSource *tsrc,
bool noclip=false);
//! destructor
virtual ~GUIButton();
//! called if an event happened.
virtual bool OnEvent(const SEvent& event) override;
//! draws the element and its children
virtual void draw() override;
//! sets another skin independent font. if this is set to zero, the button uses the font of the skin.
virtual void setOverrideFont(gui::IGUIFont* font=0) override;
//! Gets the override font (if any)
virtual gui::IGUIFont* getOverrideFont() const override;
//! Get the font which is used right now for drawing
virtual gui::IGUIFont* getActiveFont() const override;
//! Sets another color for the button text.
virtual void setOverrideColor(video::SColor color) override;
//! Gets the override color
virtual video::SColor getOverrideColor() const override;
//! Gets the currently used text color
virtual video::SColor getActiveColor() const override;
//! Sets if the button text should use the override color or the color in the gui skin.
virtual void enableOverrideColor(bool enable) override;
//! Checks if an override color is enabled
virtual bool isOverrideColorEnabled(void) const override;
// PATCH
//! Sets an image which should be displayed on the button when it is in the given state.
virtual void setImage(gui::EGUI_BUTTON_IMAGE_STATE state,
video::ITexture* image=nullptr,
const core::rect<s32>& sourceRect=core::rect<s32>(0,0,0,0)) override;
//! Sets an image which should be displayed on the button when it is in normal state.
virtual void setImage(video::ITexture* image=nullptr) override;
//! Sets an image which should be displayed on the button when it is in normal state.
virtual void setImage(video::ITexture* image, const core::rect<s32>& pos) override;
//! Sets an image which should be displayed on the button when it is in pressed state.
virtual void setPressedImage(video::ITexture* image=nullptr) override;
//! Sets an image which should be displayed on the button when it is in pressed state.
virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& pos) override;
//! Sets the text displayed by the button
virtual void setText(const wchar_t* text) override;
// END PATCH
//! Sets the sprite bank used by the button
virtual void setSpriteBank(gui::IGUISpriteBank* bank=0) override;
//! Sets the animated sprite for a specific button state
/** \param index: Number of the sprite within the sprite bank, use -1 for no sprite
\param state: State of the button to set the sprite for
\param index: The sprite number from the current sprite bank
\param color: The color of the sprite
*/
virtual void setSprite(gui::EGUI_BUTTON_STATE state, s32 index,
video::SColor color=video::SColor(255,255,255,255),
bool loop=false, bool scale=false) override;
//! Get the sprite-index for the given state or -1 when no sprite is set
virtual s32 getSpriteIndex(gui::EGUI_BUTTON_STATE state) const override;
//! Get the sprite color for the given state. Color is only used when a sprite is set.
virtual video::SColor getSpriteColor(gui::EGUI_BUTTON_STATE state) const override;
//! Returns if the sprite in the given state does loop
virtual bool getSpriteLoop(gui::EGUI_BUTTON_STATE state) const override;
//! Returns if the sprite in the given state is scaled
virtual bool getSpriteScale(gui::EGUI_BUTTON_STATE state) const override;
//! Sets if the button should behave like a push button. Which means it
//! can be in two states: Normal or Pressed. With a click on the button,
//! the user can change the state of the button.
virtual void setIsPushButton(bool isPushButton=true) override;
//! Checks whether the button is a push button
virtual bool isPushButton() const override;
//! Sets the pressed state of the button if this is a pushbutton
virtual void setPressed(bool pressed=true) override;
//! Returns if the button is currently pressed
virtual bool isPressed() const override;
// PATCH
//! Returns if this element (or one of its direct children) is hovered
bool isHovered() const;
//! Returns if this element (or one of its direct children) is focused
bool isFocused() const;
// END PATCH
//! Sets if the button should use the skin to draw its border
virtual void setDrawBorder(bool border=true) override;
//! Checks if the button face and border are being drawn
virtual bool isDrawingBorder() const override;
//! Sets if the alpha channel should be used for drawing images on the button (default is false)
virtual void setUseAlphaChannel(bool useAlphaChannel=true) override;
//! Checks if the alpha channel should be used for drawing images on the button
virtual bool isAlphaChannelUsed() const override;
//! Sets if the button should scale the button images to fit
virtual void setScaleImage(bool scaleImage=true) override;
//! Checks whether the button scales the used images
virtual bool isScalingImage() const override;
//! Get if the shift key was pressed in last EGET_BUTTON_CLICKED event
virtual bool getClickShiftState() const override
{
return ClickShiftState;
}
//! Get if the control key was pressed in last EGET_BUTTON_CLICKED event
virtual bool getClickControlState() const override
{
return ClickControlState;
}
void setColor(video::SColor color);
// PATCH
//! Set element properties from a StyleSpec corresponding to the button state
void setFromState();
//! Set element properties from a StyleSpec
virtual void setFromStyle(const StyleSpec& style);
//! Set the styles used for each state
void setStyles(const std::array<StyleSpec, StyleSpec::NUM_STATES>& styles);
// END PATCH
//! Do not drop returned handle
static GUIButton* addButton(gui::IGUIEnvironment *environment,
const core::rect<s32>& rectangle, ISimpleTextureSource *tsrc,
IGUIElement* parent, s32 id, const wchar_t* text,
const wchar_t *tooltiptext=L"");
protected:
void drawSprite(gui::EGUI_BUTTON_STATE state, u32 startTime, const core::position2di& center);
gui::EGUI_BUTTON_IMAGE_STATE getImageState(bool pressed) const;
ISimpleTextureSource *getTextureSource() { return TSrc; }
struct ButtonImage
{
ButtonImage() = default;
ButtonImage(const ButtonImage& other)
{
*this = other;
}
~ButtonImage()
{
if ( Texture )
Texture->drop();
}
ButtonImage& operator=(const ButtonImage& other)
{
if ( this == &other )
return *this;
if (other.Texture)
other.Texture->grab();
if ( Texture )
Texture->drop();
Texture = other.Texture;
SourceRect = other.SourceRect;
return *this;
}
bool operator==(const ButtonImage& other) const
{
return Texture == other.Texture && SourceRect == other.SourceRect;
}
video::ITexture* Texture = nullptr;
core::rect<s32> SourceRect = core::rect<s32>(0,0,0,0);
};
gui::EGUI_BUTTON_IMAGE_STATE getImageState(bool pressed, const ButtonImage* images) const;
private:
struct ButtonSprite
{
bool operator==(const ButtonSprite &other) const
{
return Index == other.Index && Color == other.Color && Loop == other.Loop && Scale == other.Scale;
}
s32 Index = -1;
video::SColor Color;
bool Loop = false;
bool Scale = false;
};
ButtonSprite ButtonSprites[gui::EGBS_COUNT];
gui::IGUISpriteBank* SpriteBank = nullptr;
ButtonImage ButtonImages[gui::EGBIS_COUNT];
std::array<StyleSpec, StyleSpec::NUM_STATES> Styles;
gui::IGUIFont* OverrideFont = nullptr;
bool OverrideColorEnabled = false;
video::SColor OverrideColor = video::SColor(101,255,255,255);
u32 ClickTime = 0;
u32 HoverTime = 0;
u32 FocusTime = 0;
bool ClickShiftState = false;
bool ClickControlState = false;
bool IsPushButton = false;
bool Pressed = false;
bool UseAlphaChannel = false;
bool DrawBorder = true;
bool ScaleImage = false;
video::SColor Colors[4];
// PATCH
bool WasHovered = false;
bool WasFocused = false;
ISimpleTextureSource *TSrc;
gui::IGUIStaticText *StaticText;
core::rect<s32> BgMiddle;
core::rect<s32> Padding;
core::vector2d<s32> ContentOffset;
video::SColor BgColor = video::SColor(0xFF,0xFF,0xFF,0xFF);
// END PATCH
};
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#pragma once
#include <IGUIStaticText.h>
#include "irrlicht_changes/static_text.h"
#include "IGUIButton.h"
#include "IGUISpriteBank.h"
#include "ITexture.h"
#include "SColor.h"
#include "guiSkin.h"
#include "StyleSpec.h"
using namespace irr;
class ISimpleTextureSource;
class GUIButton : public gui::IGUIButton
{
public:
//! constructor
GUIButton(gui::IGUIEnvironment* environment, gui::IGUIElement* parent,
s32 id, core::rect<s32> rectangle, ISimpleTextureSource *tsrc,
bool noclip=false);
//! destructor
virtual ~GUIButton();
//! called if an event happened.
virtual bool OnEvent(const SEvent& event) override;
//! draws the element and its children
virtual void draw() override;
//! sets another skin independent font. if this is set to zero, the button uses the font of the skin.
virtual void setOverrideFont(gui::IGUIFont* font=0) override;
//! Gets the override font (if any)
virtual gui::IGUIFont* getOverrideFont() const override;
//! Get the font which is used right now for drawing
virtual gui::IGUIFont* getActiveFont() const override;
//! Sets another color for the button text.
virtual void setOverrideColor(video::SColor color) override;
//! Gets the override color
virtual video::SColor getOverrideColor() const override;
//! Gets the currently used text color
virtual video::SColor getActiveColor() const override;
//! Sets if the button text should use the override color or the color in the gui skin.
virtual void enableOverrideColor(bool enable) override;
//! Checks if an override color is enabled
virtual bool isOverrideColorEnabled(void) const override;
// PATCH
//! Sets an image which should be displayed on the button when it is in the given state.
virtual void setImage(gui::EGUI_BUTTON_IMAGE_STATE state,
video::ITexture* image=nullptr,
const core::rect<s32>& sourceRect=core::rect<s32>(0,0,0,0)) override;
//! Sets an image which should be displayed on the button when it is in normal state.
virtual void setImage(video::ITexture* image=nullptr) override;
//! Sets an image which should be displayed on the button when it is in normal state.
virtual void setImage(video::ITexture* image, const core::rect<s32>& pos) override;
//! Sets an image which should be displayed on the button when it is in pressed state.
virtual void setPressedImage(video::ITexture* image=nullptr) override;
//! Sets an image which should be displayed on the button when it is in pressed state.
virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& pos) override;
//! Sets the text displayed by the button
virtual void setText(const wchar_t* text) override;
// END PATCH
//! Sets the sprite bank used by the button
virtual void setSpriteBank(gui::IGUISpriteBank* bank=0) override;
//! Sets the animated sprite for a specific button state
/** \param index: Number of the sprite within the sprite bank, use -1 for no sprite
\param state: State of the button to set the sprite for
\param index: The sprite number from the current sprite bank
\param color: The color of the sprite
*/
virtual void setSprite(gui::EGUI_BUTTON_STATE state, s32 index,
video::SColor color=video::SColor(255,255,255,255),
bool loop=false, bool scale=false) override;
//! Get the sprite-index for the given state or -1 when no sprite is set
virtual s32 getSpriteIndex(gui::EGUI_BUTTON_STATE state) const override;
//! Get the sprite color for the given state. Color is only used when a sprite is set.
virtual video::SColor getSpriteColor(gui::EGUI_BUTTON_STATE state) const override;
//! Returns if the sprite in the given state does loop
virtual bool getSpriteLoop(gui::EGUI_BUTTON_STATE state) const override;
//! Returns if the sprite in the given state is scaled
virtual bool getSpriteScale(gui::EGUI_BUTTON_STATE state) const override;
//! Sets if the button should behave like a push button. Which means it
//! can be in two states: Normal or Pressed. With a click on the button,
//! the user can change the state of the button.
virtual void setIsPushButton(bool isPushButton=true) override;
//! Checks whether the button is a push button
virtual bool isPushButton() const override;
//! Sets the pressed state of the button if this is a pushbutton
virtual void setPressed(bool pressed=true) override;
//! Returns if the button is currently pressed
virtual bool isPressed() const override;
// PATCH
//! Returns if this element (or one of its direct children) is hovered
bool isHovered() const;
//! Returns if this element (or one of its direct children) is focused
bool isFocused() const;
// END PATCH
//! Sets if the button should use the skin to draw its border
virtual void setDrawBorder(bool border=true) override;
//! Checks if the button face and border are being drawn
virtual bool isDrawingBorder() const override;
//! Sets if the alpha channel should be used for drawing images on the button (default is false)
virtual void setUseAlphaChannel(bool useAlphaChannel=true) override;
//! Checks if the alpha channel should be used for drawing images on the button
virtual bool isAlphaChannelUsed() const override;
//! Sets if the button should scale the button images to fit
virtual void setScaleImage(bool scaleImage=true) override;
//! Checks whether the button scales the used images
virtual bool isScalingImage() const override;
//! Get if the shift key was pressed in last EGET_BUTTON_CLICKED event
virtual bool getClickShiftState() const override
{
return ClickShiftState;
}
//! Get if the control key was pressed in last EGET_BUTTON_CLICKED event
virtual bool getClickControlState() const override
{
return ClickControlState;
}
void setColor(video::SColor color);
// PATCH
//! Set element properties from a StyleSpec corresponding to the button state
void setFromState();
//! Set element properties from a StyleSpec
virtual void setFromStyle(const StyleSpec& style);
//! Set the styles used for each state
void setStyles(const std::array<StyleSpec, StyleSpec::NUM_STATES>& styles);
// END PATCH
//! Do not drop returned handle
static GUIButton* addButton(gui::IGUIEnvironment *environment,
const core::rect<s32>& rectangle, ISimpleTextureSource *tsrc,
IGUIElement* parent, s32 id, const wchar_t* text,
const wchar_t *tooltiptext=L"");
protected:
void drawSprite(gui::EGUI_BUTTON_STATE state, u32 startTime, const core::position2di& center);
gui::EGUI_BUTTON_IMAGE_STATE getImageState(bool pressed) const;
ISimpleTextureSource *getTextureSource() { return TSrc; }
struct ButtonImage
{
ButtonImage() = default;
ButtonImage(const ButtonImage& other)
{
*this = other;
}
~ButtonImage()
{
if ( Texture )
Texture->drop();
}
ButtonImage& operator=(const ButtonImage& other)
{
if ( this == &other )
return *this;
if (other.Texture)
other.Texture->grab();
if ( Texture )
Texture->drop();
Texture = other.Texture;
SourceRect = other.SourceRect;
return *this;
}
bool operator==(const ButtonImage& other) const
{
return Texture == other.Texture && SourceRect == other.SourceRect;
}
video::ITexture* Texture = nullptr;
core::rect<s32> SourceRect = core::rect<s32>(0,0,0,0);
};
gui::EGUI_BUTTON_IMAGE_STATE getImageState(bool pressed, const ButtonImage* images) const;
private:
struct ButtonSprite
{
bool operator==(const ButtonSprite &other) const
{
return Index == other.Index && Color == other.Color && Loop == other.Loop && Scale == other.Scale;
}
s32 Index = -1;
video::SColor Color;
bool Loop = false;
bool Scale = false;
};
ButtonSprite ButtonSprites[gui::EGBS_COUNT];
gui::IGUISpriteBank* SpriteBank = nullptr;
ButtonImage ButtonImages[gui::EGBIS_COUNT];
std::array<StyleSpec, StyleSpec::NUM_STATES> Styles;
gui::IGUIFont* OverrideFont = nullptr;
bool OverrideColorEnabled = false;
video::SColor OverrideColor = video::SColor(101,255,255,255);
u32 ClickTime = 0;
u32 HoverTime = 0;
u32 FocusTime = 0;
bool ClickShiftState = false;
bool ClickControlState = false;
bool IsPushButton = false;
bool Pressed = false;
bool UseAlphaChannel = false;
bool DrawBorder = true;
bool ScaleImage = false;
video::SColor Colors[4];
// PATCH
bool WasHovered = false;
bool WasFocused = false;
ISimpleTextureSource *TSrc;
gui::IGUIStaticText *StaticText;
core::rect<s32> BgMiddle;
core::rect<s32> Padding;
core::vector2d<s32> ContentOffset;
video::SColor BgColor = video::SColor(0xFF,0xFF,0xFF,0xFF);
// END PATCH
};

File diff suppressed because it is too large Load Diff

@ -1,360 +1,360 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __GUI_SKIN_H_INCLUDED__
#define __GUI_SKIN_H_INCLUDED__
#include "IGUISkin.h"
#include "irrString.h"
#include <string>
#include "ITexture.h"
namespace irr
{
namespace video
{
class IVideoDriver;
}
namespace gui
{
class GUISkin : public IGUISkin
{
public:
GUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver);
//! destructor
virtual ~GUISkin();
//! returns default color
virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const;
//! sets a default color
virtual void setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor);
//! returns size for the given size type
virtual s32 getSize(EGUI_DEFAULT_SIZE size) const;
//! sets a default size
virtual void setSize(EGUI_DEFAULT_SIZE which, s32 size);
//! returns the default font
virtual IGUIFont* getFont(EGUI_DEFAULT_FONT which=EGDF_DEFAULT) const;
//! sets a default font
virtual void setFont(IGUIFont* font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT);
//! sets the sprite bank used for drawing icons
virtual void setSpriteBank(IGUISpriteBank* bank);
//! gets the sprite bank used for drawing icons
virtual IGUISpriteBank* getSpriteBank() const;
//! Returns a default icon
/** Returns the sprite index within the sprite bank */
virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const;
//! Sets a default icon
/** Sets the sprite index used for drawing icons like arrows,
close buttons and ticks in checkboxes
\param icon: Enum specifying which icon to change
\param index: The sprite index used to draw this icon */
virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index);
//! Returns a default text.
/** For example for Message box button captions:
"OK", "Cancel", "Yes", "No" and so on. */
virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const;
//! Sets a default text.
/** For example for Message box button captions:
"OK", "Cancel", "Yes", "No" and so on. */
virtual void setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText);
//! draws a standard 3d button pane
/** Used for drawing for example buttons in normal state.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param rect: Defining area where to draw.
\param clip: Clip area.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. */
virtual void draw3DButtonPaneStandard(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0)
{
drawColored3DButtonPaneStandard(element, rect,clip);
}
virtual void drawColored3DButtonPaneStandard(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0,
const video::SColor* colors=0);
//! draws a pressed 3d button pane
/** Used for drawing for example buttons in pressed state.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param rect: Defining area where to draw.
\param clip: Clip area.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. */
virtual void draw3DButtonPanePressed(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0)
{
drawColored3DButtonPanePressed(element, rect, clip);
}
virtual void drawColored3DButtonPanePressed(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0,
const video::SColor* colors=0);
//! draws a sunken 3d pane
/** Used for drawing the background of edit, combo or check boxes.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param bgcolor: Background color.
\param flat: Specifies if the sunken pane should be flat or displayed as sunken
deep into the ground.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DSunkenPane(IGUIElement* element,
video::SColor bgcolor, bool flat,
bool fillBackGround,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0)
{
drawColored3DSunkenPane(element, bgcolor, flat, fillBackGround, rect, clip);
}
virtual void drawColored3DSunkenPane(IGUIElement* element,
video::SColor bgcolor, bool flat,
bool fillBackGround,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0,
const video::SColor* colors=0);
//! draws a window background
/** Used for drawing the background of dialogs and windows.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param titleBarColor: Title color.
\param drawTitleBar: True to enable title drawing.
\param rect: Defining area where to draw.
\param clip: Clip area.
\param checkClientArea: When set to non-null the function will not draw anything,
but will instead return the clientArea which can be used for drawing by the calling window.
That is the area without borders and without titlebar.
\return Returns rect where it would be good to draw title bar text. This will
work even when checkClientArea is set to a non-null value.*/
virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element,
bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& rect,
const core::rect<s32>* clip,
core::rect<s32>* checkClientArea)
{
return drawColored3DWindowBackground(element, drawTitleBar, titleBarColor,
rect, clip, checkClientArea);
}
virtual core::rect<s32> drawColored3DWindowBackground(IGUIElement* element,
bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& rect,
const core::rect<s32>* clip,
core::rect<s32>* checkClientArea,
const video::SColor* colors=0);
//! draws a standard 3d menu pane
/** Used for drawing for menus and context menus.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DMenuPane(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0)
{
drawColored3DMenuPane(element, rect, clip);
}
virtual void drawColored3DMenuPane(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0,
const video::SColor* colors=0);
//! draws a standard 3d tool bar
/** Used for drawing for toolbars and menus.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DToolBar(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0)
{
drawColored3DToolBar(element, rect, clip);
}
virtual void drawColored3DToolBar(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0,
const video::SColor* colors=0);
//! draws a tab button
/** Used for drawing for tab buttons on top of tabs.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param active: Specifies if the tab is currently active.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DTabButton(IGUIElement* element, bool active,
const core::rect<s32>& rect, const core::rect<s32>* clip=0, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT)
{
drawColored3DTabButton(element, active, rect, clip, alignment);
}
virtual void drawColored3DTabButton(IGUIElement* element, bool active,
const core::rect<s32>& rect, const core::rect<s32>* clip=0, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT,
const video::SColor* colors=0);
//! draws a tab control body
/** \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param border: Specifies if the border should be drawn.
\param background: Specifies if the background should be drawn.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DTabBody(IGUIElement* element, bool border, bool background,
const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT)
{
drawColored3DTabBody(element, border, background, rect, clip, tabHeight, alignment);
}
virtual void drawColored3DTabBody(IGUIElement* element, bool border, bool background,
const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT,
const video::SColor* colors=0);
//! draws an icon, usually from the skin's sprite bank
/** \param element: Pointer to the element which wishes to draw this icon.
This parameter is usually not used by IGUISkin, but can be used for example
by more complex implementations to find out how to draw the part exactly.
\param icon: Specifies the icon to be drawn.
\param position: The position to draw the icon
\param starttime: The time at the start of the animation
\param currenttime: The present time, used to calculate the frame number
\param loop: Whether the animation should loop or not
\param clip: Clip area. */
virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
const core::position2di position,
u32 starttime=0, u32 currenttime=0,
bool loop=false, const core::rect<s32>* clip=0)
{
drawColoredIcon(element, icon, position, starttime, currenttime, loop, clip);
}
virtual void drawColoredIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
const core::position2di position,
u32 starttime=0, u32 currenttime=0,
bool loop=false, const core::rect<s32>* clip=0,
const video::SColor* colors=0);
//! draws a 2d rectangle.
/** \param element: Pointer to the element which wishes to draw this icon.
This parameter is usually not used by IGUISkin, but can be used for example
by more complex implementations to find out how to draw the part exactly.
\param color: Color of the rectangle to draw. The alpha component specifies how
transparent the rectangle will be.
\param pos: Position of the rectangle.
\param clip: Pointer to rectangle against which the rectangle will be clipped.
If the pointer is null, no clipping will be performed. */
virtual void draw2DRectangle(IGUIElement* element, const video::SColor &color,
const core::rect<s32>& pos, const core::rect<s32>* clip = 0);
//! get the type of this skin
virtual EGUI_SKIN_TYPE getType() const;
//! gets the colors
virtual void getColors(video::SColor* colors); // ::PATCH:
private:
video::SColor Colors[EGDC_COUNT];
s32 Sizes[EGDS_COUNT];
u32 Icons[EGDI_COUNT];
IGUIFont* Fonts[EGDF_COUNT];
IGUISpriteBank* SpriteBank;
core::stringw Texts[EGDT_COUNT];
video::IVideoDriver* Driver;
bool UseGradient;
EGUI_SKIN_TYPE Type;
};
#define set3DSkinColors(skin, button_color) \
{ \
skin->setColor(EGDC_3D_FACE, button_color); \
skin->setColor(EGDC_3D_DARK_SHADOW, button_color, 0.25f); \
skin->setColor(EGDC_3D_SHADOW, button_color, 0.5f); \
skin->setColor(EGDC_3D_LIGHT, button_color); \
skin->setColor(EGDC_3D_HIGH_LIGHT, button_color, 1.5f); \
}
#define getElementSkinColor(color) \
{ \
if (!Colors) \
{ \
IGUISkin* skin = Environment->getSkin(); \
if (skin) \
return skin->getColor(color); \
} \
return Colors[color]; \
}
#define setElementSkinColor(which, newColor, shading) \
{ \
if (!Colors) \
{ \
Colors = new video::SColor[EGDC_COUNT]; \
GUISkin* skin = (GUISkin *)Environment->getSkin(); \
if (skin) \
skin->getColors(Colors); \
} \
Colors[which] = newColor; \
setShading(Colors[which],shading); \
}
} // end namespace gui
//! Sets the shading
inline void setShading(video::SColor &color,f32 s) // :PATCH:
{
if (s < 1.0f)
{
color.setRed(color.getRed() * s);
color.setGreen(color.getGreen() * s);
color.setBlue(color.getBlue() * s);
}
else if (s > 1.0f)
{
s -= 1.0f;
color.setRed(color.getRed() + (255 - color.getRed()) * s);
color.setGreen(color.getGreen() + (255 - color.getGreen()) * s);
color.setBlue(color.getBlue() + (255 - color.getBlue()) * s);
}
}
} // end namespace irr
#endif
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __GUI_SKIN_H_INCLUDED__
#define __GUI_SKIN_H_INCLUDED__
#include "IGUISkin.h"
#include "irrString.h"
#include <string>
#include "ITexture.h"
namespace irr
{
namespace video
{
class IVideoDriver;
}
namespace gui
{
class GUISkin : public IGUISkin
{
public:
GUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver);
//! destructor
virtual ~GUISkin();
//! returns default color
virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const;
//! sets a default color
virtual void setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor);
//! returns size for the given size type
virtual s32 getSize(EGUI_DEFAULT_SIZE size) const;
//! sets a default size
virtual void setSize(EGUI_DEFAULT_SIZE which, s32 size);
//! returns the default font
virtual IGUIFont* getFont(EGUI_DEFAULT_FONT which=EGDF_DEFAULT) const;
//! sets a default font
virtual void setFont(IGUIFont* font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT);
//! sets the sprite bank used for drawing icons
virtual void setSpriteBank(IGUISpriteBank* bank);
//! gets the sprite bank used for drawing icons
virtual IGUISpriteBank* getSpriteBank() const;
//! Returns a default icon
/** Returns the sprite index within the sprite bank */
virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const;
//! Sets a default icon
/** Sets the sprite index used for drawing icons like arrows,
close buttons and ticks in checkboxes
\param icon: Enum specifying which icon to change
\param index: The sprite index used to draw this icon */
virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index);
//! Returns a default text.
/** For example for Message box button captions:
"OK", "Cancel", "Yes", "No" and so on. */
virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const;
//! Sets a default text.
/** For example for Message box button captions:
"OK", "Cancel", "Yes", "No" and so on. */
virtual void setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText);
//! draws a standard 3d button pane
/** Used for drawing for example buttons in normal state.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param rect: Defining area where to draw.
\param clip: Clip area.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. */
virtual void draw3DButtonPaneStandard(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0)
{
drawColored3DButtonPaneStandard(element, rect,clip);
}
virtual void drawColored3DButtonPaneStandard(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0,
const video::SColor* colors=0);
//! draws a pressed 3d button pane
/** Used for drawing for example buttons in pressed state.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param rect: Defining area where to draw.
\param clip: Clip area.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. */
virtual void draw3DButtonPanePressed(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0)
{
drawColored3DButtonPanePressed(element, rect, clip);
}
virtual void drawColored3DButtonPanePressed(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0,
const video::SColor* colors=0);
//! draws a sunken 3d pane
/** Used for drawing the background of edit, combo or check boxes.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param bgcolor: Background color.
\param flat: Specifies if the sunken pane should be flat or displayed as sunken
deep into the ground.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DSunkenPane(IGUIElement* element,
video::SColor bgcolor, bool flat,
bool fillBackGround,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0)
{
drawColored3DSunkenPane(element, bgcolor, flat, fillBackGround, rect, clip);
}
virtual void drawColored3DSunkenPane(IGUIElement* element,
video::SColor bgcolor, bool flat,
bool fillBackGround,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0,
const video::SColor* colors=0);
//! draws a window background
/** Used for drawing the background of dialogs and windows.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param titleBarColor: Title color.
\param drawTitleBar: True to enable title drawing.
\param rect: Defining area where to draw.
\param clip: Clip area.
\param checkClientArea: When set to non-null the function will not draw anything,
but will instead return the clientArea which can be used for drawing by the calling window.
That is the area without borders and without titlebar.
\return Returns rect where it would be good to draw title bar text. This will
work even when checkClientArea is set to a non-null value.*/
virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element,
bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& rect,
const core::rect<s32>* clip,
core::rect<s32>* checkClientArea)
{
return drawColored3DWindowBackground(element, drawTitleBar, titleBarColor,
rect, clip, checkClientArea);
}
virtual core::rect<s32> drawColored3DWindowBackground(IGUIElement* element,
bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& rect,
const core::rect<s32>* clip,
core::rect<s32>* checkClientArea,
const video::SColor* colors=0);
//! draws a standard 3d menu pane
/** Used for drawing for menus and context menus.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DMenuPane(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0)
{
drawColored3DMenuPane(element, rect, clip);
}
virtual void drawColored3DMenuPane(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0,
const video::SColor* colors=0);
//! draws a standard 3d tool bar
/** Used for drawing for toolbars and menus.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DToolBar(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0)
{
drawColored3DToolBar(element, rect, clip);
}
virtual void drawColored3DToolBar(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0,
const video::SColor* colors=0);
//! draws a tab button
/** Used for drawing for tab buttons on top of tabs.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param active: Specifies if the tab is currently active.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DTabButton(IGUIElement* element, bool active,
const core::rect<s32>& rect, const core::rect<s32>* clip=0, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT)
{
drawColored3DTabButton(element, active, rect, clip, alignment);
}
virtual void drawColored3DTabButton(IGUIElement* element, bool active,
const core::rect<s32>& rect, const core::rect<s32>* clip=0, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT,
const video::SColor* colors=0);
//! draws a tab control body
/** \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param border: Specifies if the border should be drawn.
\param background: Specifies if the background should be drawn.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DTabBody(IGUIElement* element, bool border, bool background,
const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT)
{
drawColored3DTabBody(element, border, background, rect, clip, tabHeight, alignment);
}
virtual void drawColored3DTabBody(IGUIElement* element, bool border, bool background,
const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT,
const video::SColor* colors=0);
//! draws an icon, usually from the skin's sprite bank
/** \param element: Pointer to the element which wishes to draw this icon.
This parameter is usually not used by IGUISkin, but can be used for example
by more complex implementations to find out how to draw the part exactly.
\param icon: Specifies the icon to be drawn.
\param position: The position to draw the icon
\param starttime: The time at the start of the animation
\param currenttime: The present time, used to calculate the frame number
\param loop: Whether the animation should loop or not
\param clip: Clip area. */
virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
const core::position2di position,
u32 starttime=0, u32 currenttime=0,
bool loop=false, const core::rect<s32>* clip=0)
{
drawColoredIcon(element, icon, position, starttime, currenttime, loop, clip);
}
virtual void drawColoredIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
const core::position2di position,
u32 starttime=0, u32 currenttime=0,
bool loop=false, const core::rect<s32>* clip=0,
const video::SColor* colors=0);
//! draws a 2d rectangle.
/** \param element: Pointer to the element which wishes to draw this icon.
This parameter is usually not used by IGUISkin, but can be used for example
by more complex implementations to find out how to draw the part exactly.
\param color: Color of the rectangle to draw. The alpha component specifies how
transparent the rectangle will be.
\param pos: Position of the rectangle.
\param clip: Pointer to rectangle against which the rectangle will be clipped.
If the pointer is null, no clipping will be performed. */
virtual void draw2DRectangle(IGUIElement* element, const video::SColor &color,
const core::rect<s32>& pos, const core::rect<s32>* clip = 0);
//! get the type of this skin
virtual EGUI_SKIN_TYPE getType() const;
//! gets the colors
virtual void getColors(video::SColor* colors); // ::PATCH:
private:
video::SColor Colors[EGDC_COUNT];
s32 Sizes[EGDS_COUNT];
u32 Icons[EGDI_COUNT];
IGUIFont* Fonts[EGDF_COUNT];
IGUISpriteBank* SpriteBank;
core::stringw Texts[EGDT_COUNT];
video::IVideoDriver* Driver;
bool UseGradient;
EGUI_SKIN_TYPE Type;
};
#define set3DSkinColors(skin, button_color) \
{ \
skin->setColor(EGDC_3D_FACE, button_color); \
skin->setColor(EGDC_3D_DARK_SHADOW, button_color, 0.25f); \
skin->setColor(EGDC_3D_SHADOW, button_color, 0.5f); \
skin->setColor(EGDC_3D_LIGHT, button_color); \
skin->setColor(EGDC_3D_HIGH_LIGHT, button_color, 1.5f); \
}
#define getElementSkinColor(color) \
{ \
if (!Colors) \
{ \
IGUISkin* skin = Environment->getSkin(); \
if (skin) \
return skin->getColor(color); \
} \
return Colors[color]; \
}
#define setElementSkinColor(which, newColor, shading) \
{ \
if (!Colors) \
{ \
Colors = new video::SColor[EGDC_COUNT]; \
GUISkin* skin = (GUISkin *)Environment->getSkin(); \
if (skin) \
skin->getColors(Colors); \
} \
Colors[which] = newColor; \
setShading(Colors[which],shading); \
}
} // end namespace gui
//! Sets the shading
inline void setShading(video::SColor &color,f32 s) // :PATCH:
{
if (s < 1.0f)
{
color.setRed(color.getRed() * s);
color.setGreen(color.getGreen() * s);
color.setBlue(color.getBlue() * s);
}
else if (s > 1.0f)
{
s -= 1.0f;
color.setRed(color.getRed() + (255 - color.getRed()) * s);
color.setGreen(color.getGreen() + (255 - color.getGreen()) * s);
color.setBlue(color.getBlue() + (255 - color.getBlue()) * s);
}
}
} // end namespace irr
#endif