Cleanup and improve code from #1109
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#include "LinuxPlatform.h"
|
||||
#include "LinuxWindow.h"
|
||||
#include "LinuxInput.h"
|
||||
#include "IncludeX11.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Types/Guid.h"
|
||||
#include "Engine/Core/Types/String.h"
|
||||
@@ -31,6 +30,7 @@
|
||||
#include "Engine/Input/Input.h"
|
||||
#include "Engine/Input/Mouse.h"
|
||||
#include "Engine/Input/Keyboard.h"
|
||||
#include "IncludeX11.h"
|
||||
#include <sys/resource.h>
|
||||
#include <sys/sysinfo.h>
|
||||
#include <sys/time.h>
|
||||
@@ -88,6 +88,7 @@ X11::Cursor Cursors[(int32)CursorType::MAX];
|
||||
X11::XcursorImage* CursorsImg[(int32)CursorType::MAX];
|
||||
Dictionary<StringAnsi, X11::KeyCode> KeyNameMap;
|
||||
Array<KeyboardKeys> KeyCodeMap;
|
||||
Delegate<void*> LinuxPlatform::xEventRecieved;
|
||||
|
||||
// Message boxes configuration
|
||||
#define LINUX_DIALOG_MIN_BUTTON_WIDTH 64
|
||||
@@ -2217,8 +2218,6 @@ void LinuxPlatform::BeforeRun()
|
||||
{
|
||||
}
|
||||
|
||||
Delegate<void*> LinuxPlatform::xEventRecieved;
|
||||
|
||||
void LinuxPlatform::Tick()
|
||||
{
|
||||
UnixPlatform::Tick();
|
||||
@@ -2233,12 +2232,12 @@ void LinuxPlatform::Tick()
|
||||
{
|
||||
X11::XEvent event;
|
||||
X11::XNextEvent(xDisplay, &event);
|
||||
|
||||
if (X11::XFilterEvent(&event, 0))
|
||||
continue;
|
||||
|
||||
xEventRecieved(&event); // Fire this event, since we recieved an event.
|
||||
|
||||
|
||||
// External event handling
|
||||
xEventRecieved(&event);
|
||||
|
||||
LinuxWindow* window;
|
||||
switch (event.type)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
static const String& GetHomeDirectory();
|
||||
|
||||
/// <summary>
|
||||
/// An event that is fired when an XEvent is recieved by Flax.
|
||||
/// An event that is fired when an XEvent is received during platform tick.
|
||||
/// </summary>
|
||||
static Delegate<void*> xEventRecieved;
|
||||
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
|
||||
namespace FlaxEngine.GUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Button with an icon.
|
||||
/// </summary>
|
||||
public class IconButton : Button
|
||||
{
|
||||
/// <summary>
|
||||
/// The sprite rendered on the button.
|
||||
/// </summary>
|
||||
public SpriteHandle ButtonSprite { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not to hide the border of the button.
|
||||
/// </summary>
|
||||
public bool HideBorder = true;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IconButton"/> class.
|
||||
/// </summary>
|
||||
/// <param name="buttonSprite">The sprite used by the button.</param>
|
||||
public IconButton(SpriteHandle buttonSprite)
|
||||
: this(0, 0, buttonSprite)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IconButton"/> class.
|
||||
/// </summary>
|
||||
/// <param name="x">Position X coordinate</param>
|
||||
/// <param name="y">Position Y coordinate</param>
|
||||
/// <param name="buttonSprite">The sprite used by the button.</param>
|
||||
/// <param name="width">Width</param>
|
||||
/// <param name="height">Height</param>
|
||||
/// <param name="hideBorder">Whether or not to hide the border.</param>
|
||||
public IconButton(float x, float y, SpriteHandle buttonSprite, float width = 120, float height = DefaultHeight, bool hideBorder = true)
|
||||
: base(x, y, width, height)
|
||||
{
|
||||
ButtonSprite = buttonSprite;
|
||||
BackgroundBrush = new SpriteBrush(ButtonSprite);
|
||||
HideBorder = hideBorder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IconButton"/> class.
|
||||
/// </summary>
|
||||
/// <param name="location">Position</param>
|
||||
/// <param name="size">Size</param>
|
||||
/// <param name="buttonSprite">The sprite used by the button.</param>
|
||||
public IconButton(Float2 location, Float2 size, SpriteHandle buttonSprite)
|
||||
: this(location.X, location.Y, buttonSprite, size.X, size.Y)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the colors of the button, taking into account the <see cref="HideBorder"/> field.>
|
||||
/// </summary>
|
||||
/// <param name="color">The color to use.</param>
|
||||
public override void SetColors(Color color)
|
||||
{
|
||||
BackgroundColor = color;
|
||||
BackgroundColorSelected = color.RGBMultiplied(0.8f);
|
||||
BackgroundColorHighlighted = color.RGBMultiplied(1.2f);
|
||||
|
||||
BorderColor = HideBorder ? Color.Transparent : color.RGBMultiplied(0.5f);
|
||||
BorderColorSelected = BorderColor;
|
||||
BorderColorHighlighted = BorderColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "Screenshot.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Math/Math.h"
|
||||
#include "Engine/Core/Math/Color32.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Platform/FileSystem.h"
|
||||
#include "Engine/Graphics/Textures/TextureData.h"
|
||||
@@ -11,7 +10,6 @@
|
||||
#include "Engine/Graphics/GPUResourceProperty.h"
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
#include "Engine/Graphics/GPUSwapChain.h"
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Threading/ThreadPoolTask.h"
|
||||
#include "Engine/Engine/Globals.h"
|
||||
#if COMPILE_WITH_TEXTURE_TOOL
|
||||
|
||||
Reference in New Issue
Block a user