mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
SFML WIP Update 2
Round Two! No Errors! Now its time to Implement things one by one to make sure they work as Intended!
This commit is contained in:
@@ -5,6 +5,11 @@ using SFML.System;
|
||||
using SS14.Client.Graphics.CluwneLib.Event;
|
||||
using SS14.Client.Graphics.CluwneLib.Render;
|
||||
using SS14.Client.Graphics.CluwneLib.Timing;
|
||||
using Color = System.Drawing.Color;
|
||||
using SColor = SFML.Graphics.Color;
|
||||
using SS14.Client.Graphics.CluwneLib.Shader;
|
||||
using SS14.Shared.Maths;
|
||||
using System.Drawing;
|
||||
|
||||
namespace SS14.Client.Graphics.CluwneLib
|
||||
{
|
||||
@@ -14,6 +19,7 @@ namespace SS14.Client.Graphics.CluwneLib
|
||||
private static Clock _timer;
|
||||
private static RenderTarget[] _currentTarget;
|
||||
public static event FrameEventHandler Idle;
|
||||
private Color DEFAULTCOLOR;
|
||||
|
||||
/// <summary>
|
||||
/// Start engine rendering.
|
||||
@@ -21,6 +27,8 @@ namespace SS14.Client.Graphics.CluwneLib
|
||||
/// Shamelessly taken from Gorgon.
|
||||
public static void Go()
|
||||
{
|
||||
|
||||
|
||||
if (!IsInitialized)
|
||||
; //TODO: Throw exception
|
||||
|
||||
@@ -39,12 +47,14 @@ namespace SS14.Client.Graphics.CluwneLib
|
||||
{
|
||||
if (_currentTarget[i] != null)
|
||||
{
|
||||
//_currentTarget[i].Refresh(); TODO: Refresh viewport
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Application.Idle += new EventHandler(Run);
|
||||
|
||||
IsRunning = true;
|
||||
@@ -75,26 +85,12 @@ namespace SS14.Client.Graphics.CluwneLib
|
||||
|
||||
public static bool IsInitialized { get; set; }
|
||||
|
||||
public static RenderTarget CurrentRenderTarget
|
||||
{
|
||||
get { return _currentTarget[0]; }
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
value = Screen;
|
||||
SetAdditionalRenderTarget(0, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetAdditionalRenderTarget(int i, RenderTarget value)
|
||||
{
|
||||
_currentTarget[i] = value;
|
||||
}
|
||||
|
||||
|
||||
public static RenderTarget GetAdditionalRenderTarget(int index)
|
||||
{
|
||||
return _currentTarget[index];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void Run(object sender, EventArgs e)
|
||||
@@ -104,7 +100,115 @@ namespace SS14.Client.Graphics.CluwneLib
|
||||
|
||||
public static void SetMode(Form mainWindow, int displayWidth, int displayHeight, bool b, bool b1, bool b2, int refresh)
|
||||
{
|
||||
throw new NotImplementedException(); //TOOD: Change bufferRgb888 to correct class.
|
||||
=
|
||||
}
|
||||
|
||||
public float Width
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public static RenderTarget CurrentRenderTarget
|
||||
{
|
||||
get { return _currentTarget[0]; }
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
value = Screen;
|
||||
setAdditionalRenderTarget(0, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setAdditionalRenderTarget(int index, RenderTarget _target)
|
||||
{
|
||||
_currentTarget[index] = _target;
|
||||
}
|
||||
|
||||
public static RenderTarget getAdditionalRenderTarget(int index)
|
||||
{
|
||||
return _currentTarget[index];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void Stop()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static FXShader CurrentShader { get; set; }
|
||||
|
||||
public static void drawRectangle(int posX, int posY, int WidthX, int HeightY, Color Color)
|
||||
{
|
||||
RectangleShape rectangle = new RectangleShape();
|
||||
rectangle.Position = new SFML.System.Vector2f(posX, posY);
|
||||
rectangle.Size = new SFML.System.Vector2f(WidthX, HeightY);
|
||||
rectangle.FillColor = SystemColorToSFML(Color);
|
||||
|
||||
CluwneLib.CurrentRenderTarget.Draw(rectangle);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void DrawHollowRectangle(int x, int y, int width, int height)
|
||||
{
|
||||
RectangleShape Rect = new RectangleShape();
|
||||
Rect.FillColor = new SFML.Graphics.Color(128,128,128);
|
||||
Rect.Position = new Vector2f(x, y);
|
||||
Rect.Size = new Vector2f(width, height);
|
||||
|
||||
CluwneLib.CurrentRenderTarget.Draw(Rect);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static BlendingModes BlendingMode { get; set; }
|
||||
|
||||
public static void drawCircle(int p1, int p2, int p3, Color color)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void drawPoint(int p1, int p2, Color color)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Clear(Color color)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void drawCircle(float p1, float p2, int p3, Color color, Shared.Maths.Vector2 vector2)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static SColor SystemColorToSFML(Color color) // System Color to SFML color
|
||||
{
|
||||
SColor temp = new SColor(color.R, color.G, color.B, color.A);
|
||||
return temp;
|
||||
}
|
||||
|
||||
public static Color SFMLColorToSystem(SColor color) // SFML color to System Color
|
||||
{
|
||||
Color temp = Color.FromArgb(color.R,color.G,color.B,color.A);
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
public static Vector2 PointToVector2(Point point)
|
||||
{
|
||||
|
||||
|
||||
return new Vector2(point.X, point.Y);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
525
SS14.Client.Graphics.CluwneLib/Enums/GraphicsEnums.cs
Normal file
525
SS14.Client.Graphics.CluwneLib/Enums/GraphicsEnums.cs
Normal file
@@ -0,0 +1,525 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SS14.Client.Graphics.CluwneLib
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumeration for primitive drawing style.
|
||||
/// </summary>
|
||||
public enum PrimitiveStyle
|
||||
{
|
||||
/// <summary>A series of individual points.</summary>
|
||||
PointList = 0,
|
||||
/// <summary>A series of individual lines.</summary>
|
||||
LineList = 1,
|
||||
/// <summary>A series of lines connected in a strip.</summary>
|
||||
LineStrip = 2,
|
||||
/// <summary>A series of individual triangles.</summary>
|
||||
TriangleList = 3,
|
||||
/// <summary>A series of triangles connected in a strip.</summary>
|
||||
TriangleStrip = 4,
|
||||
/// <summary>A series of triangles connected in a fan.</summary>
|
||||
TriangleFan = 5
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for culling modes.
|
||||
/// </summary>
|
||||
public enum CullingMode
|
||||
{
|
||||
/// <summary>Cull counter clockwise.</summary>
|
||||
CounterClockwise = 0,
|
||||
/// <summary>Cull clockwise.</summary>
|
||||
Clockwise = 1,
|
||||
/// <summary>No culling.</summary>
|
||||
None = 2,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumerator for vertex field contexts.
|
||||
/// Used to define in which context the field will be used.
|
||||
/// </summary>
|
||||
public enum VertexFieldContext
|
||||
{
|
||||
/// Position, 3 reals per vertex.
|
||||
Position,
|
||||
/// Normal, 3 reals per vertex.
|
||||
Normal,
|
||||
/// Blending weights.
|
||||
BlendWeights,
|
||||
/// Blending indices.
|
||||
BlendIndices,
|
||||
/// Diffuse colors.
|
||||
Diffuse,
|
||||
/// Specular colors.
|
||||
Specular,
|
||||
/// Texture coordinates.
|
||||
TexCoords,
|
||||
/// Binormal (Y axis if normal is Z).
|
||||
Binormal,
|
||||
/// Tangent (X axis if normal is Z).
|
||||
Tangent
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Enumerator for vertex field types.
|
||||
/// Used to define what type of field we're using.
|
||||
/// </summary>
|
||||
public enum VertexFieldType
|
||||
{
|
||||
/// 1 Floating point number.
|
||||
Float1,
|
||||
/// 2 Floating point numbers.
|
||||
Float2,
|
||||
/// 3 Floating point numbers.
|
||||
Float3,
|
||||
/// 4 Floating point numbers.
|
||||
Float4,
|
||||
/// DWORD color value.
|
||||
Color,
|
||||
/// 1 signed short integers.
|
||||
Short1,
|
||||
/// 2 signed short integers.
|
||||
Short2,
|
||||
/// 3 signed short integers.
|
||||
Short3,
|
||||
/// 4 signed short integers.
|
||||
Short4,
|
||||
/// 4 Unsigned bytes.
|
||||
UByte4
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration containing modes for the blitters on the image/render image objects.
|
||||
/// </summary>
|
||||
public enum BlitterSizeMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Scale the image based on the width and height passed to the blitter.
|
||||
/// </summary>
|
||||
Scale = 0,
|
||||
/// <summary>
|
||||
/// Crop the image based on the width and height passed to the blitter.
|
||||
/// </summary>
|
||||
Crop = 1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for image formats.
|
||||
/// </summary>
|
||||
public enum ImageBufferFormats
|
||||
{
|
||||
/// <summary>Unknown buffer format.</summary>
|
||||
BufferUnknown = 0,
|
||||
/// <summary>24 bit color.</summary>
|
||||
BufferRGB888 = 1,
|
||||
/// <summary>24 bit color, 8 bit alpha.</summary>
|
||||
BufferRGB888A8 = 2,
|
||||
/// <summary>15 bit color, 1 bit alpha.</summary>
|
||||
BufferRGB555A1 = 3,
|
||||
/// <summary>12 bit color, 4 bit alpha.</summary>
|
||||
BufferRGB444A4 = 4,
|
||||
/// <summary>48 bit color (BGR), 16 bit alpha.</summary>
|
||||
BufferBGR161616A16 = 5,
|
||||
/// <summary>48 bit color (BGR), 16 bit alpha, floating point.</summary>
|
||||
BufferBGR161616A16F = 6,
|
||||
/// <summary>30 bit color, 2 bit alpha.</summary>
|
||||
BufferRGB101010A2 = 7,
|
||||
/// <summary>30 bit color (BGR), 2 bit alpha.</summary>
|
||||
BufferBGR101010A2 = 8,
|
||||
/// <summary>30 bit bump map (WVU), 2 bit alpha.</summary>
|
||||
BufferWVU101010A2 = 9,
|
||||
/// <summary>96 bit color (BGR), 32 bit alpha, floating point.</summary>
|
||||
BufferBGR323232A32F = 10,
|
||||
/// <summary>4 bit luminance, 4 bit alpha.</summary>
|
||||
BufferA4L4 = 11,
|
||||
/// <summary>8 bit alpha.</summary>
|
||||
BufferA8 = 12,
|
||||
/// <summary>8 bit color, 8 bit alpha.</summary>
|
||||
BufferRGB332A8 = 13,
|
||||
/// <summary>32 bit normal map, compressed.</summary>
|
||||
BufferVU88Cx = 14,
|
||||
/// <summary>DXT1 compression.</summary>
|
||||
BufferDXT1 = 15,
|
||||
/// <summary>DXT2 compression.</summary>
|
||||
BufferDXT2 = 16,
|
||||
/// <summary>DXT3 compression.</summary>
|
||||
BufferDXT3 = 17,
|
||||
/// <summary>DXT4 compression.</summary>
|
||||
BufferDXT4 = 18,
|
||||
/// <summary>DXT5 compression.</summary>
|
||||
BufferDXT5 = 19,
|
||||
/// <summary>32 bit color (GR).</summary>
|
||||
BufferGR1616 = 20,
|
||||
/// <summary>32 bit color (GR), floating point.</summary>
|
||||
BufferGR1616F = 21,
|
||||
/// <summary>16 bit RGB packed.</summary>
|
||||
BufferRGB888G8 = 22,
|
||||
/// <summary>16 bit luminance.</summary>
|
||||
BufferL16 = 23,
|
||||
/// <summary>16 bit bump map, 5 bits for VU, 6 bits for luminance.</summary>
|
||||
BufferVU55L6 = 24,
|
||||
/// <summary>8 bit luminance.</summary>
|
||||
BufferL8 = 25,
|
||||
/// <summary>Uncompressed multi element.</summary>
|
||||
BufferMulti2RGBA = 26,
|
||||
/// <summary>8 bit color, indexed.</summary>
|
||||
BufferP8 = 27,
|
||||
/// <summary>64 bit bumpmap.</summary>
|
||||
BufferQWVU16161616 = 28,
|
||||
/// <summary>32 bit bumpmap.</summary>
|
||||
BufferQWVU8888 = 29,
|
||||
/// <summary>16 bit color (R), floating point.</summary>
|
||||
BufferR16F = 30,
|
||||
/// <summary>32 bit color (R), floating point.</summary>
|
||||
BufferR32F = 31,
|
||||
/// <summary>8 bit color.</summary>
|
||||
BufferRGB332 = 32,
|
||||
/// <summary>32 bit bump map.</summary>
|
||||
BufferVU1616 = 34,
|
||||
/// <summary>16 bit bump map.</summary>
|
||||
BufferVU88 = 35,
|
||||
/// <summary>15 bit color.</summary>
|
||||
BufferRGB555X1 = 36,
|
||||
/// <summary>12 bit color.</summary>
|
||||
BufferRGB444X4 = 37,
|
||||
/// <summary>32 bit color.</summary>
|
||||
BufferRGB888X8 = 38,
|
||||
/// <summary>32 bit bumpmap.</summary>
|
||||
BufferLVU888X8 = 39,
|
||||
/// <summary>32 bit color (BGR).</summary>
|
||||
BufferBGR888X8 = 40,
|
||||
/// <summary>4 bit bumpmap.</summary>
|
||||
BufferYUY2 = 41,
|
||||
/// <summary>24 bit color, extra 8 bit green channel.</summary>
|
||||
BufferG8RGB888 = 42,
|
||||
/// <summary>8 bit alpha, 8 bit luminance.</summary>
|
||||
BufferA8L8 = 43,
|
||||
/// <summary>8 bit alpha, 8 bit indexed color.</summary>
|
||||
BufferA8P8 = 44,
|
||||
/// <summary>64 bit color (GR), floating point.</summary>
|
||||
BufferGR3232F = 45,
|
||||
/// <summary>16 bit color.</summary>
|
||||
BufferRGB565 = 46
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration containing image operation flags.
|
||||
/// </summary>
|
||||
public enum ImageOperations
|
||||
{
|
||||
/// <summary>Disable the image layer.</summary>
|
||||
Disable = 0,
|
||||
/// <summary>Select the previous first operation argument.</summary>
|
||||
SelectArgument1 = 1,
|
||||
/// <summary>Select the previous second operation argument.</summary>
|
||||
SelectArgument2 = 2,
|
||||
/// <summary>Modulate the layer.</summary>
|
||||
Modulate = 3,
|
||||
/// <summary>Modulate the layer times 2.</summary>
|
||||
Modulatex2 = 4,
|
||||
/// <summary>Modulate the layer times 4.</summary>
|
||||
Modulatex4 = 5,
|
||||
/// <summary>Additive blending.</summary>
|
||||
Additive = 6,
|
||||
/// <summary>Additive blending with sign.</summary>
|
||||
AdditiveSigned = 7,
|
||||
/// <summary>Additive blending with sign times 2.</summary>
|
||||
AdditiveSignedx2 = 8,
|
||||
/// <summary>Additive blending with interpolation.</summary>
|
||||
AdditiveSmooth = 9,
|
||||
/// <summary>Subtract blending.</summary>
|
||||
Subtract = 10,
|
||||
/// <summary>Blend diffuse and alpha.</summary>
|
||||
BlendDiffuseAlpha = 11,
|
||||
/// <summary>Blend texture alpha.</summary>
|
||||
BlendTextureAlpha = 12,
|
||||
/// <summary>Blend factor alpha.</summary>
|
||||
BlendFactorAlpha = 13,
|
||||
/// <summary>Blend pre-multipled alpha.</summary>
|
||||
BlendPreMultipliedTextureAlpha = 14,
|
||||
/// <summary>Blend current alpha.</summary>
|
||||
BlendCurrentAlpha = 15,
|
||||
/// <summary>Pre modulate.</summary>
|
||||
PreModulate = 16,
|
||||
/// <summary>Modulate alpha, additive blending.</summary>
|
||||
ModulateAlphaAddColor = 17,
|
||||
/// <summary>Modulate color, additive alpha.</summary>
|
||||
ModulateColorAddAlpha = 18,
|
||||
/// <summary>Modulate inverse alpha, additive color.</summary>
|
||||
ModulateInverseAlphaAddColor = 19,
|
||||
/// <summary>Modulate inverse color, additive alpha.</summary>
|
||||
ModulateInverseColorAddAlpha = 20,
|
||||
/// <summary>Bump mapping using an environment map.</summary>
|
||||
BumpEnvironmentMap = 21,
|
||||
/// <summary>Bump mapping using an environment map with luminance.</summary>
|
||||
BumpEnvironmentMapLuminance = 22,
|
||||
/// <summary>Bump mapping using Dot3 product.</summary>
|
||||
BumpDotProduct = 23,
|
||||
/// <summary>Multiply and Add.</summary>
|
||||
MultiplyAdd = 24,
|
||||
/// <summary>Linear interpolation.</summary>
|
||||
Lerp = 25
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration containing arguments for image operations.
|
||||
/// </summary>
|
||||
public enum ImageOperationArguments
|
||||
{
|
||||
/// <summary>Get the current setting.</summary>
|
||||
Current = 0,
|
||||
/// <summary>Diffuse color from the vertex.</summary>
|
||||
Diffuse = 1,
|
||||
/// <summary>Texture color from the layer.</summary>
|
||||
Texture = 2,
|
||||
/// <summary>Texture factor.</summary>
|
||||
TextureFactor = 3,
|
||||
/// <summary>Temporary register.</summary>
|
||||
Temp = 4,
|
||||
/// <summary>Constant value.</summary>
|
||||
Constant = 5,
|
||||
/// <summary>Copy alpha values to color values.</summary>
|
||||
AlphaReplicate = 6,
|
||||
/// <summary>One's complement.</summary>
|
||||
Complement = 7,
|
||||
/// <summary>Specular value from the vertex.</summary>
|
||||
Specular = 8
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration containing filter types for images.
|
||||
/// </summary>
|
||||
public enum ImageFilters
|
||||
{
|
||||
/// <summary>No filtering.</summary>
|
||||
None = 0,
|
||||
/// <summary>Point filtering.</summary>
|
||||
Point = 1,
|
||||
/// <summary>Bilinear filtering.</summary>
|
||||
Bilinear = 2,
|
||||
/// <summary>Anisotropic filtering.</summary>
|
||||
Anisotropic = 3,
|
||||
/// <summary>Pyramidal quadratic filtering.</summary>
|
||||
PyramidalQuadratic = 4,
|
||||
/// <summary>Gaussian quadratic filtering.</summary>
|
||||
GaussianQuadratic = 5
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration containing the types of images we can create.
|
||||
/// </summary>
|
||||
/// <remarks>The RenderTarget value is used internally by Gorgon and should not be used when creating an image, however it can be used when validating an image format with
|
||||
/// <see cref="M:GorgonLibrary.Driver.ValidImageFormat">Driver.ValidImageFormat</see> or <see cref="M:GorgonLibrary.Graphics.Image.ValidateFormat">Image.ValidateFormat</see>.
|
||||
/// <para>The Dynamic value will ensure the image is dynamic whether the <see cref="P:GorgonLibrary.Driver.SupportDynamicTextures">Driver.SupportDynamicTextures</see> property is TRUE or FALSE.
|
||||
/// If the hardware supports dynamic textures then Gorgon will make use of it, otherwise the image will be a normal image placed in the default pool.</para>
|
||||
/// </remarks>
|
||||
public enum ImageType
|
||||
{
|
||||
/// <summary>A normal static image.</summary>
|
||||
Normal = 0,
|
||||
/// <summary>Dynamic image.</summary>
|
||||
Dynamic = 1,
|
||||
/// <summary>
|
||||
/// A render target image.
|
||||
/// </summary>
|
||||
RenderTarget = 0x7FFF
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration containing the types of image addressing modes.
|
||||
/// </summary>
|
||||
public enum ImageAddressing
|
||||
{
|
||||
/// <summary>Make image wrap around.</summary>
|
||||
Wrapping = 0,
|
||||
/// <summary>Make image mirror.</summary>
|
||||
Mirror = 1,
|
||||
/// <summary>Make image mirror only once.</summary>
|
||||
MirrorOnce = 2,
|
||||
/// <summary>Make image clamp to values..</summary>
|
||||
Clamp = 3,
|
||||
/// <summary>Display a border.</summary>
|
||||
Border = 4
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration containing image file formats.
|
||||
/// </summary>
|
||||
public enum ImageFileFormat
|
||||
{
|
||||
/// <summary>
|
||||
/// Windows bitmap format.
|
||||
/// </summary>
|
||||
BMP = 0,
|
||||
/// <summary>
|
||||
/// Joint photographers expert group.
|
||||
/// </summary>
|
||||
JPEG = 1,
|
||||
/// <summary>
|
||||
/// Portable network graphics.
|
||||
/// </summary>
|
||||
PNG = 2,
|
||||
/// <summary>
|
||||
/// Truevision Targa.
|
||||
/// </summary>
|
||||
TGA = 3,
|
||||
/// <summary>
|
||||
/// Direct X surface.
|
||||
/// </summary>
|
||||
DDS = 4,
|
||||
/// <summary>
|
||||
/// Device independant bitmap.
|
||||
/// </summary>
|
||||
DIB = 5,
|
||||
/// <summary>
|
||||
/// Portable pixmap.
|
||||
/// </summary>
|
||||
PPM = 6,
|
||||
/// <summary>
|
||||
/// Portable floating point.
|
||||
/// </summary>
|
||||
PFM = 7
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration containing locations of the vertices.
|
||||
/// </summary>
|
||||
public enum VertexLocations
|
||||
{
|
||||
/// <summary>Upper left corner.</summary>
|
||||
UpperLeft = 0,
|
||||
/// <summary>Lower left corner.</summary>
|
||||
LowerLeft = 3,
|
||||
/// <summary>Upper right corner.</summary>
|
||||
UpperRight = 1,
|
||||
/// <summary>Lower right corner.</summary>
|
||||
LowerRight = 2
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration containing blending modes.
|
||||
/// </summary>
|
||||
[Flags()]
|
||||
public enum BlendingModes
|
||||
{
|
||||
/// <summary>No blending.</summary>
|
||||
None = 0,
|
||||
/// <summary>Modulated blending.</summary>
|
||||
Modulated = 1,
|
||||
/// <summary>Additive blending.</summary>
|
||||
Additive = 2,
|
||||
/// <summary>Inverse modulated blending.</summary>
|
||||
ModulatedInverse = 4,
|
||||
/// <summary>Color blending.</summary>
|
||||
Color = 8,
|
||||
/// <summary>Additive color.</summary>
|
||||
ColorAdditive = 16,
|
||||
/// <summary>Use premultiplied.</summary>
|
||||
PreMultiplied = 32,
|
||||
/// <summary>Invert.</summary>
|
||||
Inverted = 64
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for smoothing operations.
|
||||
/// </summary>
|
||||
public enum Smoothing
|
||||
{
|
||||
/// <summary>No smoothing.</summary>
|
||||
None = 0,
|
||||
/// <summary>Smooth both zoomed in and out.</summary>
|
||||
Smooth = 1,
|
||||
/// <summary>Smooth only zoomed in.</summary>
|
||||
MagnificationSmooth = 2,
|
||||
/// <summary>Smooth only zoomed out.</summary>
|
||||
MinificationSmooth = 3
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for aligment.
|
||||
/// </summary>
|
||||
public enum Alignment
|
||||
{
|
||||
/// <summary>Left aligned.</summary>
|
||||
Left = 0,
|
||||
/// <summary>Centered.</summary>
|
||||
Center = 1,
|
||||
/// <summary>Right aligned.</summary>
|
||||
Right = 2,
|
||||
/// <summary>Upper left corner.</summary>
|
||||
UpperLeft = 3,
|
||||
/// <summary>Upper centered.</summary>
|
||||
UpperCenter = 4,
|
||||
/// <summary>Upper right.</summary>
|
||||
UpperRight = 5,
|
||||
/// <summary>Lower left.</summary>
|
||||
LowerLeft = 6,
|
||||
/// <summary>Lower centered.</summary>
|
||||
LowerCenter = 7,
|
||||
/// <summary>Lower right.</summary>
|
||||
LowerRight = 8
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for stencil buffer operations.
|
||||
/// </summary>
|
||||
public enum StencilOperations
|
||||
{
|
||||
/// <summary>Write zero to the buffer.</summary>
|
||||
Zero = 0,
|
||||
/// <summary>Decrement buffer value.</summary>
|
||||
Decrement = 1,
|
||||
/// <summary>Increment buffer value.</summary>
|
||||
Increment = 2,
|
||||
/// <summary>Invert buffer value.</summary>
|
||||
Invert = 3,
|
||||
/// <summary>Decrement buffer value, clamp to minimum.</summary>
|
||||
DecrementSaturate = 4,
|
||||
/// <summary>Increment buffer value, clamp to maximum.</summary>
|
||||
IncrementSaturate = 5,
|
||||
/// <summary>Keep the current value.</summary>
|
||||
Keep = 6,
|
||||
/// <summary>Replace the value with the reference value.</summary>
|
||||
Replace = 7
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for alpha blending operations.
|
||||
/// </summary>
|
||||
public enum AlphaBlendOperation
|
||||
{
|
||||
/// <summary>Blend factor of 0,0,0.</summary>
|
||||
Zero = 0,
|
||||
/// <summary>Blend factor is 1,1,1.</summary>
|
||||
One = 1,
|
||||
/// <summary>Blend factor is Rs', Gs', Bs', As.</summary>
|
||||
SourceColor = 2,
|
||||
/// <summary>Blend factor is As', As', As', As.</summary>
|
||||
SourceAlpha = 3,
|
||||
/// <summary>Blend factor is 1-Rs', 1-Gs', 1-Bs', 1-As.</summary>
|
||||
InverseSourceColor = 4,
|
||||
/// <summary>Blend factor is 1-As', 1-As', 1-As', 1-As.</summary>
|
||||
InverseSourceAlpha = 5,
|
||||
/// <summary>Blend factor is Rd', Gd', Bd', Ad.</summary>
|
||||
DestinationColor = 6,
|
||||
/// <summary>Blend factor is Ad', Ad', Ad', Ad.</summary>
|
||||
DestinationAlpha = 7,
|
||||
/// <summary>Blend factor is 1-Rd', 1-Gd', 1-Bd', 1-Ad.</summary>
|
||||
InverseDestinationColor = 8,
|
||||
/// <summary>Blend factor is 1-Ad', 1-Ad', 1-Ad', 1-Ad.</summary>
|
||||
InverseDestinationAlpha = 9,
|
||||
/// <summary>Blend factor is f,f,f,1 where f = min(A, 1-Ad)</summary>
|
||||
SourceAlphaSaturation = 10,
|
||||
/// <summary>Source blend factor is 1-As', 1-As', 1-As', 1-As and destination is As', As', As', As. Overrides the blend destination, and is only valid if the SourceBlend state is true.</summary>
|
||||
BothInverseSourceAlpha = 11,
|
||||
/// <summary>Constant color blend factor. Only valid if the driver SupportBlendingFactor is true.</summary>
|
||||
BlendFactor = 12,
|
||||
/// <summary>Inverted constant color blend factor. Only valid if the driver SupportBlendingFactor capability is true.</summary>
|
||||
InverseBlendFactor = 13
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using SFML.Graphics;
|
||||
using SFML.Window;
|
||||
using System.Windows.Forms;
|
||||
using Color = SFML.Graphics.Color;
|
||||
|
||||
namespace SS14.Client.Graphics.CluwneLib.Render
|
||||
@@ -31,5 +32,7 @@ namespace SS14.Client.Graphics.CluwneLib.Render
|
||||
}
|
||||
|
||||
public Color BackgroundColor { get; set; }
|
||||
|
||||
public Form OwnerForm { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,24 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using SFML.Graphics;
|
||||
using Color = SFML.Graphics.Color;
|
||||
using Color = System.Drawing.Color;
|
||||
|
||||
namespace SS14.Client.Graphics.CluwneLib.Render
|
||||
{
|
||||
public class RenderImage : RenderTexture
|
||||
{
|
||||
private string p1;
|
||||
private uint p2;
|
||||
private uint p3;
|
||||
private ImageBufferFormats imageBufferFormats;
|
||||
private string uniqueName;
|
||||
private int p4;
|
||||
private int p5;
|
||||
private string targetName;
|
||||
|
||||
|
||||
|
||||
|
||||
public RenderImage(uint width, uint height) : base(width, height)
|
||||
{
|
||||
}
|
||||
@@ -17,9 +29,41 @@ namespace SS14.Client.Graphics.CluwneLib.Render
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public void Blit(float x, float y, float width, float height, Color color, RenderStates state)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public uint Width { get; set; }
|
||||
public uint Height { get; set; }
|
||||
|
||||
public void Blit(int p1, int p2, uint p3, uint p4, System.Drawing.Color color, BlitterSizeMode blitterSizeMode)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public void Blit(int p1, int p2, uint p3, uint p4)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void EndDrawing()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void BeginDrawing()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Clear(Color Color)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string setName { get; set; }
|
||||
|
||||
public ImageBufferFormats setImageBuffer { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,17 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using SFML.Graphics;
|
||||
using BaseShader = SFML.Graphics.Shader;
|
||||
using SS14.Client.Graphics.CluwneLib.Render;
|
||||
|
||||
namespace SS14.Client.Graphics.CluwneLib.Shader
|
||||
{
|
||||
public class FXShader : BaseShader
|
||||
{
|
||||
private string _resourceName;
|
||||
private MemoryStream _memStream;
|
||||
|
||||
|
||||
|
||||
public FXShader(string vertexShaderFilename, string fragmentShaderFilename) : base(vertexShaderFilename, fragmentShaderFilename)
|
||||
{
|
||||
}
|
||||
@@ -21,5 +27,36 @@ namespace SS14.Client.Graphics.CluwneLib.Shader
|
||||
public FXShader(IntPtr ptr) : base(ptr)
|
||||
{
|
||||
}
|
||||
|
||||
public string ResourceName
|
||||
{
|
||||
get { return _resourceName; }
|
||||
set { _resourceName = value; }
|
||||
}
|
||||
|
||||
public MemoryStream memStream
|
||||
{
|
||||
get
|
||||
{
|
||||
return _memStream;
|
||||
}
|
||||
set
|
||||
{
|
||||
_memStream = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setDuration(float duration)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SetParameter(string Parameter, RenderImage Image)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,5 +18,10 @@ namespace SS14.Client.Graphics.CluwneLib.Sprite
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public void AddClone (CluwneSprite CSprite)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Color = System.Drawing.Color;
|
||||
using Color = SFML.Graphics.Color;
|
||||
using SFML.Graphics;
|
||||
using Drawing = System.Drawing;
|
||||
using BaseSprite = SFML.Graphics.Sprite;
|
||||
using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using SS14.Shared.Maths;
|
||||
|
||||
namespace SS14.Client.Graphics.CluwneLib.Sprite
|
||||
{
|
||||
@@ -18,6 +19,9 @@ namespace SS14.Client.Graphics.CluwneLib.Sprite
|
||||
private BlendMode _blendingMode = BlendMode.None;
|
||||
|
||||
public string Name;
|
||||
private string key;
|
||||
private Image image;
|
||||
private Vector2 _imageOffset;
|
||||
|
||||
public CluwneSprite()
|
||||
{
|
||||
@@ -43,6 +47,13 @@ namespace SS14.Client.Graphics.CluwneLib.Sprite
|
||||
{
|
||||
}
|
||||
|
||||
public CluwneSprite(string key, Image image)
|
||||
{
|
||||
// TODO: Complete member initialization
|
||||
this.key = key;
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public Drawing.RectangleF AABB
|
||||
{
|
||||
get
|
||||
@@ -82,6 +93,11 @@ namespace SS14.Client.Graphics.CluwneLib.Sprite
|
||||
|
||||
}
|
||||
|
||||
public void Draw (CluwneSprite CS1 )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public float Width
|
||||
{
|
||||
get { return GetLocalBounds().Width; }
|
||||
@@ -98,5 +114,34 @@ namespace SS14.Client.Graphics.CluwneLib.Sprite
|
||||
get { return _blendingMode; }
|
||||
set { _blendingMode = value; }
|
||||
}
|
||||
|
||||
public void Draw ( Drawing.Rectangle _clientAreaMain )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Vector2 ImageOffset
|
||||
{
|
||||
get { return _imageOffset; }
|
||||
set
|
||||
{
|
||||
_imageOffset = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Image getImage
|
||||
{
|
||||
get { return image; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public Vector2 Size { get; set; }
|
||||
|
||||
|
||||
public Color Color
|
||||
{
|
||||
get { return Color; }
|
||||
set { Color = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using SS14.Shared.Maths;
|
||||
using SFML.Graphics;
|
||||
using SS14.Shared.Maths;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BaseSprite = SFML.Graphics.Sprite;
|
||||
using Color = System.Drawing.Color;
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +15,7 @@ namespace SS14.Client.Graphics.CluwneLib.Sprite
|
||||
/// <summary>
|
||||
/// Handles Text Sprites
|
||||
/// </summary>
|
||||
public class TextSprite
|
||||
public class TextSprite : BaseSprite
|
||||
{
|
||||
|
||||
private string p1; // Title
|
||||
@@ -23,8 +26,8 @@ namespace SS14.Client.Graphics.CluwneLib.Sprite
|
||||
private Boolean _Shadowed; // Is the Text Shadowed
|
||||
private Vector2 _Position; // Position (X , Y) Of Text Sprite
|
||||
private SFML.Graphics.Font _Font; // Text Font
|
||||
private System.Drawing.Color _baseColor; // Base Color
|
||||
private System.Drawing.Color _shadowColor; // Shadow Color
|
||||
private Color _baseColor; // Base Color
|
||||
private Color _shadowColor; // Shadow Color
|
||||
|
||||
|
||||
public TextSprite ()
|
||||
@@ -32,14 +35,20 @@ namespace SS14.Client.Graphics.CluwneLib.Sprite
|
||||
|
||||
}
|
||||
|
||||
public TextSprite( string p1 , string p2 , SFML.Graphics.Font font )
|
||||
public TextSprite( string Name , string Text, Font font )
|
||||
{
|
||||
//TODO FINISH THIS
|
||||
this.p1 = p1;
|
||||
this.p2 = p2;
|
||||
this._Font = font;
|
||||
|
||||
}
|
||||
|
||||
public TextSprite(string Name, int x, int y, int width, int height)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void Draw ( )
|
||||
{
|
||||
@@ -52,7 +61,7 @@ namespace SS14.Client.Graphics.CluwneLib.Sprite
|
||||
|
||||
#region Accessors
|
||||
|
||||
public System.Drawing.Color Color
|
||||
public Color Color
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -78,7 +87,7 @@ namespace SS14.Client.Graphics.CluwneLib.Sprite
|
||||
}
|
||||
}
|
||||
|
||||
public System.Drawing.Color ShadowColor
|
||||
public Color ShadowColor
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -138,5 +147,19 @@ namespace SS14.Client.Graphics.CluwneLib.Sprite
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public int MeasureLine ( string _text )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public System.Drawing.Size Size
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
|
||||
public Vector2 ShadowOffset { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace SS14.Client.Graphics.CluwneLib.Vertex
|
||||
namespace SS14.Client.Graphics.CluwneLib.VertexData
|
||||
{
|
||||
public class VertexEnums
|
||||
{
|
||||
@@ -3,12 +3,12 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using SS14.Client.Graphics.CluwneLib.Vertex;
|
||||
using VertexFieldContext = SS14.Client.Graphics.CluwneLib.Vertex.VertexEnums.VertexFieldContext;
|
||||
using VertexFieldType = SS14.Client.Graphics.CluwneLib.Vertex.VertexEnums.VertexFieldType;
|
||||
using SS14.Client.Graphics.CluwneLib.VertexData;
|
||||
using VertexFieldContext = SS14.Client.Graphics.CluwneLib.VertexData.VertexEnums.VertexFieldContext;
|
||||
using VertexFieldType = SS14.Client.Graphics.CluwneLib.VertexData.VertexEnums.VertexFieldType;
|
||||
|
||||
|
||||
namespace SS14.Client.Graphics.CluwneLib.Vertex
|
||||
namespace SS14.Client.Graphics.CluwneLib.VertexData
|
||||
{
|
||||
/// <summary>
|
||||
/// VertexField
|
||||
@@ -2,13 +2,13 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using SS14.Client.Graphics.CluwneLib.Vertex;
|
||||
using VertexFieldContext = SS14.Client.Graphics.CluwneLib.Vertex.VertexEnums.VertexFieldContext;
|
||||
using VertexFieldType = SS14.Client.Graphics.CluwneLib.Vertex.VertexEnums.VertexFieldType;
|
||||
using SS14.Client.Graphics.CluwneLib.VertexData;
|
||||
using VertexFieldContext = SS14.Client.Graphics.CluwneLib.VertexData.VertexEnums.VertexFieldContext;
|
||||
using VertexFieldType = SS14.Client.Graphics.CluwneLib.VertexData.VertexEnums.VertexFieldType;
|
||||
|
||||
|
||||
|
||||
namespace SS14.Client.Graphics.CluwneLib.Vertex
|
||||
namespace SS14.Client.Graphics.CluwneLib.VertexData
|
||||
{
|
||||
/// <summary>
|
||||
/// Vertex declaration system.
|
||||
@@ -5,14 +5,14 @@ using System.Runtime.InteropServices;
|
||||
using Drawing = System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
using SS14.Shared.Maths;
|
||||
using SS14.Client.Graphics.CluwneLib.Vertex;
|
||||
using SS14.Client.Graphics.CluwneLib.VertexData;
|
||||
using SS14.Client.Graphics.CluwneLib.Collection;
|
||||
using VertexFieldContext = SS14.Client.Graphics.CluwneLib.Vertex.VertexEnums.VertexFieldContext;
|
||||
using VertexFieldType = SS14.Client.Graphics.CluwneLib.Vertex.VertexEnums.VertexFieldType;
|
||||
using VertexFieldContext = SS14.Client.Graphics.CluwneLib.VertexData.VertexEnums.VertexFieldContext;
|
||||
using VertexFieldType = SS14.Client.Graphics.CluwneLib.VertexData.VertexEnums.VertexFieldType;
|
||||
|
||||
|
||||
|
||||
namespace SS14.Client.Graphics.CluwneLib.Vertex
|
||||
namespace SS14.Client.Graphics.CluwneLib.VertexData
|
||||
{
|
||||
/// <summary>
|
||||
/// Object representing a list of vertex types.
|
||||
@@ -9,5 +9,6 @@ namespace SS14.Client.Graphics.CluwneLib
|
||||
{
|
||||
public float Width { get; set; }
|
||||
public float Height { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ using SS14.Client.Interfaces.Utility;
|
||||
using SS14.Shared.IoC;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
using Color = System.Drawing.Color;
|
||||
|
||||
namespace SS14.Client.Services.Helpers
|
||||
{
|
||||
@@ -187,29 +189,30 @@ namespace SS14.Client.Services.Helpers
|
||||
public void PerformGaussianBlur(RenderImage sourceImage)
|
||||
{
|
||||
// Perform horizontal Gaussian blur.
|
||||
_intermediateTarget = new RenderImage(targetName, sourceImage.Width, sourceImage.Height, sourceImage.Format);
|
||||
_intermediateTarget = new RenderImage(sourceImage.Width, sourceImage.Height);
|
||||
_intermediateTarget.setName = targetName;
|
||||
_intermediateTarget.Clear(Color.Black);
|
||||
|
||||
Gorgon.CurrentRenderTarget = _intermediateTarget;
|
||||
Gorgon.CurrentShader = _shader.Techniques["GaussianBlurHorizontal"];
|
||||
CluwneLib.CurrentRenderTarget = _intermediateTarget;
|
||||
CluwneLib.CurrentShader = _shader; //TODO .Techniques["GaussianBlurHorizontal"];
|
||||
|
||||
_shader.Parameters["weights_offsets"].SetValue(WeightsOffsetsX);
|
||||
_shader.Parameters["colorMapTexture"].SetValue(sourceImage.Image);
|
||||
// _shader.setParameter("weights_offsets").SetValue(WeightsOffsetsX);
|
||||
// _shader.setParameters["colorMapTexture"].SetValue(sourceImage.Image);
|
||||
|
||||
sourceImage.Image.Blit(0, 0, sourceImage.Image.Width, sourceImage.Image.Height);
|
||||
sourceImage.Blit(0, 0, sourceImage.Width, sourceImage.Height);
|
||||
|
||||
// Perform vertical Gaussian blur.
|
||||
Gorgon.CurrentRenderTarget = sourceImage;
|
||||
Gorgon.CurrentShader = _shader.Techniques["GaussianBlurVertical"];
|
||||
CluwneLib.CurrentRenderTarget = sourceImage;
|
||||
CluwneLib.CurrentShader = _shader; //.Techniques["GaussianBlurVertical"];
|
||||
|
||||
_shader.Parameters["colorMapTexture"].SetValue(_intermediateTarget.Image);
|
||||
_shader.Parameters["weights_offsets"].SetValue(WeightsOffsetsY);
|
||||
// _shader.Parameters["colorMapTexture"].SetValue(_intermediateTarget.Image);
|
||||
//_shader.Parameters["weights_offsets"].SetValue(WeightsOffsetsY);
|
||||
|
||||
//_intermediateTargetSprite.Draw();
|
||||
_intermediateTarget.Image.Blit(0, 0, sourceImage.Image.Width, sourceImage.Image.Height);
|
||||
_intermediateTarget.Blit(0, 0, sourceImage.Width, sourceImage.Height);
|
||||
|
||||
Gorgon.CurrentShader = null;
|
||||
Gorgon.CurrentRenderTarget = null;
|
||||
CluwneLib.CurrentShader = null;
|
||||
CluwneLib.CurrentRenderTarget = null;
|
||||
_intermediateTarget.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ namespace SS14.Client.Services.Helpers
|
||||
{
|
||||
for (int i = 0; i < _stars.Length/4; i++)
|
||||
{
|
||||
_stars[i, layer].Position = new Vector2((float) (_random.NextDouble()*Gorgon.Screen.Width),
|
||||
_stars[i, layer].Position = new Vector2((float) (_random.NextDouble()*CluwneLib.Screen.Size.X),
|
||||
(float)
|
||||
(_random.NextDouble()*Gorgon.CurrentClippingViewport.Height));
|
||||
(_random.NextDouble()*CluwneLib.CurrentClippingViewport.Height));
|
||||
|
||||
// Select magnitude.
|
||||
switch (layer)
|
||||
@@ -56,26 +56,26 @@ namespace SS14.Client.Services.Helpers
|
||||
// Draw the stars.
|
||||
for (int i = 0; i < _stars.Length/4; i++)
|
||||
{
|
||||
Gorgon.CurrentRenderTarget.SetPoint((int) _stars[i, layer].Position.X, (int) _stars[i, layer].Position.Y,
|
||||
CluwneLib.drawPoint((int) _stars[i, layer].Position.X, (int) _stars[i, layer].Position.Y,
|
||||
_stars[i, layer].Magnitude);
|
||||
|
||||
// Move the stars down.
|
||||
_stars[i, layer].Position.Y += _stars[i, layer].VDelta*deltaTime;
|
||||
|
||||
// Wrap around.
|
||||
if (_stars[i, layer].Position.Y > Gorgon.CurrentClippingViewport.Height)
|
||||
if (_stars[i, layer].Position.Y > CluwneLib.CurrentClippingViewport.Height)
|
||||
_stars[i, layer].Position =
|
||||
new Vector2((float) (_random.NextDouble()*Gorgon.CurrentClippingViewport.Width), 0);
|
||||
new Vector2((float) (_random.NextDouble()*CluwneLib.CurrentClippingViewport.Width), 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void Render(float xTopleft, float yTopleft)
|
||||
{
|
||||
Gorgon.CurrentRenderTarget.Clear(Color.Black);
|
||||
DrawStars(3, (float) Gorgon.FrameStats.FrameDrawTime/2000);
|
||||
DrawStars(2, (float) Gorgon.FrameStats.FrameDrawTime/2000);
|
||||
CluwneLib.Clear(Color.Black);
|
||||
DrawStars(3, (float) CluwneLib.FrameStats.FrameDrawTime/2000);
|
||||
DrawStars(2, (float) CluwneLib.FrameStats.FrameDrawTime/2000);
|
||||
for (int layer = 1; layer >= 0; layer--)
|
||||
DrawStars(layer, (float) Gorgon.FrameStats.FrameDrawTime/2000);
|
||||
DrawStars(layer, (float) CluwneLib.FrameStats.FrameDrawTime/2000);
|
||||
}
|
||||
|
||||
#region Nested type: Star
|
||||
|
||||
@@ -9,6 +9,7 @@ using SS14.Shared.GO;
|
||||
using SS14.Shared.IoC;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
|
||||
namespace SS14.Client.Services.Helpers
|
||||
@@ -26,7 +27,7 @@ namespace SS14.Client.Services.Helpers
|
||||
ComponentMessageType.GetSprite);
|
||||
if (reply.MessageType == ComponentMessageType.CurrentSprite)
|
||||
{
|
||||
var sprite = (Sprite) reply.ParamsList[0];
|
||||
var sprite = (CluwneSprite) reply.ParamsList[0];
|
||||
return sprite;
|
||||
}
|
||||
return null;
|
||||
@@ -49,17 +50,17 @@ namespace SS14.Client.Services.Helpers
|
||||
var clickPoint = new PointF(clickPos.X, clickPos.Y);
|
||||
if (!toCheck.AABB.Contains(clickPoint)) return false;
|
||||
|
||||
var spritePosition = new Point((int) clickPos.X - (int) toCheck.Position.X + (int) toCheck.ImageOffset.X,
|
||||
(int) clickPos.Y - (int) toCheck.Position.Y + (int) toCheck.ImageOffset.Y);
|
||||
var spritePosition = new Point((int) clickPos.X - (int) toCheck.Position.X ,//+ (int) toCheck.ImageOffset.X,
|
||||
(int) clickPos.Y - (int) toCheck.Position.Y ); //+ (int) toCheck.ImageOffset.Y);
|
||||
|
||||
Image.ImageLockBox imgData = toCheck.Image.GetImageData();
|
||||
//Image.ImageLockBox imgData = toCheck.Image.GetImageData();
|
||||
|
||||
imgData.Lock(false);
|
||||
Color pixColour = Color.FromArgb((int) (imgData[spritePosition.X, spritePosition.Y]));
|
||||
imgData.Dispose();
|
||||
imgData.Unlock();
|
||||
//imgData.Lock(false);
|
||||
//Color pixColour = Color.FromArgb((int) (imgData[spritePosition.X, spritePosition.Y]));
|
||||
//imgData.Dispose();
|
||||
//imgData.Unlock();
|
||||
|
||||
return pixColour.A != 0;
|
||||
return true; //pixColour.A != 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,23 +78,28 @@ namespace SS14.Client.Services.Lighting
|
||||
}
|
||||
|
||||
public ILight[] LightsIntersectingRect(RectangleF rect)
|
||||
{
|
||||
return
|
||||
_lights.FindAll(
|
||||
l => l.LightArea.LightPosition + l.LightArea.LightAreaSize/2 > new Vector2(rect.Left, rect.Top)
|
||||
&&
|
||||
l.LightArea.LightPosition - l.LightArea.LightAreaSize/2 < new Vector2(rect.Right, rect.Bottom))
|
||||
.ToArray();
|
||||
{ //TODO Rewrite this
|
||||
//return
|
||||
// _lights.FindAll(
|
||||
// l => l.LightArea.LightPosition + l.LightArea.LightAreaSize/2 > new Vector2(rect.Left, rect.Top)
|
||||
// &&
|
||||
// l.LightArea.LightPosition - l.LightArea.LightAreaSize/2 < new Vector2(rect.Right, rect.Bottom))
|
||||
// .ToArray();
|
||||
return null;
|
||||
}
|
||||
|
||||
public ILight[] LightsIntersectingPoint(Vector2 point)
|
||||
{
|
||||
return
|
||||
_lights.FindAll(
|
||||
l => l.LightArea.LightPosition + l.LightArea.LightAreaSize/2 > point
|
||||
&&
|
||||
l.LightArea.LightPosition - l.LightArea.LightAreaSize/2 < point)
|
||||
.ToArray();
|
||||
//return
|
||||
// _lights.FindAll(
|
||||
// l => l.LightArea.LightPosition + l.LightArea.LightAreaSize/2 > point
|
||||
// &&
|
||||
// l.LightArea.LightPosition - l.LightArea.LightAreaSize/2 < point)
|
||||
// .ToArray();
|
||||
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ILight CreateLight()
|
||||
|
||||
@@ -9,6 +9,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using Color = SFML.Graphics.Color;
|
||||
|
||||
|
||||
namespace SS14.Client.Services.Tiles
|
||||
{
|
||||
@@ -56,7 +58,7 @@ namespace SS14.Client.Services.Tiles
|
||||
|
||||
public virtual void Render(float xTopLeft, float yTopLeft, Batch batch)
|
||||
{
|
||||
Sprite.Color = Color.White;
|
||||
Sprite.Color = SFML.Graphics.Color.White;
|
||||
Sprite.SetPosition((float)Position.X - xTopLeft,
|
||||
(float)Position.Y - yTopLeft);
|
||||
batch.AddClone(Sprite);
|
||||
@@ -65,7 +67,7 @@ namespace SS14.Client.Services.Tiles
|
||||
|
||||
public virtual void RenderPos(float x, float y, int tileSpacing, int lightSize)
|
||||
{
|
||||
Sprite.Color = Color.Transparent;
|
||||
Sprite.Color = SFML.Graphics.Color.Transparent;
|
||||
Sprite.SetPosition(x, y);
|
||||
Sprite.Draw();
|
||||
}
|
||||
@@ -104,10 +106,10 @@ namespace SS14.Client.Services.Tiles
|
||||
switch (gasAmount.Key)
|
||||
{
|
||||
case GasType.Toxin:
|
||||
gasSprite.Color = Color.FromArgb(opacity, Color.Orange);
|
||||
gasSprite.Color = new Color(255,5,0);
|
||||
break;
|
||||
case GasType.WVapor:
|
||||
gasSprite.Color = Color.FromArgb(opacity, Color.LightBlue);
|
||||
gasSprite.Color = new Color(255 , 5 , 0);
|
||||
break;
|
||||
}
|
||||
gasBatch.AddClone(gasSprite);
|
||||
@@ -167,7 +169,7 @@ namespace SS14.Client.Services.Tiles
|
||||
}
|
||||
decals.Add(new TileDecal(_resourceManager.GetSprite(decalname),
|
||||
new Vector2(_random.Next(0, 64), _random.Next(0, 64)), this,
|
||||
Color.FromArgb(165, 6, 6)));
|
||||
new Color(165, 6, 6)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ using SS14.Shared;
|
||||
using SS14.Shared.GameObjects;
|
||||
using SS14.Shared.IoC;
|
||||
using System.Drawing;
|
||||
using Color = SFML.Graphics.Color;
|
||||
using SS14.Shared.Maths;
|
||||
|
||||
namespace SS14.Client.Services.Tiles
|
||||
{
|
||||
@@ -166,7 +168,7 @@ namespace SS14.Client.Services.Tiles
|
||||
(float)bounds.Y - (Sprite.Height - bounds.Height) - yTopLeft);
|
||||
|
||||
Sprite.Color = Color.White;
|
||||
batch.AddClone(Sprite);
|
||||
// batch.AddClone(Sprite);
|
||||
|
||||
if(_dir == Direction.East)
|
||||
{
|
||||
@@ -176,7 +178,7 @@ namespace SS14.Client.Services.Tiles
|
||||
{
|
||||
wallEndW.SetPosition((float)bounds.X - xTopLeft - 12f,
|
||||
(float)bounds.Y - (Sprite.Height - bounds.Height) - yTopLeft);
|
||||
batch.AddClone(wallEndW);
|
||||
// batch.AddClone(wallEndW);
|
||||
}
|
||||
}
|
||||
if ((surroundDirsSE & 2) == 0)
|
||||
@@ -185,7 +187,7 @@ namespace SS14.Client.Services.Tiles
|
||||
{
|
||||
wallEndE.SetPosition((float)bounds.X - xTopLeft + Sprite.Width,
|
||||
(float)bounds.Y - (Sprite.Height - bounds.Height) - yTopLeft);
|
||||
batch.AddClone(wallEndE);
|
||||
// batch.AddClone(wallEndE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -318,8 +320,8 @@ namespace SS14.Client.Services.Tiles
|
||||
}
|
||||
}
|
||||
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(drawX + bx, drawY + by, width,
|
||||
height, Color.Black);
|
||||
//TODO
|
||||
// CluwneLib.CurrentRenderTarget.FilledRectangle(drawX + bx, drawY + by, width, height, Color.Black);
|
||||
}
|
||||
|
||||
public override void RenderPos(float x, float y, int tileSpacing, int lightSize)
|
||||
@@ -448,9 +450,10 @@ namespace SS14.Client.Services.Tiles
|
||||
lightVec *= 10;
|
||||
Sprite.Color = Color.Black;
|
||||
Sprite.SetPosition(x + lightVec.X, y + lightVec.Y);
|
||||
Sprite.BlendingMode = BlendingModes.Inverted;
|
||||
Sprite.DestinationBlend = AlphaBlendOperation.SourceAlpha;
|
||||
Sprite.SourceBlend = AlphaBlendOperation.One;
|
||||
//TODO Sprite stuff
|
||||
//Sprite.BlendingMode = BlendingModes.Inverted;
|
||||
//Sprite.DestinationBlend = AlphaBlendOperation.SourceAlpha;
|
||||
//Sprite.SourceBlend = AlphaBlendOperation.One;
|
||||
Sprite.Draw();
|
||||
if (lightVec.X < 0)
|
||||
lightVec.X = -3;
|
||||
@@ -470,8 +473,7 @@ namespace SS14.Client.Services.Tiles
|
||||
if (surroundingTiles[3] != null && IsOpaque(3) && lightVec.X < 0)
|
||||
lightVec.X = 2;*/
|
||||
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(x + lightVec.X, y + lightVec.Y, Sprite.Width + 1,
|
||||
Sprite.Height + 1, Color.FromArgb(0, Color.Transparent));
|
||||
//CluwneLib.CurrentRenderTarget.FilledRectangle(x + lightVec.X, y + lightVec.Y, Sprite.Width + 1,Sprite.Height + 1, Color.FromArgb(0, Color.Transparent));
|
||||
}
|
||||
|
||||
public override void DrawDecals(float xTopLeft, float yTopLeft, int tileSpacing, Batch decalBatch)
|
||||
@@ -490,7 +492,7 @@ namespace SS14.Client.Services.Tiles
|
||||
topSpriteNW.SetPosition((float)bounds.X - xTopLeft - 12f,
|
||||
(float)bounds.Y - (Sprite.Height - bounds.Height) - yTopLeft);
|
||||
|
||||
SEpos += topSpriteNW.Position + new Vector2(tileSpacing, 0f);
|
||||
// SEpos += topSpriteNW.Position + new Vector2(tileSpacing, 0f);
|
||||
|
||||
}
|
||||
else
|
||||
@@ -498,7 +500,7 @@ namespace SS14.Client.Services.Tiles
|
||||
topSpriteNW.SetPosition((float)bounds.X - xTopLeft,
|
||||
(float)bounds.Y - (Sprite.Height - bounds.Height) - yTopLeft - 12f);
|
||||
|
||||
SEpos += topSpriteNW.Position + new Vector2(0f, tileSpacing);
|
||||
// SEpos += topSpriteNW.Position + new Vector2(0f, tileSpacing);
|
||||
}
|
||||
|
||||
topSpriteSE.SetPosition(SEpos.X, SEpos.Y);
|
||||
@@ -510,10 +512,10 @@ namespace SS14.Client.Services.Tiles
|
||||
topSprite.SetPosition((float)bounds.X - xTopLeft,
|
||||
(float)bounds.Y - (Sprite.Height - bounds.Height) - yTopLeft);
|
||||
|
||||
wallTopsBatch.AddClone(topSprite);
|
||||
//wallTopsBatch.AddClone(topSprite);
|
||||
|
||||
wallTopsBatch.AddClone(topSpriteNW);
|
||||
wallTopsBatch.AddClone(topSpriteSE);
|
||||
//wallTopsBatch.AddClone(topSpriteNW);
|
||||
//wallTopsBatch.AddClone(topSpriteSE);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
using SS14.Shared.Maths;
|
||||
|
||||
namespace SS14.Client.Services.Network
|
||||
{
|
||||
@@ -67,29 +69,28 @@ namespace SS14.Client.Services.Network
|
||||
totalRecBytes += _dataPoints[i].RecievedBytes;
|
||||
totalSentBytes += _dataPoints[i].SentBytes;
|
||||
|
||||
Gorgon.CurrentRenderTarget = null;
|
||||
CluwneLib.CurrentRenderTarget = null;
|
||||
|
||||
//Draw recieved line
|
||||
Gorgon.CurrentRenderTarget.Rectangle(Gorgon.CurrentRenderTarget.Width - (4*(MaxDataPoints - i)),
|
||||
Gorgon.CurrentRenderTarget.Height -
|
||||
(_dataPoints[i].RecievedBytes*0.1f), 2,
|
||||
(_dataPoints[i].RecievedBytes*0.1f),
|
||||
Color.FromArgb(180, Color.Red));
|
||||
CluwneLib.drawRectangle((int)CluwneLib.CurrentRenderTarget.Size.X - (4*(MaxDataPoints - i)),
|
||||
(int) CluwneLib.CurrentRenderTarget.Size.Y - (int)(_dataPoints[i].RecievedBytes* 0.1f),
|
||||
2,
|
||||
(int) (_dataPoints[i].RecievedBytes*0.1f),
|
||||
Color.FromArgb(180, Color.Red));
|
||||
|
||||
Gorgon.CurrentRenderTarget.Rectangle(Gorgon.CurrentRenderTarget.Width - (4*(MaxDataPoints - i)) + 2,
|
||||
Gorgon.CurrentRenderTarget.Height - (_dataPoints[i].SentBytes*0.1f),
|
||||
2, (_dataPoints[i].SentBytes*0.1f),
|
||||
Color.FromArgb(180, Color.Green));
|
||||
CluwneLib.drawRectangle((int)CluwneLib.CurrentRenderTarget.Size.X - (4*(MaxDataPoints - i)) + 2,
|
||||
(int)CluwneLib.CurrentRenderTarget.Size.Y - (int)(_dataPoints[i].SentBytes * 0.1f),
|
||||
2,
|
||||
(int)(_dataPoints[i].SentBytes*0.1f),
|
||||
Color.FromArgb(180, Color.Green));
|
||||
}
|
||||
|
||||
_textSprite.Text = String.Format("Up: {0} kb/s.", Math.Round(totalSentBytes/totalMilliseconds, 6));
|
||||
_textSprite.SetPosition(Gorgon.CurrentRenderTarget.Width - (4*MaxDataPoints) - 100,
|
||||
Gorgon.CurrentRenderTarget.Height - 30);
|
||||
_textSprite.Position = new Vector2 (CluwneLib.CurrentRenderTarget.Size.X - (4*MaxDataPoints) - 100, CluwneLib.CurrentRenderTarget.Size.Y - 30);
|
||||
_textSprite.Draw();
|
||||
|
||||
_textSprite.Text = String.Format("Down: {0} kb/s.", Math.Round(totalRecBytes/totalMilliseconds, 6));
|
||||
_textSprite.SetPosition(Gorgon.CurrentRenderTarget.Width - (4*MaxDataPoints) - 100,
|
||||
Gorgon.CurrentRenderTarget.Height - 60);
|
||||
_textSprite.Position = new Vector2(CluwneLib.CurrentRenderTarget.Size.X - (4*MaxDataPoints) - 100, CluwneLib.CurrentRenderTarget.Size.Y - 60);
|
||||
_textSprite.Draw();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using SS14.Client.ClientWindow;
|
||||
using SS14.Client.Interfaces.Map;
|
||||
using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
@@ -30,12 +31,12 @@ namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
if (spriteToDraw != null)
|
||||
{
|
||||
spriteToDraw.Color = pManager.ValidPosition ? Color.ForestGreen : Color.IndianRed;
|
||||
spriteToDraw.Color = pManager.ValidPosition ? CluwneLib.SystemColorToSFML(Color.ForestGreen) : CluwneLib.SystemColorToSFML(Color.IndianRed);
|
||||
spriteToDraw.Position = new Vector2(mouseScreen.X - (spriteToDraw.Width/2f),
|
||||
mouseScreen.Y - (spriteToDraw.Height/2f));
|
||||
//Centering the sprite on the cursor.
|
||||
spriteToDraw.Draw();
|
||||
spriteToDraw.Color = Color.White;
|
||||
spriteToDraw.Color = CluwneLib.SystemColorToSFML(Color.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using SS14.Client.GameObjects;
|
||||
using SS14.Client.Interfaces.Map;
|
||||
using SS14.Shared.GO;
|
||||
using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
@@ -49,12 +50,12 @@ namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
if (spriteToDraw != null)
|
||||
{
|
||||
spriteToDraw.Color = pManager.ValidPosition ? Color.ForestGreen : Color.IndianRed;
|
||||
spriteToDraw.Color = pManager.ValidPosition ? CluwneLib.SystemColorToSFML(Color.ForestGreen) : CluwneLib.SystemColorToSFML(Color.IndianRed);
|
||||
spriteToDraw.Position = new Vector2(mouseScreen.X - (spriteToDraw.Width/2f),
|
||||
mouseScreen.Y - (spriteToDraw.Height/2f));
|
||||
//Centering the sprite on the cursor.
|
||||
spriteToDraw.Draw();
|
||||
spriteToDraw.Color = Color.White;
|
||||
spriteToDraw.Color = CluwneLib.SystemColorToSFML(Color.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using EntityManager = SS14.Client.GameObjects.EntityManager;
|
||||
using SFML.Graphics;
|
||||
using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using Color = System.Drawing.Color;
|
||||
|
||||
namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
@@ -75,14 +78,14 @@ namespace SS14.Client.Services.Placement.Modes
|
||||
|
||||
if (reply.MessageType == ComponentMessageType.CurrentSprite)
|
||||
{
|
||||
var closestSprite = (Sprite) reply.ParamsList[0]; //This is faster but kinda unsafe.
|
||||
var closestSprite = (CluwneSprite) reply.ParamsList[0]; //This is faster but kinda unsafe.
|
||||
|
||||
var closestRect =
|
||||
new RectangleF(
|
||||
closestEntity.GetComponent<TransformComponent>(ComponentFamily.Transform).Position.X -
|
||||
closestSprite.Width/2f,
|
||||
closestSprite.Size.X/2f,
|
||||
closestEntity.GetComponent<TransformComponent>(ComponentFamily.Transform).Position.Y -
|
||||
closestSprite.Height/2f, closestSprite.Width, closestSprite.Height);
|
||||
closestSprite.Size.Y/2f, closestSprite.Width, closestSprite.Height);
|
||||
|
||||
var sides = new List<Vector2>
|
||||
{
|
||||
@@ -116,12 +119,12 @@ namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
if (spriteToDraw != null)
|
||||
{
|
||||
spriteToDraw.Color = pManager.ValidPosition ? Color.ForestGreen : Color.IndianRed;
|
||||
spriteToDraw.Color = pManager.ValidPosition ? CluwneLib.SystemColorToSFML( Color.ForestGreen) : CluwneLib.SystemColorToSFML( Color.IndianRed);
|
||||
spriteToDraw.Position = new Vector2(mouseScreen.X - (spriteToDraw.Width/2f),
|
||||
mouseScreen.Y - (spriteToDraw.Height/2f));
|
||||
//Centering the sprite on the cursor.
|
||||
spriteToDraw.Draw();
|
||||
spriteToDraw.Color = Color.White;
|
||||
spriteToDraw.Color = CluwneLib.SystemColorToSFML(Color.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,12 +73,12 @@ namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
if (spriteToDraw != null)
|
||||
{
|
||||
spriteToDraw.Color = pManager.ValidPosition ? Color.ForestGreen : Color.IndianRed;
|
||||
spriteToDraw.Color = pManager.ValidPosition ? CluwneLib.SystemColorToSFML(Color.ForestGreen) : CluwneLib.SystemColorToSFML(Color.IndianRed);
|
||||
spriteToDraw.Position = new Vector2(mouseScreen.X - (spriteToDraw.Width/2f),
|
||||
mouseScreen.Y - (spriteToDraw.Height/2f));
|
||||
//Centering the sprite on the cursor.
|
||||
spriteToDraw.Draw();
|
||||
spriteToDraw.Color = Color.White;
|
||||
spriteToDraw.Color = CluwneLib.SystemColorToSFML(Color.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using SS14.Client.Interfaces.Map;
|
||||
using SS14.Client.Services.Tiles;
|
||||
using SS14.Shared.GO;
|
||||
using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
@@ -74,12 +75,12 @@ namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
if (spriteToDraw != null)
|
||||
{
|
||||
spriteToDraw.Color = pManager.ValidPosition ? Color.ForestGreen : Color.IndianRed;
|
||||
spriteToDraw.Color = pManager.ValidPosition ? CluwneLib.SystemColorToSFML(Color.ForestGreen) : CluwneLib.SystemColorToSFML(Color.IndianRed);
|
||||
spriteToDraw.Position = new Vector2(mouseScreen.X - (spriteToDraw.Width/2f),
|
||||
mouseScreen.Y - (spriteToDraw.Height/2f));
|
||||
//Centering the sprite on the cursor.
|
||||
spriteToDraw.Draw();
|
||||
spriteToDraw.Color = Color.White;
|
||||
spriteToDraw.Color = CluwneLib.SystemColorToSFML(Color.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using SS14.Client.GameObjects;
|
||||
using SS14.Client.Interfaces.Map;
|
||||
using SS14.Shared.GO;
|
||||
using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
@@ -73,12 +74,12 @@ namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
if (spriteToDraw != null)
|
||||
{
|
||||
spriteToDraw.Color = pManager.ValidPosition ? Color.ForestGreen : Color.IndianRed;
|
||||
spriteToDraw.Color = pManager.ValidPosition ? CluwneLib.SystemColorToSFML(Color.ForestGreen) : CluwneLib.SystemColorToSFML(Color.IndianRed);
|
||||
spriteToDraw.Position = new Vector2(mouseScreen.X - (spriteToDraw.Width/2f),
|
||||
mouseScreen.Y - (spriteToDraw.Height/2f));
|
||||
//Centering the sprite on the cursor.
|
||||
spriteToDraw.Draw();
|
||||
spriteToDraw.Color = Color.White;
|
||||
spriteToDraw.Color = CluwneLib.SystemColorToSFML(Color.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,12 +74,12 @@ namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
if (spriteToDraw != null)
|
||||
{
|
||||
spriteToDraw.Color = pManager.ValidPosition ? Color.ForestGreen : Color.IndianRed;
|
||||
spriteToDraw.Color = pManager.ValidPosition ? CluwneLib.SystemColorToSFML(Color.ForestGreen) : CluwneLib.SystemColorToSFML(Color.IndianRed);
|
||||
spriteToDraw.Position = new Vector2(mouseScreen.X - (spriteToDraw.Width/2f),
|
||||
mouseScreen.Y - (spriteToDraw.Height/2f));
|
||||
//Centering the sprite on the cursor.
|
||||
spriteToDraw.Draw();
|
||||
spriteToDraw.Color = Color.White;
|
||||
spriteToDraw.Color = CluwneLib.SystemColorToSFML(Color.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using SS14.Shared.GO;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
@@ -84,12 +85,12 @@ namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
if (spriteToDraw != null)
|
||||
{
|
||||
spriteToDraw.Color = pManager.ValidPosition ? Color.ForestGreen : Color.IndianRed;
|
||||
spriteToDraw.Color = pManager.ValidPosition ? CluwneLib.SystemColorToSFML(Color.ForestGreen) : CluwneLib.SystemColorToSFML(Color.IndianRed);
|
||||
spriteToDraw.Position = new Vector2(mouseScreen.X - (spriteToDraw.Width/2f),
|
||||
mouseScreen.Y - (spriteToDraw.Height/2f));
|
||||
//Centering the sprite on the cursor.
|
||||
spriteToDraw.Draw();
|
||||
spriteToDraw.Color = Color.White;
|
||||
spriteToDraw.Color = CluwneLib.SystemColorToSFML(Color.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,12 +75,12 @@ namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
if (spriteToDraw != null)
|
||||
{
|
||||
spriteToDraw.Color = pManager.ValidPosition ? Color.ForestGreen : Color.IndianRed;
|
||||
spriteToDraw.Color = pManager.ValidPosition ? CluwneLib.SystemColorToSFML(Color.ForestGreen) : CluwneLib.SystemColorToSFML( Color.IndianRed);
|
||||
spriteToDraw.Position = new Vector2(mouseScreen.X,
|
||||
mouseScreen.Y);
|
||||
//Centering the sprite on the cursor.
|
||||
spriteToDraw.Draw();
|
||||
spriteToDraw.Color = Color.White;
|
||||
spriteToDraw.Color = CluwneLib.SystemColorToSFML(Color.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,12 +114,12 @@ namespace SS14.Client.Services.Placement.Modes
|
||||
{
|
||||
if (spriteToDraw != null)
|
||||
{
|
||||
spriteToDraw.Color = pManager.ValidPosition ? Color.ForestGreen : Color.IndianRed;
|
||||
spriteToDraw.Color = pManager.ValidPosition ? CluwneLib.SystemColorToSFML(Color.ForestGreen) : CluwneLib.SystemColorToSFML(Color.IndianRed);
|
||||
spriteToDraw.Position = new Vector2(mouseScreen.X - (spriteToDraw.Width/2f),
|
||||
mouseScreen.Y - (spriteToDraw.Height/2f));
|
||||
//Centering the sprite on the cursor.
|
||||
spriteToDraw.Draw();
|
||||
spriteToDraw.Color = Color.White;
|
||||
spriteToDraw.Color = CluwneLib.SystemColorToSFML( Color.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.Placement
|
||||
{
|
||||
@@ -177,7 +178,7 @@ namespace SS14.Client.Services.Placement
|
||||
|
||||
if (CurrentPermission != null && CurrentPermission.Range > 0)
|
||||
{
|
||||
Gorgon.CurrentRenderTarget.Circle(
|
||||
CluwneLib.drawCircle(
|
||||
PlayerManager.ControlledEntity.GetComponent<TransformComponent>(ComponentFamily.Transform).Position.
|
||||
X - ClientWindowData.Singleton.ScreenOrigin.X,
|
||||
PlayerManager.ControlledEntity.GetComponent<TransformComponent>(ComponentFamily.Transform).Position.
|
||||
|
||||
@@ -174,11 +174,11 @@ namespace SS14.Client.Services.Player
|
||||
e.OnExpired += EffectExpired;
|
||||
_effects.Add(e);
|
||||
break;
|
||||
case PostProcessingEffectType.Acid:
|
||||
e = new AcidPostProcessingEffect(duration);
|
||||
e.OnExpired += EffectExpired;
|
||||
_effects.Add(e);
|
||||
break;
|
||||
//case PostProcessingEffectType.Acid:
|
||||
// e = new AcidPostProcessingEffect(duration);
|
||||
// e.OnExpired += EffectExpired;
|
||||
// _effects.Add(e);
|
||||
// break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace SS14.Client.Services.Player.PostProcessing
|
||||
else
|
||||
_gaussianBlur.SetRadius(7);
|
||||
|
||||
_gaussianBlur.SetSize(new SizeF(image.Width, image.Height));
|
||||
_gaussianBlur.SetSize(new SizeF(image.Height, image.Height));
|
||||
_gaussianBlur.SetAmount(Math.Min(_duration/2, 3f));
|
||||
_gaussianBlur.PerformGaussianBlur(image);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ using SS14.Client.Interfaces.Resource;
|
||||
using SS14.Shared.IoC;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
|
||||
namespace SS14.Client.Services.Player.PostProcessing
|
||||
{
|
||||
@@ -11,26 +13,26 @@ namespace SS14.Client.Services.Player.PostProcessing
|
||||
{
|
||||
private readonly FXShader _shader;
|
||||
|
||||
public DeathPostProcessingEffect(float duration)
|
||||
: base(duration)
|
||||
public DeathPostProcessingEffect(float duration): base(duration)
|
||||
{
|
||||
_shader = IoCManager.Resolve<IResourceManager>().GetShader("deathshader");
|
||||
}
|
||||
|
||||
public override void ProcessImage(RenderImage image)
|
||||
{
|
||||
var OstafLikesTheCock = new RenderImage("OstafLikesTheCock", image.Width, image.Height,
|
||||
ImageBufferFormats.BufferRGB888A8);
|
||||
Gorgon.CurrentRenderTarget = OstafLikesTheCock;
|
||||
image.Image.Blit(0, 0, image.Width, image.Height, Color.White, BlitterSizeMode.Crop);
|
||||
Gorgon.CurrentRenderTarget = image;
|
||||
Gorgon.CurrentShader = _shader.Techniques["DeathShader"];
|
||||
_shader.Parameters["SceneTexture"].SetValue(OstafLikesTheCock);
|
||||
_shader.Parameters["duration"].SetValue(Math.Abs(_duration));
|
||||
OstafLikesTheCock.Image.Blit(0, 0, image.Width, image.Height, Color.White, BlitterSizeMode.Crop);
|
||||
var OstafLikesTheCock = new RenderImage(image.Height, image.Height);
|
||||
|
||||
Gorgon.CurrentRenderTarget = null;
|
||||
Gorgon.CurrentShader = null;
|
||||
CluwneLib.CurrentRenderTarget = OstafLikesTheCock;
|
||||
|
||||
image.Blit(0, 0, image.Height, image.Height, Color.White, BlitterSizeMode.Crop);
|
||||
CluwneLib.CurrentRenderTarget = image;
|
||||
CluwneLib.CurrentShader = _shader;
|
||||
_shader.SetParameter("SceneTexture", OstafLikesTheCock);
|
||||
_shader.setDuration((Math.Abs(_duration)));
|
||||
OstafLikesTheCock.Blit(0, 0, image.Height, image.Height, Color.White, BlitterSizeMode.Crop);
|
||||
|
||||
CluwneLib.CurrentRenderTarget = null;
|
||||
CluwneLib.CurrentShader = null;
|
||||
OstafLikesTheCock.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
using SS14.Client.Interfaces.Resource;
|
||||
using SS14.Client.Interfaces.Utility;
|
||||
using SFML.Graphics;
|
||||
using SS14.Shared.Maths;
|
||||
using SS14.Shared;
|
||||
using SS14.Shared.IoC;
|
||||
using SS14.Shared.Utility;
|
||||
using SS14.Client.Graphics.CluwneLib.Render;
|
||||
|
||||
namespace SS14.Client.Services.Player.PostProcessing
|
||||
{
|
||||
public class AcidPostProcessingEffect : PostProcessingEffect
|
||||
{
|
||||
private readonly Shader _shader;
|
||||
private readonly RenderImage copyImage;
|
||||
private Image _noiseBase;
|
||||
private SFML.Window.Window Window;
|
||||
|
||||
|
||||
|
||||
public AcidPostProcessingEffect(float duration)
|
||||
: base(duration)
|
||||
{
|
||||
|
||||
|
||||
_shader = IoCManager.Resolve<IResourceManager>().GetShader("acid2");
|
||||
copyImage = new RenderImage( Window.Size.X , Window.Size.Y);
|
||||
}
|
||||
|
||||
public override void ProcessImage(RenderImage image)
|
||||
{
|
||||
if (_noiseBase == null)
|
||||
GenerateNoise(32);
|
||||
|
||||
var shadowColor = new Vector4(1, 0, 0, 1);
|
||||
var midtoneColor = new Vector4(0, 0, 1, 1);
|
||||
var highlightColor = new Vector4(0, 1, 0, 1);
|
||||
|
||||
Gorgon.CurrentRenderTarget = copyImage;
|
||||
Gorgon.CurrentShader = _shader;
|
||||
|
||||
_shader.setParameter();
|
||||
_shader.setParameter["xOvercast"].SetValue(1.0f);
|
||||
_shader.setParameter["NoiseTexture"].SetValue(_noiseBase);
|
||||
_shader.setParameter["SceneTexture"].SetValue(image);
|
||||
//_shader.Parameters["shadowColor"].SetValue(shadowColor);
|
||||
//_shader.Parameters["midtoneColor"].SetValue(midtoneColor);
|
||||
//_shader.Parameters["highlightColor"].SetValue(highlightColor);
|
||||
|
||||
_noiseBase.Blit(0, 0,copyImage.Size.X, copyImage.Size.y);
|
||||
Gorgon.CurrentShader = null;
|
||||
Gorgon.CurrentRenderTarget = null;
|
||||
|
||||
|
||||
|
||||
|
||||
CopyFromImage(copyImage.Image);
|
||||
}
|
||||
|
||||
private void GenerateNoise(int resolution)
|
||||
{
|
||||
if (_noiseBase != null)
|
||||
{
|
||||
_noiseBase.Dispose();
|
||||
_noiseBase = null;
|
||||
}
|
||||
var rand = IoCManager.Resolve<IRand>();
|
||||
var noisyColors = new byte[resolution*resolution*4];
|
||||
byte b;
|
||||
for (int x = 0; x < resolution; x++)
|
||||
for (int y = 0; y < resolution; y++)
|
||||
{
|
||||
//noisyColors[x + y * resolution] = new Color(new Vector3((float)rand.Next(1000) / 1000.0f, 0, 0));
|
||||
b = (byte) rand.Next(255);
|
||||
noisyColors[x*4 + y*resolution*4] = b;
|
||||
noisyColors[x*4 + y*resolution*4 + 1] = b;
|
||||
noisyColors[x*4 + y*resolution*4 + 2] = b;
|
||||
noisyColors[x*4 + y*resolution*4 + 3] = 255;
|
||||
}
|
||||
|
||||
//_noiseBase = GorgonLibrary.Graphics.Image.FromStream("perlinnoisebase" + RandomString.Generate(6), new MemoryStream(noisyColors),resolution*resolution, ImageBufferFormats.BufferRGB888A8);
|
||||
//_noiseBase = GorgonLibrary.Graphics.Image.FromStream("perlinnoisebase" + RandomString.Generate(6), new MemoryStream(noisyColors), resolution*resolution*4, resolution,resolution,ImageBufferFormats.BufferRGB888A8 );
|
||||
_noiseBase = new Image("perlinnoisebase" + RandomString.Generate(6), resolution,
|
||||
resolution, ImageBufferFormats.BufferRGB888A8, true);
|
||||
Image.ImageLockBox imagelock =
|
||||
_noiseBase.GetImageData();
|
||||
|
||||
imagelock.Lock(true);
|
||||
imagelock.Write(noisyColors);
|
||||
imagelock.Unlock();
|
||||
imagelock.Dispose();
|
||||
//noiseImage.SetData(noisyColors);
|
||||
//return noiseImage;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ using SS14.Client.Graphics.CluwneLib.Shader;
|
||||
using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using Image = SFML.Graphics.Image;
|
||||
using Font = SFML.Graphics.Font;
|
||||
using Color = SFML.Graphics.Color;
|
||||
using SFML.Graphics;
|
||||
|
||||
namespace SS14.Client.Services.Resources
|
||||
@@ -53,13 +54,13 @@ namespace SS14.Client.Services.Resources
|
||||
|
||||
_stream = _assembly.GetManifestResourceStream("SS14.Client.Services._EmbeddedBaseResources.bluehigh.ttf");
|
||||
if (_stream != null)
|
||||
_fonts.Add("base_font", Font.FromStream("base_font", _stream, (int)_stream.Length, 10));
|
||||
_fonts.Add("base_font", new Font( _stream));
|
||||
_stream = null;
|
||||
|
||||
_stream = _assembly.GetManifestResourceStream("SS14.Client.Services._EmbeddedBaseResources.noSprite.png");
|
||||
if (_stream != null)
|
||||
{
|
||||
Image nospriteimage = Image.FromStream("nospriteimage", _stream, (int) _stream.Length);
|
||||
Image nospriteimage = new Image( _stream);
|
||||
_images.Add("nosprite", nospriteimage);
|
||||
_sprites.Add("nosprite", new CluwneSprite("nosprite", nospriteimage));
|
||||
}
|
||||
@@ -123,12 +124,12 @@ namespace SS14.Client.Services.Resources
|
||||
{
|
||||
Image loadedImg = LoadImageFrom(zipFile, texture);
|
||||
if (loadedImg == null) continue;
|
||||
else _images.Add(loadedImg.Name, loadedImg);
|
||||
else _images.Add(texture.Name, loadedImg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case("tai/"):
|
||||
case("tai/"): // Tai?
|
||||
foreach (ZipEntry tai in current.Value)
|
||||
{
|
||||
if (Path.GetExtension(tai.Name).ToLowerInvariant() == ".tai")
|
||||
@@ -147,7 +148,7 @@ namespace SS14.Client.Services.Resources
|
||||
{
|
||||
Font loadedFont = LoadFontFrom(zipFile, font);
|
||||
if (loadedFont == null) continue;
|
||||
else _fonts.Add(loadedFont.Name, loadedFont);
|
||||
else _fonts.Add(font.Name, loadedFont);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -171,7 +172,7 @@ namespace SS14.Client.Services.Resources
|
||||
{
|
||||
FXShader loadedShader = LoadShaderFrom(zipFile, shader);
|
||||
if (loadedShader == null) continue;
|
||||
else _shaders.Add(loadedShader.Name, loadedShader);
|
||||
else _shaders.Add(shader.Name, loadedShader);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -219,27 +220,36 @@ namespace SS14.Client.Services.Resources
|
||||
{
|
||||
string ResourceName = Path.GetFileNameWithoutExtension(imageEntry.Name).ToLowerInvariant();
|
||||
|
||||
if (ImageCache.Images.Contains(ResourceName))
|
||||
return null;
|
||||
|
||||
var byteBuffer = new byte[zipBufferSize];
|
||||
|
||||
Stream zipStream = zipFile.GetInputStream(imageEntry);
|
||||
//Will throw exception is missing or wrong password. Handle this.
|
||||
try
|
||||
{
|
||||
Stream zipStream = zipFile.GetInputStream(imageEntry);
|
||||
var memStream = new MemoryStream();
|
||||
|
||||
var memStream = new MemoryStream();
|
||||
StreamUtils.Copy(zipStream, memStream, byteBuffer);
|
||||
memStream.Position = 0;
|
||||
|
||||
StreamUtils.Copy(zipStream, memStream, byteBuffer);
|
||||
memStream.Position = 0;
|
||||
Image loadedImg = new Image(memStream);
|
||||
|
||||
Image loadedImg = Image.FromStream(ResourceName, memStream, (int) memStream.Length);
|
||||
memStream.Close();
|
||||
zipStream.Close();
|
||||
memStream.Dispose();
|
||||
zipStream.Dispose();
|
||||
return loadedImg;
|
||||
|
||||
memStream.Close();
|
||||
zipStream.Close();
|
||||
memStream.Dispose();
|
||||
zipStream.Dispose();
|
||||
}
|
||||
catch(EndOfStreamException I)
|
||||
{
|
||||
|
||||
return loadedImg;
|
||||
}
|
||||
catch (IOException I)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -249,8 +259,7 @@ namespace SS14.Client.Services.Resources
|
||||
{
|
||||
string ResourceName = Path.GetFileNameWithoutExtension(shaderEntry.Name).ToLowerInvariant();
|
||||
|
||||
if (ShaderCache.Shaders.Contains(ResourceName))
|
||||
return null;
|
||||
|
||||
|
||||
var byteBuffer = new byte[zipBufferSize];
|
||||
|
||||
@@ -262,8 +271,8 @@ namespace SS14.Client.Services.Resources
|
||||
StreamUtils.Copy(zipStream, memStream, byteBuffer);
|
||||
memStream.Position = 0;
|
||||
|
||||
FXShader loadedShader = FXShader.FromStream(ResourceName, memStream, ShaderCompileOptions.Debug,
|
||||
(int) memStream.Length, false);
|
||||
FXShader loadedShader = new FXShader(ResourceName,ResourceName);
|
||||
loadedShader.memStream = memStream;
|
||||
|
||||
memStream.Close();
|
||||
zipStream.Close();
|
||||
@@ -280,8 +289,7 @@ namespace SS14.Client.Services.Resources
|
||||
{
|
||||
string ResourceName = Path.GetFileNameWithoutExtension(fontEntry.Name).ToLowerInvariant();
|
||||
|
||||
if (FontCache.Fonts.Contains(ResourceName))
|
||||
return null;
|
||||
|
||||
|
||||
var byteBuffer = new byte[zipBufferSize];
|
||||
|
||||
@@ -293,10 +301,8 @@ namespace SS14.Client.Services.Resources
|
||||
StreamUtils.Copy(zipStream, memStream, byteBuffer);
|
||||
memStream.Position = 0;
|
||||
|
||||
Font loadedFont = Font.FromStream(ResourceName, memStream, (int) memStream.Length, 9, false);
|
||||
Font loadedFont = new Font(memStream);
|
||||
|
||||
loadedFont.AntiAlias = true;
|
||||
loadedFont.Refresh();
|
||||
|
||||
memStream.Close();
|
||||
zipStream.Close();
|
||||
@@ -402,10 +408,10 @@ namespace SS14.Client.Services.Resources
|
||||
|
||||
string imageName = splitResourceName[0].ToLowerInvariant();
|
||||
|
||||
if (!ImageCache.Images.Contains(splitResourceName[0]))
|
||||
continue; //Image for this sprite does not exist. Possibly set to defered later.
|
||||
// if (!ImageCache.Images.Contains(splitResourceName[0]))
|
||||
// continue; //Image for this sprite does not exist. Possibly set to defered later.
|
||||
|
||||
Image atlasTex = ImageCache.Images[splitResourceName[0]];
|
||||
// Image atlasTex = ImageCache.Images[splitResourceName[0]];
|
||||
//Grab the image for the sprite from the cache.
|
||||
|
||||
var info = new SpriteInfo();
|
||||
@@ -431,14 +437,15 @@ namespace SS14.Client.Services.Resources
|
||||
sizeY = float.Parse(splitLine[7], CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
info.Offsets = new Vector2((float) Math.Round(offsetX*atlasTex.Width, 1),
|
||||
(float) Math.Round(offsetY*atlasTex.Height, 1));
|
||||
info.Size = new Vector2((float) Math.Round(sizeX*atlasTex.Width, 1),
|
||||
(float) Math.Round(sizeY*atlasTex.Height, 1));
|
||||
// info.Offsets = new Vector2((float) Math.Round(offsetX*atlasTex.Width, 1),
|
||||
// (float) Math.Round(offsetY*atlasTex.Height, 1));
|
||||
// info.Size = new Vector2((float) Math.Round(sizeX*atlasTex.Width, 1),
|
||||
// (float) Math.Round(sizeY*atlasTex.Height, 1));
|
||||
|
||||
if (!_spriteInfos.ContainsKey(originalName)) _spriteInfos.Add(originalName, info);
|
||||
// if (!_spriteInfos.ContainsKey(originalName)) _spriteInfos.Add(originalName, info);
|
||||
|
||||
loadedSprites.Add(new CluwneSprite(originalName, atlasTex, info.Offsets, info.Size));
|
||||
// loadedSprites.Add(new CluwneSprite(originalName, atlasTex, info.Offsets, info.Size));
|
||||
//
|
||||
}
|
||||
|
||||
return loadedSprites;
|
||||
|
||||
@@ -359,11 +359,12 @@ namespace SS14.Client.Services.State.States
|
||||
{
|
||||
IoCManager.Resolve<IPlayerManager>().Detach();
|
||||
|
||||
_cleanupSpriteList.ForEach(s => s.Image = null);
|
||||
/*
|
||||
_cleanupSpriteList.ForEach(s => s.Image = null);
|
||||
_cleanupSpriteList.Clear();
|
||||
_cleanupList.ForEach(t => {t.ForceRelease();t.Dispose();});
|
||||
_cleanupList.Clear();
|
||||
|
||||
*/
|
||||
// TODO: See Startup() for SFML todos
|
||||
//shadowMapResolver.Dispose();
|
||||
_gaussianBlur.Dispose();
|
||||
@@ -716,63 +717,63 @@ namespace SS14.Client.Services.State.States
|
||||
return;
|
||||
|
||||
//TODO Fix this
|
||||
if (e.ToString().Equals("F1"))
|
||||
if (e.Code == Keyboard.Key.F1)
|
||||
{
|
||||
//TODO FrameStats
|
||||
//CluwneLib.FrameStatsVisible = !CluwneLib.FrameStatsVisible;
|
||||
}
|
||||
if (e.ToString().Equals("F2"))
|
||||
if (e.Code == Keyboard.Key.F2)
|
||||
{
|
||||
_showDebug = !_showDebug;
|
||||
}
|
||||
if (e.ToString().Equals("F3"))
|
||||
if (e.Code == Keyboard.Key.F3)
|
||||
{
|
||||
ToggleOccluderDebug();
|
||||
}
|
||||
if (e.ToString().Equals("F4"))
|
||||
if (e.Code == Keyboard.Key.F4)
|
||||
{
|
||||
// debugHitboxes = !debugHitboxes;
|
||||
// debugHitboxes = !debugHitboxes;
|
||||
}
|
||||
if (e.ToString().Equals("F5"))
|
||||
if (e.Code == Keyboard.Key.F5)
|
||||
{
|
||||
PlayerManager.SendVerb("save", 0);
|
||||
}
|
||||
if (e.ToString().Equals("F6"))
|
||||
if (e.Code == Keyboard.Key.F6)
|
||||
{
|
||||
// bFullVision = !bFullVision;
|
||||
}
|
||||
if (e.ToString().Equals("F7"))
|
||||
if (e.Code == Keyboard.Key.F7)
|
||||
{
|
||||
//bPlayerVision = !bPlayerVision;
|
||||
}
|
||||
if (e.ToString().Equals("F8"))
|
||||
if (e.Code == Keyboard.Key.F8)
|
||||
{
|
||||
NetOutgoingMessage message = NetworkManager.CreateMessage();
|
||||
message.Write((byte) NetMessage.ForceRestart);
|
||||
NetworkManager.SendMessage(message, NetDeliveryMethod.ReliableUnordered);
|
||||
}
|
||||
if (e.ToString().Equals("Escape")
|
||||
if (e.Code == Keyboard.Key.Escape)
|
||||
{
|
||||
UserInterfaceManager.DisposeAllComponents<MenuWindow>(); //Remove old ones.
|
||||
UserInterfaceManager.AddComponent(new MenuWindow()); //Create a new one.
|
||||
}
|
||||
if (e.ToString().Equals("F9"))
|
||||
if (e.Code == Keyboard.Key.F9)
|
||||
{
|
||||
UserInterfaceManager.ToggleMoveMode();
|
||||
}
|
||||
if (e.ToString().Equals("F10"))
|
||||
if (e.Code == Keyboard.Key.F10)
|
||||
{
|
||||
UserInterfaceManager.DisposeAllComponents<TileSpawnPanel>(); //Remove old ones.
|
||||
UserInterfaceManager.AddComponent(new TileSpawnPanel(new Size(350, 410), ResourceManager,
|
||||
PlacementManager)); //Create a new one.
|
||||
}
|
||||
if (e.ToString().Equals("F11"))
|
||||
if (e.Code == Keyboard.Key.F11)
|
||||
{
|
||||
UserInterfaceManager.DisposeAllComponents<EntitySpawnPanel>(); //Remove old ones.
|
||||
UserInterfaceManager.AddComponent(new EntitySpawnPanel(new Size(350, 410), ResourceManager,
|
||||
PlacementManager)); //Create a new one.
|
||||
}
|
||||
if (e.ToString().Equals("F12"))
|
||||
if (e.Code == Keyboard.Key.F12)
|
||||
{
|
||||
UserInterfaceManager.DisposeAllComponents<PlayerActionsWindow>(); //Remove old ones.
|
||||
var actComp =
|
||||
@@ -782,12 +783,12 @@ namespace SS14.Client.Services.State.States
|
||||
actComp)); //Create a new one.
|
||||
}
|
||||
|
||||
PlayerManager.KeyDown(e.Key);
|
||||
PlayerManager.KeyDown(e.Code);
|
||||
}
|
||||
|
||||
public void KeyUp(KeyEventArgs e)
|
||||
{
|
||||
PlayerManager.KeyUp(e.Key);
|
||||
PlayerManager.KeyUp(e.Code);
|
||||
}
|
||||
|
||||
public void MouseUp(MouseButtonEventArgs e)
|
||||
@@ -806,15 +807,15 @@ namespace SS14.Client.Services.State.States
|
||||
|
||||
if (PlacementManager.IsActive && !PlacementManager.Eraser)
|
||||
{
|
||||
switch (e.Buttons)
|
||||
switch (e.Button)
|
||||
{
|
||||
case MouseButtons.Left:
|
||||
case Mouse.Button.Left:
|
||||
PlacementManager.HandlePlacement();
|
||||
return;
|
||||
case MouseButtons.Right:
|
||||
case Mouse.Button.Right:
|
||||
PlacementManager.Clear();
|
||||
return;
|
||||
case MouseButtons.Middle:
|
||||
case Mouse.Button.Middle:
|
||||
PlacementManager.Rotate();
|
||||
return;
|
||||
}
|
||||
@@ -868,9 +869,9 @@ namespace SS14.Client.Services.State.States
|
||||
return;
|
||||
}
|
||||
|
||||
switch (e.Buttons)
|
||||
switch (e.Button)
|
||||
{
|
||||
case MouseButtons.Left:
|
||||
case Mouse.Button.Left:
|
||||
if (UserInterfaceManager.currentTargetingAction != null &&
|
||||
(UserInterfaceManager.currentTargetingAction.TargetType == PlayerActionTargetType.Any ||
|
||||
UserInterfaceManager.currentTargetingAction.TargetType == PlayerActionTargetType.Other))
|
||||
@@ -881,7 +882,7 @@ namespace SS14.Client.Services.State.States
|
||||
c.DispatchClick(PlayerManager.ControlledEntity.Uid, MouseClickType.Left);
|
||||
}
|
||||
break;
|
||||
case MouseButtons.Right:
|
||||
case Mouse.Button.Right:
|
||||
if (UserInterfaceManager.currentTargetingAction != null)
|
||||
UserInterfaceManager.CancelTargeting();
|
||||
else
|
||||
@@ -890,7 +891,7 @@ namespace SS14.Client.Services.State.States
|
||||
c.DispatchClick(PlayerManager.ControlledEntity.Uid, MouseClickType.Right);
|
||||
}
|
||||
break;
|
||||
case MouseButtons.Middle:
|
||||
case Mouse.Button.Middle:
|
||||
UserInterfaceManager.DisposeAllComponents<PropEditWindow>();
|
||||
UserInterfaceManager.AddComponent(new PropEditWindow(new Size(400, 400), ResourceManager,
|
||||
entToClick));
|
||||
@@ -899,9 +900,9 @@ namespace SS14.Client.Services.State.States
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (e.Buttons)
|
||||
switch (e.Button)
|
||||
{
|
||||
case MouseButtons.Left:
|
||||
case Mouse.Button.Left:
|
||||
{
|
||||
if (UserInterfaceManager.currentTargetingAction != null &&
|
||||
UserInterfaceManager.currentTargetingAction.TargetType == PlayerActionTargetType.Point)
|
||||
@@ -923,7 +924,7 @@ namespace SS14.Client.Services.State.States
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MouseButtons.Right:
|
||||
case Mouse.Button.Right:
|
||||
{
|
||||
if (UserInterfaceManager.currentTargetingAction != null)
|
||||
UserInterfaceManager.CancelTargeting();
|
||||
@@ -937,9 +938,9 @@ namespace SS14.Client.Services.State.States
|
||||
|
||||
public void MouseMove(MouseMoveEventArgs e)
|
||||
{
|
||||
float distanceToPrev = (MousePosScreen - new Vector2(e.Position.X, e.Position.Y)).Length;
|
||||
MousePosScreen = new Vector2(e.Position.X, e.Position.Y);
|
||||
MousePosWorld = new Vector2(e.Position.X + WindowOrigin.X, e.Position.Y + WindowOrigin.Y);
|
||||
float distanceToPrev = (MousePosScreen - new Vector2(e.X, e.Y)).Length;
|
||||
MousePosScreen = new Vector2(e.X, e.Y);
|
||||
MousePosWorld = new Vector2(e.X + WindowOrigin.X, e.Y + WindowOrigin.Y);
|
||||
UserInterfaceManager.MouseMove(e);
|
||||
}
|
||||
|
||||
@@ -1492,22 +1493,23 @@ namespace SS14.Client.Services.State.States
|
||||
}
|
||||
}
|
||||
|
||||
private LightArea GetLightArea(ShadowmapSize size)
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
case ShadowmapSize.Size128:
|
||||
return lightArea128;
|
||||
case ShadowmapSize.Size256:
|
||||
return lightArea256;
|
||||
case ShadowmapSize.Size512:
|
||||
return lightArea512;
|
||||
case ShadowmapSize.Size1024:
|
||||
return lightArea1024;
|
||||
default:
|
||||
return lightArea1024;
|
||||
}
|
||||
}
|
||||
// private LightArea GetLightArea(ShadowmapSize size)
|
||||
//{
|
||||
//switch (size)
|
||||
//{
|
||||
// case ShadowmapSize.Size128:
|
||||
// return lightArea128;
|
||||
// case ShadowmapSize.Size256:
|
||||
// return lightArea256;
|
||||
// case ShadowmapSize.Size512:
|
||||
// return lightArea512;
|
||||
// case ShadowmapSize.Size1024:
|
||||
// return lightArea1024;
|
||||
// default:
|
||||
// return lightArea1024;
|
||||
//}
|
||||
|
||||
// }
|
||||
|
||||
// Draws all walls in the area around the light relative to it, and in black (test code, not pretty)
|
||||
private void DrawWallsRelativeToLight(ILightArea area)
|
||||
|
||||
@@ -13,6 +13,8 @@ using System.Linq;
|
||||
using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib.Event;
|
||||
using SS14.Shared.Maths;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.State.States
|
||||
{
|
||||
@@ -176,7 +178,7 @@ namespace SS14.Client.Services.State.States
|
||||
{
|
||||
ImageNormal = "lobby_ready",
|
||||
ImageHover = "lobby_ready_green",
|
||||
BlendingMode = BlendingModes.None,
|
||||
//BlendingMode = BlendingModes.None,
|
||||
ZDepth = 1
|
||||
};
|
||||
_btnReady.Clicked += _btnReady_Clicked;
|
||||
|
||||
@@ -11,6 +11,9 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
using SFML.Graphics;
|
||||
using SFML.System;
|
||||
using Color = System.Drawing.Color;
|
||||
|
||||
namespace SS14.Client.Services.State.States
|
||||
{
|
||||
@@ -54,7 +57,7 @@ namespace SS14.Client.Services.State.States
|
||||
_lobbyText = new TextSprite("lobbyText", "", ResourceManager.GetFont("CALIBRI"))
|
||||
{
|
||||
Color = Color.Black,
|
||||
ShadowColor = Color.DimGray,
|
||||
ShadowColor = Color.Transparent,
|
||||
Shadowed = true,
|
||||
//TODO CluwneSprite ShadowOffset
|
||||
// ShadowOffset = new Vector2(1, 1)
|
||||
@@ -76,7 +79,7 @@ namespace SS14.Client.Services.State.States
|
||||
jobListMsg.Write((byte) NetMessage.JobList); //Request Joblist.
|
||||
NetworkManager.SendMessage(jobListMsg, NetDeliveryMethod.ReliableOrdered);
|
||||
|
||||
var joinButton = new Button("Join Game", ResourceManager) {mouseOverColor = Color.LightSteelBlue};
|
||||
var joinButton = new Button("Join Game", ResourceManager) {mouseOverColor = System.Drawing.Color.LightSteelBlue};
|
||||
joinButton.Position = new Point(605 - joinButton.ClientArea.Width - 5,
|
||||
200 - joinButton.ClientArea.Height - 5);
|
||||
joinButton.Clicked += JoinButtonClicked;
|
||||
@@ -95,12 +98,17 @@ namespace SS14.Client.Services.State.States
|
||||
|
||||
public void Render(FrameEventArgs e)
|
||||
{
|
||||
CluwneLib.CurrentRenderTarget.Clear();
|
||||
CluwneLib.CurrentRenderTarget.FilledRectangle(5 , 5 , 600 , 200 , Color.SlateGray);
|
||||
CluwneLib.CurrentRenderTarget.FilledRectangle(625 , 5 , CluwneLib.CurrentRenderTarget.Width - 625 - 5 ,
|
||||
CluwneLib.CurrentRenderTarget.Height - 5 - 6, Color.SlateGray);
|
||||
//public Vertex(Vector2f position, Color color, Vector2f texCoords);
|
||||
RectangleShape test = new RectangleShape(new Vector2f(200, 200));
|
||||
|
||||
CluwneLib.CurrentRenderTarget.FilledRectangle(5, 220, 600, _lobbyChat.Position.Y - 250 - 5, Color.SlateGray);
|
||||
|
||||
TextSprite test2 = new TextSprite("this",1,1,1,1);
|
||||
|
||||
CluwneLib.CurrentRenderTarget.Clear();
|
||||
CluwneLib.CurrentRenderTarget.Draw(test);
|
||||
// CluwneLib.CurrentRenderTarget.Draw(625 , 5 , CluwneLib.CurrentRenderTarget.Size.X - 625 - 5 , CluwneLib.CurrentRenderTarget.Size.Y- 5 - 6, Color.SlateGray);
|
||||
|
||||
// CluwneLib.CurrentRenderTarget.FilledRectangle(5, 220, 600, _lobbyChat.Position.Y - 250 - 5, Color.SlateGray);
|
||||
|
||||
_lobbyText.Position = new Vector2(10, 10);
|
||||
_lobbyText.Text = "Server: " + _serverName;
|
||||
|
||||
@@ -11,6 +11,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Reflection;
|
||||
using Color = System.Drawing.Color;
|
||||
|
||||
namespace SS14.Client.Services.State.States
|
||||
{
|
||||
@@ -72,7 +73,7 @@ namespace SS14.Client.Services.State.States
|
||||
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
|
||||
_lblVersion = new Label("v. " + fvi.FileVersion, "CALIBRI", ResourceManager);
|
||||
_lblVersion.Text.Color = Color.WhiteSmoke;
|
||||
_lblVersion.Text.Color = Color.WhiteSmoke;// white smoke
|
||||
_lblVersion.Position = new Point((int)VideoMode.DesktopMode.Width - _lblVersion.ClientArea.Width - 3 ,
|
||||
(int)VideoMode.DesktopMode.Height - _lblVersion.ClientArea.Height - 3);
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ using SS14.Client.Services.UserInterface.Components;
|
||||
using SS14.Client.Graphics.CluwneLib.Event;
|
||||
using KeyEventArgs = SFML.Window.KeyEventArgs;
|
||||
using Label = SS14.Client.Services.UserInterface.Components.Label;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
|
||||
|
||||
|
||||
namespace SS14.Client.Services.State.States
|
||||
@@ -214,14 +217,14 @@ namespace SS14.Client.Services.State.States
|
||||
|
||||
private void ApplyVideoMode()
|
||||
{
|
||||
Form owner = Gorgon.Screen.OwnerForm;
|
||||
Gorgon.Stop();
|
||||
Form owner = CluwneLib.Screen.OwnerForm;
|
||||
CluwneLib.Stop();
|
||||
|
||||
Gorgon.SetMode(owner, (int) ConfigurationManager.GetDisplayWidth(),
|
||||
(int) ConfigurationManager.GetDisplayHeight(), BackBufferFormats.BufferRGB888,
|
||||
!ConfigurationManager.GetFullscreen(), false, false,
|
||||
(int) ConfigurationManager.GetDisplayRefresh(),
|
||||
(ConfigurationManager.GetVsync() ? VSyncIntervals.IntervalOne : VSyncIntervals.IntervalNone));
|
||||
CluwneLib.SetMode(owner, (int)ConfigurationManager.GetDisplayWidth(),
|
||||
(int)ConfigurationManager.GetDisplayHeight(),
|
||||
!ConfigurationManager.GetFullscreen(), false, false,
|
||||
(int)ConfigurationManager.GetDisplayRefresh());
|
||||
|
||||
|
||||
if (!ConfigurationManager.GetFullscreen())
|
||||
{
|
||||
@@ -233,7 +236,7 @@ namespace SS14.Client.Services.State.States
|
||||
owner.MinimizeBox = true;
|
||||
}
|
||||
|
||||
Gorgon.Go();
|
||||
CluwneLib.Go();
|
||||
}
|
||||
|
||||
private void _reslistbox_ItemSelected(Label item, Listbox sender)
|
||||
@@ -242,13 +245,13 @@ namespace SS14.Client.Services.State.States
|
||||
{
|
||||
VideoMode sel = vmList[item.Text.Text];
|
||||
ConfigurationManager.SetResolution((uint) sel.Width, (uint) sel.Height);
|
||||
ConfigurationManager.SetDisplayRefresh((uint) sel.RefreshRate);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private string GetVmString(VideoMode vm)
|
||||
{
|
||||
return vm.Width.ToString() + "x" + vm.Height.ToString() + " @ " + vm.RefreshRate + " hz";
|
||||
return vm.Width.ToString() + "x" + vm.Height.ToString() + " @ " + vm.BitsPerPixel+ " hz";
|
||||
}
|
||||
|
||||
private void _exitbtt_Clicked(Label sender)
|
||||
|
||||
@@ -4,6 +4,7 @@ using SS14.Client.Interfaces.Resource;
|
||||
using SS14.Shared;
|
||||
using System.Drawing;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -28,8 +29,8 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
_textboxPassword.OnSubmit += textboxPassword_OnSubmit;
|
||||
components.Add(_textboxPassword);
|
||||
components.Add(_okayButton);
|
||||
Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f));
|
||||
Position = new Point((int) ( CluwneLib.CurrentRenderTarget.Size.X/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (CluwneLib.CurrentRenderTarget.Size.Y/2f) - (int) (ClientArea.Height/2f));
|
||||
}
|
||||
|
||||
private void textboxPassword_OnSubmit(string text, Textbox sender)
|
||||
|
||||
@@ -4,6 +4,7 @@ using SS14.Client.Interfaces.Resource;
|
||||
using SS14.Shared;
|
||||
using System.Drawing;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -29,8 +30,8 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
unbanButton.Clicked += UnbanButtonClicked;
|
||||
components.Add(unbanButton);
|
||||
|
||||
Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f));
|
||||
Position = new Point((int) (CluwneLib.CurrentRenderTarget.Size.X/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (CluwneLib.CurrentRenderTarget.Size.Y/2f) - (int) (ClientArea.Height/2f));
|
||||
}
|
||||
|
||||
private void UnbanButtonClicked(Button sender)
|
||||
|
||||
@@ -4,6 +4,7 @@ using SS14.Client.Interfaces.Resource;
|
||||
using SS14.Shared;
|
||||
using System.Drawing;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -25,8 +26,8 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
closeButton.Clicked += CloseButtonClicked;
|
||||
components.Add(closeButton);
|
||||
|
||||
Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f));
|
||||
Position = new Point((int) (CluwneLib.CurrentRenderTarget.Size.X/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (CluwneLib.CurrentRenderTarget.Size.Y/2f) - (int) (ClientArea.Height/2f));
|
||||
}
|
||||
|
||||
private void CloseButtonClicked(Button sender)
|
||||
|
||||
@@ -7,6 +7,7 @@ using SS14.Shared.IoC;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using SS14.Shared.Maths;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -62,7 +63,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
icon.Position = Position;
|
||||
icon.Position = new Vector2(Position.X,Position.Y);
|
||||
text.Position = new Vector2(Position.X + icon.Width + 5,
|
||||
Position.Y + (int) (icon.Height/2f) - (int) (text.Height/2f));
|
||||
ClientArea = new Rectangle(Position,
|
||||
|
||||
@@ -3,6 +3,8 @@ using System;
|
||||
using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
using SS14.Shared.Maths;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -71,7 +73,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
public override void Render()
|
||||
{
|
||||
if (_bgcol != Color.Transparent)
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width,
|
||||
CluwneLib.drawRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width,
|
||||
ClientArea.Height, _bgcol);
|
||||
_icon.Draw();
|
||||
Label.Draw();
|
||||
@@ -88,7 +90,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (Clicked != null) Clicked(this);
|
||||
return true;
|
||||
@@ -103,7 +105,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override void MouseMove(MouseMoveEventArgs e)
|
||||
{
|
||||
_bgcol = ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y))
|
||||
_bgcol = ClientArea.Contains(new Point((int) e.X, (int) e.Y))
|
||||
? Color.SteelBlue
|
||||
: Color.Transparent;
|
||||
}
|
||||
|
||||
@@ -63,17 +63,17 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override void Render()
|
||||
{
|
||||
_buttonLeft.Color = drawColor;
|
||||
_buttonMain.Color = drawColor;
|
||||
_buttonRight.Color = drawColor;
|
||||
_buttonLeft.Color = new SFML.Graphics.Color(drawColor.R, drawColor.G,drawColor.B);
|
||||
_buttonMain.Color = new SFML.Graphics.Color(drawColor.R, drawColor.G, drawColor.B);
|
||||
_buttonRight.Color = new SFML.Graphics.Color(drawColor.R, drawColor.G,drawColor.B);
|
||||
|
||||
_buttonLeft.Draw(_clientAreaLeft);
|
||||
_buttonMain.Draw(_clientAreaMain);
|
||||
_buttonRight.Draw(_clientAreaRight);
|
||||
|
||||
_buttonLeft.Color = Color.White;
|
||||
_buttonMain.Color = Color.White;
|
||||
_buttonRight.Color = Color.White;
|
||||
_buttonLeft.Color = new SFML.Graphics.Color(Color.White.R, Color.White.G, Color.White.B);
|
||||
_buttonMain.Color = new SFML.Graphics.Color(Color.White.R, Color.White.G, Color.White.B);
|
||||
_buttonRight.Color = new SFML.Graphics.Color(Color.White.R, Color.White.G, Color.White.B);
|
||||
|
||||
Label.Draw();
|
||||
}
|
||||
@@ -92,7 +92,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
public override void MouseMove(MouseMoveEventArgs e)
|
||||
{
|
||||
if (mouseOverColor != Color.White)
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
drawColor = mouseOverColor;
|
||||
else
|
||||
drawColor = Color.White;
|
||||
@@ -100,7 +100,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (Clicked != null) Clicked(this);
|
||||
return true;
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -48,7 +49,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
_userInterfaceManager = userInterfaceManager;
|
||||
_keyBindingManager = keyBindingManager;
|
||||
|
||||
Position = new Point(Gorgon.CurrentClippingViewport.Width - (int)Size.X - 10, 10);
|
||||
Position = new Point((int)CluwneLib.CurrentClippingViewport.Width - (int)Size.X - 10, 10);
|
||||
|
||||
ClientArea = new Rectangle(Position.X, Position.Y, (int) Size.X, (int) Size.Y);
|
||||
|
||||
@@ -207,7 +208,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool KeyDown(KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == KeyboardKeys.T && !Active)
|
||||
if (e.Code == Keyboard.Key.T && !Active)
|
||||
{
|
||||
_userInterfaceManager.SetFocus(this);
|
||||
Active = true;
|
||||
@@ -217,7 +218,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
if (!Active)
|
||||
return false;
|
||||
|
||||
if (e.Key == KeyboardKeys.Enter)
|
||||
if (e.Code == Keyboard.Key.Return)
|
||||
{
|
||||
if (TextSubmitted != null && !String.IsNullOrWhiteSpace(_currentInputText.ToString()))
|
||||
{
|
||||
@@ -237,7 +238,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
if (e.Key == KeyboardKeys.Up)
|
||||
if (e.Code == Keyboard.Key.Up)
|
||||
{
|
||||
if (_inputIndex == -1 && _inputHistory.Any())
|
||||
{
|
||||
@@ -259,7 +260,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
if (e.Key == KeyboardKeys.Down)
|
||||
if (e.Code == Keyboard.Key.Down)
|
||||
{
|
||||
if (_inputIndex == 0)
|
||||
{
|
||||
@@ -276,18 +277,14 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
}
|
||||
}
|
||||
|
||||
if (e.Key == KeyboardKeys.Back)
|
||||
if (e.Code == Keyboard.Key.BackSpace)
|
||||
{
|
||||
if (_currentInputText.Length > 0)
|
||||
_currentInputText.Remove(_currentInputText.Length - 1, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (char.IsLetterOrDigit(e.CharacterMapping.Character) || char.IsPunctuation(e.CharacterMapping.Character) ||
|
||||
char.IsWhiteSpace(e.CharacterMapping.Character) || char.IsSymbol(e.CharacterMapping.Character))
|
||||
{
|
||||
_currentInputText.Append(e.Shift ? e.CharacterMapping.Shifted : e.CharacterMapping.Character);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -306,7 +303,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
base.Update(frameTime);
|
||||
ClientArea = new Rectangle(Position.X, Position.Y, (int) Size.X, (int) Size.Y);
|
||||
_textInputLabel.Text.Size = new Size(ClientArea.Width - 10, 12);
|
||||
_textInputLabel.Text.Scale = new SFML.System.Vector2f (ClientArea.Width - 10, 12);
|
||||
_textInputLabel.Update(frameTime);
|
||||
foreach (Label l in _entries) l.Update(frameTime);
|
||||
}
|
||||
@@ -314,12 +311,10 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
public override void Render()
|
||||
{
|
||||
if (_disposing || !IsVisible()) return;
|
||||
Gorgon.CurrentRenderTarget.BlendingMode = BlendingModes.Modulated;
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
Color.FromArgb(100, Color.Black));
|
||||
Gorgon.CurrentRenderTarget.Rectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
Color.FromArgb(100, Color.LightGray));
|
||||
Gorgon.CurrentRenderTarget.BlendingMode = BlendingModes.None;
|
||||
CluwneLib.BlendingMode = BlendingModes.Modulated;
|
||||
CluwneLib.drawRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height, Color.FromArgb(100, Color.Black));
|
||||
CluwneLib.drawRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height, Color.FromArgb(100, Color.LightGray));
|
||||
CluwneLib.BlendingMode = BlendingModes.None;
|
||||
DrawLines();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
Value = !Value;
|
||||
return true;
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Collections.Generic;
|
||||
using SFML.Window;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -110,7 +111,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
base.Render();
|
||||
foreach (ContextMenuButton button in _buttons)
|
||||
button.Render();
|
||||
Gorgon.CurrentRenderTarget.Rectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
CluwneLib.drawRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
Color.Black);
|
||||
}
|
||||
|
||||
@@ -203,8 +204,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
var iconRect = new Rectangle(ClientArea.X + 3,
|
||||
ClientArea.Y + (int) (ClientArea.Height/2f) - (int) (_iconSprite.Height/2f),
|
||||
(int) _iconSprite.Width, (int) _iconSprite.Height);
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
_currentColor);
|
||||
CluwneLib.drawRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height, _currentColor);
|
||||
_textLabel.Render();
|
||||
_iconSprite.Draw(iconRect);
|
||||
}
|
||||
@@ -219,14 +219,14 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
if (Selected != null) Selected(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void MouseMove(MouseMoveEventArgs e)
|
||||
{
|
||||
_currentColor = ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y))
|
||||
_currentColor = ClientArea.Contains(new Point((int) e.X, (int) e.Y))
|
||||
? Color.LightGray
|
||||
: Color.Gray;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
@@ -4,6 +4,7 @@ using SS14.Client.Interfaces.UserInterface;
|
||||
using SS14.Client.Services.State.States;
|
||||
using System.Drawing;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -37,20 +38,19 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
_message.Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f - _message.ClientArea.Width/2f),
|
||||
(int) (Gorgon.CurrentRenderTarget.Height/2f - _message.ClientArea.Height/2f) -
|
||||
_message.Position = new Point((int) (CluwneLib.CurrentRenderTarget.Size.X/2f - _message.ClientArea.Width/2f),
|
||||
(int) (CluwneLib.CurrentRenderTarget.Size.Y/2f - _message.ClientArea.Height/2f) -
|
||||
50);
|
||||
_message.Update(frameTime);
|
||||
_mainMenuButton.Position =
|
||||
new Point((int) (Gorgon.CurrentRenderTarget.Width/2f - _message.ClientArea.Width/2f),
|
||||
new Point((int) (CluwneLib.CurrentRenderTarget.Size.X/2f - _message.ClientArea.Width/2f),
|
||||
_message.ClientArea.Bottom + 20);
|
||||
_mainMenuButton.Update(frameTime);
|
||||
}
|
||||
|
||||
public override void Render()
|
||||
{
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(0, 0, Gorgon.CurrentRenderTarget.Width,
|
||||
Gorgon.CurrentRenderTarget.Height, Color.Black);
|
||||
CluwneLib.drawRectangle(0, 0, (int)CluwneLib.CurrentRenderTarget.Size.X, (int)CluwneLib.CurrentRenderTarget.Size.Y, Color.Black);
|
||||
_message.Render();
|
||||
_mainMenuButton.Render();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -95,8 +96,8 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
BuildEntityList();
|
||||
|
||||
Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f));
|
||||
Position = new Point((int) (CluwneLib.CurrentRenderTarget.Size.X/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (CluwneLib.CurrentRenderTarget.Size.Y/2f) - (int) (ClientArea.Height/2f));
|
||||
_placementManager.PlacementCanceled += PlacementManagerPlacementCanceled;
|
||||
}
|
||||
|
||||
@@ -225,7 +226,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
public override void Render()
|
||||
{
|
||||
if (disposing || !IsVisible()) return;
|
||||
_eraserButton.Color = _placementManager.Eraser ? Color.Tomato : Color.White;
|
||||
_eraserButton.Color = _placementManager.Eraser ? CluwneLib.SystemColorToSFML(Color.Tomato) : CluwneLib.SystemColorToSFML(Color.White);
|
||||
base.Render();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using Font = SFML.Graphics.Font;
|
||||
using SFML.Window;
|
||||
using SS14.Shared.Maths;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -57,7 +59,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (Clicked != null) Clicked(this, associatedTemplate, associatedTemplateName);
|
||||
return true;
|
||||
@@ -87,9 +89,9 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override void Render()
|
||||
{
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
CluwneLib.drawRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
selected ? Color.ForestGreen : Color.FloralWhite);
|
||||
Gorgon.CurrentRenderTarget.Rectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
CluwneLib.drawRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
Color.Black);
|
||||
objectSprite.Draw();
|
||||
name.Draw();
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
if (reply.MessageType == ComponentMessageType.CurrentSprite)
|
||||
{
|
||||
_entitySprite = (Sprite) reply.ParamsList[0];
|
||||
_entitySprite = (CluwneSprite) reply.ParamsList[0];
|
||||
_entityDescription.Position = new Point(10,
|
||||
(int) _entitySprite.Height +
|
||||
_entityDescription.ClientArea.Height + 10);
|
||||
|
||||
@@ -6,6 +6,7 @@ using SS14.Shared.IoC;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -37,7 +38,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
_resourceManager = resourceManager;
|
||||
DrawSprite = _resourceManager.GetSprite(spriteName);
|
||||
DrawSprite.Smoothing = Smoothing.Smooth;
|
||||
//DrawSprite.Smoothing = Smoothing.Smooth;
|
||||
|
||||
_uiMgr = (UserInterfaceManager) IoCManager.Resolve<IUserInterfaceManager>();
|
||||
|
||||
@@ -57,15 +58,15 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
new Size((int) DrawSprite.Width, (int) DrawSprite.Height));
|
||||
|
||||
//Outside screen. Does not respect rotation. FIX.
|
||||
if (ClientArea.X > Gorgon.Screen.Width)
|
||||
if (ClientArea.X > CluwneLib.Screen.Size.X)
|
||||
SpriteLocation = new Vector2((0 - DrawSprite.Width), SpriteLocation.Y);
|
||||
else if (ClientArea.X < (0 - DrawSprite.Width))
|
||||
SpriteLocation = new Vector2(Gorgon.Screen.Width, SpriteLocation.Y);
|
||||
SpriteLocation = new Vector2(CluwneLib.Screen.Size.X, SpriteLocation.Y);
|
||||
|
||||
if (ClientArea.Y > Gorgon.Screen.Height)
|
||||
if (ClientArea.Y > CluwneLib.Screen.Size.Y)
|
||||
SpriteLocation = new Vector2(SpriteLocation.X, (0 - DrawSprite.Height));
|
||||
else if (ClientArea.Y < (0 - DrawSprite.Height))
|
||||
SpriteLocation = new Vector2(SpriteLocation.X, Gorgon.Screen.Height);
|
||||
SpriteLocation = new Vector2(SpriteLocation.X, CluwneLib.Screen.Size.Y);
|
||||
|
||||
if (MouseParallax)
|
||||
{
|
||||
@@ -74,13 +75,13 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
if (MouseParallaxHorizontal)
|
||||
{
|
||||
ParX = Math.Abs(_uiMgr.MousePos.X - (Gorgon.Screen.Width));
|
||||
ParX = Math.Abs(_uiMgr.MousePos.X - (CluwneLib.Screen.Size.X));
|
||||
ParX *= ParallaxScale;
|
||||
}
|
||||
|
||||
if (MouseParallaxVertical)
|
||||
{
|
||||
ParY = Math.Abs(_uiMgr.MousePos.Y - (Gorgon.Screen.Height));
|
||||
ParY = Math.Abs(_uiMgr.MousePos.Y - ((CluwneLib.Screen.Size.Y)));
|
||||
ParY *= ParallaxScale;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using SFML.Window;
|
||||
using Color = System.Drawing.Color;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -70,18 +71,18 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
if (hands.CurrentHand == Hand.Left)
|
||||
{
|
||||
handSlot.Color = Color.White;
|
||||
handSlot.Color = new SFML.Graphics.Color(Color.White.R, Color.White.G, Color.White.B, Color.White.A);
|
||||
handSlot.Draw(handL);
|
||||
|
||||
handSlot.Color = _inactiveColor;
|
||||
handSlot.Color = new SFML.Graphics.Color(_inactiveColor.R, _inactiveColor.G, _inactiveColor.B, _inactiveColor.A);
|
||||
handSlot.Draw(handR);
|
||||
}
|
||||
else
|
||||
{
|
||||
handSlot.Color = Color.White;
|
||||
handSlot.Color = new SFML.Graphics.Color(Color.White.R, Color.White.G, Color.White.B, Color.White.A); ;
|
||||
handSlot.Draw(handR);
|
||||
|
||||
handSlot.Color = _inactiveColor;
|
||||
handSlot.Color = new SFML.Graphics.Color(_inactiveColor.R, _inactiveColor.G, _inactiveColor.B, _inactiveColor.A);
|
||||
handSlot.Draw(handL);
|
||||
}
|
||||
|
||||
@@ -164,15 +165,15 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
switch (e.Buttons)
|
||||
switch (e.Button)
|
||||
{
|
||||
case MouseButtons.Right:
|
||||
if (handL.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
case Mouse.Button.Right:
|
||||
if (handL.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
SendSwitchHandTo(Hand.Left);
|
||||
return true;
|
||||
}
|
||||
if (handR.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (handR.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
SendSwitchHandTo(Hand.Right);
|
||||
return true;
|
||||
@@ -184,7 +185,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (_playerManager.ControlledEntity == null)
|
||||
return false;
|
||||
@@ -198,7 +199,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
if (_userInterfaceManager.DragInfo.IsEntity && _userInterfaceManager.DragInfo.IsActive)
|
||||
{
|
||||
if (handL.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (handL.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (!hands.HandSlots.ContainsKey(Hand.Left))
|
||||
{
|
||||
@@ -218,7 +219,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (handR.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
else if (handR.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (!hands.HandSlots.ContainsKey(Hand.Right))
|
||||
{
|
||||
@@ -240,13 +241,13 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
}
|
||||
else
|
||||
{
|
||||
if (handL.Contains(new Point((int) e.Position.X, (int) e.Position.Y)) &&
|
||||
if (handL.Contains(new Point((int) e.X, (int) e.Y)) &&
|
||||
hands.HandSlots.ContainsKey(Hand.Left) && hands.HandSlots[Hand.Right] != null)
|
||||
{
|
||||
hands.HandSlots[Hand.Left].SendMessage(this, ComponentMessageType.ClickedInHand,
|
||||
_playerManager.ControlledEntity.Uid);
|
||||
}
|
||||
else if (handR.Contains(new Point((int) e.Position.X, (int) e.Position.Y)) &&
|
||||
else if (handR.Contains(new Point((int) e.X, (int) e.Y)) &&
|
||||
hands.HandSlots.ContainsKey(Hand.Right) && hands.HandSlots[Hand.Right] != null)
|
||||
{
|
||||
hands.HandSlots[Hand.Right].SendMessage(this, ComponentMessageType.ClickedInHand,
|
||||
@@ -257,16 +258,16 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void MouseMove(MouseMoveEventArgs e)
|
||||
public void MouseMove(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
Entity entity = _playerManager.ControlledEntity;
|
||||
var hands = (HumanHandsComponent) entity.GetComponent(ComponentFamily.Hands);
|
||||
switch (e.Buttons)
|
||||
switch (e.Button)
|
||||
{
|
||||
case MouseButtons.Left:
|
||||
if (handL.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
case Mouse.Button.Left:
|
||||
if (handL.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (hands.HandSlots.Keys.Contains(Hand.Left) && hands.HandSlots[Hand.Left] != null)
|
||||
{
|
||||
@@ -274,7 +275,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
_userInterfaceManager.DragInfo.StartDrag(entityL);
|
||||
}
|
||||
}
|
||||
if (handR.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (handR.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (hands.HandSlots.Keys.Contains(Hand.Right) && hands.HandSlots[Hand.Right] != null)
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ using SS14.Shared.IoC;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using SFML.Window;
|
||||
using SS14.Shared.Maths;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -65,7 +66,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
const int y_inner = 25;
|
||||
const int dec_inner = 7;
|
||||
|
||||
panelBG.Position = Position;
|
||||
panelBG.Position =new Vector2 (Position.X, Position.Y);
|
||||
healthMeterBg.Position = new Vector2(Position.X + x_inner, Position.Y + y_inner);
|
||||
healthMeterOverlay.Position = new Vector2(Position.X + x_inner, Position.Y + y_inner);
|
||||
healthMeterGrid.Position = new Vector2(Position.X + x_inner, Position.Y + y_inner);
|
||||
@@ -102,8 +103,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
panelBG.Draw();
|
||||
healthMeterBg.Draw();
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(healthMeterInner.X, healthMeterInner.Y, healthMeterInner.Width,
|
||||
healthMeterInner.Height, interpCol);
|
||||
CluwneLib.drawRectangle(healthMeterInner.X, healthMeterInner.Y, healthMeterInner.Width, healthMeterInner.Height, interpCol);
|
||||
healthPc.Render();
|
||||
healthMeterGrid.Draw();
|
||||
RenderBlip();
|
||||
@@ -125,16 +125,15 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
var bs = (int) Math.Floor(blipTime*blipSpeed);
|
||||
|
||||
Gorgon.CurrentRenderTarget.BlendingMode = BlendingModes.Modulated;
|
||||
CluwneLib.BlendingMode = BlendingModes.Modulated;
|
||||
for (int i = bs; i < (bs + blipWidth); i++)
|
||||
{
|
||||
float sweepPct = (float) i/(bs + blipWidth);
|
||||
|
||||
float alpha =
|
||||
Math.Min(Math.Max((1 - (Math.Abs((blipMaxArea/2f) - i)/(blipMaxArea/2f)))*(300f*sweepPct), 0f), 255f);
|
||||
_backgroundSprite.Color = Color.FromArgb((int) alpha,
|
||||
ColorInterpolator.InterpolateBetween(Color.Orange,
|
||||
Color.LawnGreen, healthPct));
|
||||
Color temp = Color.FromArgb((int) alpha,ColorInterpolator.InterpolateBetween(Color.Orange, Color.LawnGreen, healthPct));
|
||||
_backgroundSprite.Color = new SFML.Graphics.Color(temp.R, temp.G, temp.B, temp.A);
|
||||
|
||||
float blipHeightUp = Math.Max(((blipUp - Math.Abs(blipUp - i))/(float) blipUp) - 0.80f, 0f);
|
||||
float blipHeightDown = Math.Max(((blipDown - Math.Abs(blipDown - i))/(float) blipDown) - 0.93f, 0f);
|
||||
@@ -150,7 +149,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
((healthPct > 0f) ? Math.Max(healthPct, 0.45f) : 0)),
|
||||
3, 3));
|
||||
}
|
||||
Gorgon.CurrentRenderTarget.BlendingMode = BlendingModes.None;
|
||||
CluwneLib.BlendingMode = BlendingModes.None;
|
||||
}
|
||||
|
||||
public override void Resize()
|
||||
@@ -169,7 +168,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -178,7 +177,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -78,38 +78,41 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
ComponentReplyMessage reply = assigned.SendMessage(this, ComponentFamily.Damageable,
|
||||
ComponentMessageType.GetCurrentLocationHealth,
|
||||
BodyPart.Head);
|
||||
|
||||
Color temp = GetColor((int) reply.ParamsList[1], (int) reply.ParamsList[2]);
|
||||
|
||||
if (reply.MessageType == ComponentMessageType.CurrentLocationHealth)
|
||||
_head.Color = GetColor((int) reply.ParamsList[1], (int) reply.ParamsList[2]);
|
||||
_head.Color =new SFML.Graphics.Color(temp.R,temp.G,temp.B,temp.A);
|
||||
|
||||
reply = assigned.SendMessage(this, ComponentFamily.Damageable, ComponentMessageType.GetCurrentLocationHealth,
|
||||
BodyPart.Torso);
|
||||
if (reply.MessageType == ComponentMessageType.CurrentLocationHealth)
|
||||
_chest.Color = GetColor((int) reply.ParamsList[1], (int) reply.ParamsList[2]);
|
||||
_chest.Color = new SFML.Graphics.Color(temp.R,temp.G,temp.B,temp.A);
|
||||
|
||||
reply = assigned.SendMessage(this, ComponentFamily.Damageable, ComponentMessageType.GetCurrentLocationHealth,
|
||||
BodyPart.Left_Arm);
|
||||
if (reply.MessageType == ComponentMessageType.CurrentLocationHealth)
|
||||
_arml.Color = GetColor((int) reply.ParamsList[1], (int) reply.ParamsList[2]);
|
||||
_arml.Color = new SFML.Graphics.Color(temp.R,temp.G,temp.B,temp.A);
|
||||
|
||||
reply = assigned.SendMessage(this, ComponentFamily.Damageable, ComponentMessageType.GetCurrentLocationHealth,
|
||||
BodyPart.Right_Arm);
|
||||
if (reply.MessageType == ComponentMessageType.CurrentLocationHealth)
|
||||
_armr.Color = GetColor((int) reply.ParamsList[1], (int) reply.ParamsList[2]);
|
||||
_armr.Color = new SFML.Graphics.Color(temp.R,temp.G,temp.B,temp.A);
|
||||
|
||||
reply = assigned.SendMessage(this, ComponentFamily.Damageable, ComponentMessageType.GetCurrentLocationHealth,
|
||||
BodyPart.Groin);
|
||||
if (reply.MessageType == ComponentMessageType.CurrentLocationHealth)
|
||||
_groin.Color = GetColor((int) reply.ParamsList[1], (int) reply.ParamsList[2]);
|
||||
_groin.Color = new SFML.Graphics.Color(temp.R,temp.G,temp.B,temp.A);
|
||||
|
||||
reply = assigned.SendMessage(this, ComponentFamily.Damageable, ComponentMessageType.GetCurrentLocationHealth,
|
||||
BodyPart.Left_Leg);
|
||||
if (reply.MessageType == ComponentMessageType.CurrentLocationHealth)
|
||||
_legl.Color = GetColor((int) reply.ParamsList[1], (int) reply.ParamsList[2]);
|
||||
_legl.Color = new SFML.Graphics.Color(temp.R,temp.G,temp.B,temp.A);
|
||||
|
||||
reply = assigned.SendMessage(this, ComponentFamily.Damageable, ComponentMessageType.GetCurrentLocationHealth,
|
||||
BodyPart.Right_Leg);
|
||||
if (reply.MessageType == ComponentMessageType.CurrentLocationHealth)
|
||||
_legr.Color = GetColor((int) reply.ParamsList[1], (int) reply.ParamsList[2]);
|
||||
_legr.Color = new SFML.Graphics.Color(temp.R,temp.G,temp.B,temp.A);
|
||||
|
||||
if (assigned.HasComponent(ComponentFamily.Damageable))
|
||||
{
|
||||
@@ -120,15 +123,15 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override sealed void Update(float frameTime)
|
||||
{
|
||||
_background.Position = Position;
|
||||
_background.Position = new Vector2(Position.X, Position.Y);
|
||||
|
||||
_head.Position = Position;
|
||||
_chest.Position = Position;
|
||||
_arml.Position = Position;
|
||||
_armr.Position = Position;
|
||||
_groin.Position = Position;
|
||||
_legl.Position = Position;
|
||||
_legr.Position = Position;
|
||||
_head.Position = new Vector2 (Position.X, Position.Y);
|
||||
_chest.Position = new Vector2(Position.X, Position.Y);
|
||||
_arml.Position = new Vector2(Position.X, Position.Y);
|
||||
_armr.Position = new Vector2(Position.X, Position.Y);
|
||||
_groin.Position = new Vector2(Position.X, Position.Y);
|
||||
_legl.Position = new Vector2(Position.X, Position.Y);
|
||||
_legr.Position = new Vector2(Position.X, Position.Y);
|
||||
|
||||
_overallHealth.Position = new Vector2(Position.X + 86, Position.Y + 29);
|
||||
|
||||
@@ -158,14 +161,14 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override void MouseMove(MouseMoveEventArgs e)
|
||||
{
|
||||
if (dragging) Position = (Point) e.Position;
|
||||
if (dragging) Position = new Point( e.X, e.Y);
|
||||
}
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
var insidePos = new Vector2((int) e.Position.X - Position.X, (int) e.Position.Y - Position.Y);
|
||||
var insidePos = new Vector2((int) e.X , (int) e.Y );
|
||||
if ((insidePos - new Vector2(189, 9)).Length <= 5)
|
||||
{
|
||||
_uiMgr.RemoveComponent(this);
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -62,7 +63,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override sealed void Update(float frameTime)
|
||||
{
|
||||
hotbarBG.Position = Position;
|
||||
hotbarBG.Position = CluwneLib.PointToVector2(Position);
|
||||
|
||||
int y_dist = 30;
|
||||
int x_pos = 175;
|
||||
|
||||
@@ -37,17 +37,17 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override sealed void Update(float frameTime)
|
||||
{
|
||||
_buttonSprite.Position = Position;
|
||||
_buttonSprite.Position = new SFML.System.Vector2f(Position.X, Position.Y);
|
||||
ClientArea = new Rectangle(Position,
|
||||
new Size((int) _buttonSprite.AABB.Width, (int) _buttonSprite.AABB.Height));
|
||||
}
|
||||
|
||||
public override void Render()
|
||||
{
|
||||
_buttonSprite.Color = Color;
|
||||
_buttonSprite.Position = Position;
|
||||
_buttonSprite.Color = new SFML.Graphics.Color(Color.R,Color.G,Color.B,Color.A);
|
||||
_buttonSprite.Position = new SFML.System.Vector2f(Position.X, Position.Y);
|
||||
_buttonSprite.Draw();
|
||||
_buttonSprite.Color = Color.White;
|
||||
_buttonSprite.Color = new SFML.Graphics.Color(Color.White.R,Color.White.G,Color.White.B,Color.White.A);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
@@ -60,7 +60,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (Clicked != null) Clicked(this);
|
||||
return true;
|
||||
@@ -70,7 +70,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)) &&
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)) &&
|
||||
IoCManager.Resolve<IUserInterfaceManager>().DragInfo.IsActive)
|
||||
{
|
||||
if (Dropped != null) Dropped(this);
|
||||
|
||||
@@ -5,6 +5,8 @@ using System;
|
||||
using Color = SFML.Graphics.Color;
|
||||
using SFML.Window;
|
||||
using SFML.Graphics;
|
||||
using System.Drawing;
|
||||
using SS14.Shared.Maths;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -90,7 +92,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
if (_drawSprite != null)
|
||||
{
|
||||
_drawSprite.Position = Position;
|
||||
_drawSprite.Position = new Vector2( Position.X,Position.Y);
|
||||
ClientArea = new Rectangle(Position,
|
||||
new Size((int)_drawSprite.AABB.Width, (int)_drawSprite.AABB.Height));
|
||||
}
|
||||
@@ -101,7 +103,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
if (_drawSprite != null)
|
||||
{
|
||||
_drawSprite.Color = Color;
|
||||
_drawSprite.Position = Position;
|
||||
_drawSprite.Position = new Vector2 (Position.X,Position.Y);
|
||||
_drawSprite.Draw();
|
||||
_drawSprite.Color = Color.White;
|
||||
}
|
||||
@@ -119,7 +121,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override void MouseMove(MouseMoveEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int)e.Position.X, (int)e.Position.Y)) && _buttonHover != null)
|
||||
if (ClientArea.Contains(new Point((int)e.X, (int)e.Y)) && _buttonHover != null)
|
||||
{
|
||||
if (_drawSprite != _buttonClick)
|
||||
_drawSprite = _buttonHover;
|
||||
@@ -133,7 +135,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int)e.Position.X, (int)e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int)e.X, (int)e.Y)))
|
||||
{
|
||||
if (_buttonClick != null) _drawSprite = _buttonClick;
|
||||
if (Clicked != null) Clicked(this);
|
||||
@@ -146,7 +148,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
if (_drawSprite == _buttonClick)
|
||||
if (_buttonHover != null)
|
||||
_drawSprite = ClientArea.Contains(new Point((int)e.Position.X, (int)e.Position.Y))
|
||||
_drawSprite = ClientArea.Contains(new Point((int)e.X, (int)e.Y))
|
||||
? _buttonHover
|
||||
: _buttonNormal;
|
||||
else
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
Color = Color.Black,
|
||||
ShadowColor = Color.DimGray,
|
||||
Shadowed = true,
|
||||
ShadowOffset = new Vector2(1, 1)
|
||||
//ShadowOffset = new Vector2(1, 1)
|
||||
};
|
||||
|
||||
Update(0);
|
||||
@@ -58,16 +58,17 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
if (!Available)
|
||||
{
|
||||
_buttonSprite.Color = Color.DarkRed;
|
||||
_buttonSprite.Color = new SFML.Graphics.Color(Color.DarkRed.R, Color.DarkRed.G, Color.DarkRed.B, Color.DarkRed.A);
|
||||
}
|
||||
else if (Selected)
|
||||
{
|
||||
_buttonSprite.Color = Color.DarkSeaGreen;
|
||||
_buttonSprite.Color = new SFML.Graphics.Color(Color.DarkSeaGreen.R, Color.DarkSeaGreen.G, Color.DarkSeaGreen.B, Color.DarkSeaGreen.A);
|
||||
|
||||
}
|
||||
_buttonSprite.Draw(_buttonArea);
|
||||
_jobSprite.Draw(_buttonArea);
|
||||
_descriptionTextSprite.Draw();
|
||||
_buttonSprite.Color = Color.White;
|
||||
_buttonSprite.Color = new SFML.Graphics.Color(Color.White.R, Color.White.G, Color.White.B, Color.White.A);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
@@ -83,7 +84,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (!Available) return false;
|
||||
if (_buttonArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (_buttonArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (Clicked != null) Clicked(this);
|
||||
Selected = true;
|
||||
|
||||
@@ -4,6 +4,8 @@ using SS14.Client.Graphics.CluwneLib;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using SFML.Window;
|
||||
using SFML.Graphics;
|
||||
using Color = System.Drawing.Color;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -56,15 +58,17 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
// TODO Gorgon fix this
|
||||
public override void Render()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (DrawBackground)
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width,
|
||||
ClientArea.Height, BackgroundColor);
|
||||
CluwneLib.drawRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width,ClientArea.Height, BackgroundColor);
|
||||
if (DrawTextHighlight)
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(Text.Position.X + 1, Text.Position.Y + 4, Text.Width,
|
||||
Text.Height - 9, BackgroundColor);
|
||||
CluwneLib.drawRectangle((int)(Text.Position.X + 1), (int)Text.Position.Y + 4, (int)Text.Width, (int)Text.Height - 9, BackgroundColor);
|
||||
if (DrawBorder)
|
||||
Gorgon.CurrentRenderTarget.Rectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
BorderColor);
|
||||
//CluwneLib.createHollowRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,borderColor);
|
||||
Text.Draw();
|
||||
}
|
||||
|
||||
@@ -90,5 +94,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public Size Size { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
//change to clientAreaRight when theres a proper skin with an arrow to the right.
|
||||
{
|
||||
var UiMgr = IoCManager.Resolve<IUserInterfaceManager>();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Lidgren.Network;
|
||||
using SS14.Client.GameObjects;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
using SS14.Client.Interfaces.Network;
|
||||
using SS14.Client.Interfaces.Placement;
|
||||
using SS14.Client.Interfaces.Player;
|
||||
@@ -32,8 +33,8 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
public MenuWindow()
|
||||
: base("Menu", new Size(140, 130), IoCManager.Resolve<IResourceManager>())
|
||||
{
|
||||
Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f));
|
||||
Position = new Point((int) (CluwneLib.CurrentRenderTarget.Size.X/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (CluwneLib.CurrentRenderTarget.Size.Y/2f) - (int) (ClientArea.Height/2f));
|
||||
|
||||
button_actions = new Button("Player Actions", _resMgr);
|
||||
button_actions.Clicked += button_actions_Clicked;
|
||||
|
||||
@@ -6,6 +6,8 @@ using System;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using System.Drawing;
|
||||
using SS14.Shared.Maths;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -17,7 +19,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
private readonly TextSprite timeLeft;
|
||||
|
||||
private readonly TextSprite tooltip;
|
||||
private CluwneSprite _buttonSprite;
|
||||
private CluwneSprite _buttonSprite;
|
||||
public IPlayerAction assignedAction;
|
||||
private double cooldownLeft;
|
||||
|
||||
@@ -55,12 +57,12 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
cooldownLeft = Math.Truncate(assignedAction.CooldownExpires.Subtract(DateTime.Now).TotalSeconds);
|
||||
|
||||
_buttonSprite.Position = Position;
|
||||
_buttonSprite.Position = new Vector2( Position.X, Position.Y);
|
||||
if (cooldownLeft > 0)
|
||||
{
|
||||
timeLeft.Text = cooldownLeft.ToString();
|
||||
int x_pos = (int) (ClientArea.Width/2f) - (int) (timeLeft.Width/2f);
|
||||
int y_pos = (int) (ClientArea.Height/2f) - (int) (timeLeft.Height/2f);
|
||||
int x_pos = (int)(ClientArea.Width / 2f) - (int)(timeLeft.Width / 2f);
|
||||
int y_pos = (int)(ClientArea.Height / 2f) - (int)(timeLeft.Height / 2f);
|
||||
timeLeft.Position = new Vector2(Position.X + x_pos, Position.Y + y_pos);
|
||||
}
|
||||
else timeLeft.Text = string.Empty;
|
||||
@@ -69,7 +71,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
showTooltip = true;
|
||||
|
||||
ClientArea = new Rectangle(Position,
|
||||
new Size((int) _buttonSprite.AABB.Width, (int) _buttonSprite.AABB.Height));
|
||||
new Size((int)_buttonSprite.AABB.Width, (int)_buttonSprite.AABB.Height));
|
||||
}
|
||||
|
||||
public override void Render()
|
||||
@@ -77,10 +79,10 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
if (cooldownLeft > 0) Color = Color.DarkGray;
|
||||
else Color = Color.White;
|
||||
|
||||
_buttonSprite.Color = Color;
|
||||
_buttonSprite.Position = Position;
|
||||
_buttonSprite.Color = new SFML.Graphics.Color(Color.R,Color.G,Color.B,Color.A);
|
||||
_buttonSprite.Position = new Vector2( Position.X, Position.Y);
|
||||
_buttonSprite.Draw();
|
||||
_buttonSprite.Color = Color.White;
|
||||
_buttonSprite.Color = new SFML.Graphics.Color(Color.White.R,Color.White.G,Color.White.B);
|
||||
|
||||
timeLeft.Draw();
|
||||
}
|
||||
@@ -98,14 +100,12 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
: "");
|
||||
|
||||
tooltip.Text = tooltipStr;
|
||||
float x_pos = (tooltipPos.X + 10 + tooltip.Width + 5 + offset.X) > Gorgon.CurrentClippingViewport.Width
|
||||
float x_pos = (tooltipPos.X + 10 + tooltip.Width + 5 + offset.X) > CluwneLib.CurrentClippingViewport.Width
|
||||
? 0 - tooltip.Width - 10
|
||||
: 10 + 5;
|
||||
tooltip.Position = new Vector2(tooltipPos.X + x_pos + 5 + offset.X, tooltipPos.Y + 5 + 10 + offset.Y);
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(tooltipPos.X + x_pos + offset.X, tooltipPos.Y + 10 + offset.Y,
|
||||
tooltip.Width + 5, tooltip.Height + 5, Color.SteelBlue);
|
||||
Gorgon.CurrentRenderTarget.Rectangle(tooltipPos.X + x_pos + offset.X, tooltipPos.Y + 10 + offset.Y,
|
||||
tooltip.Width + 5, tooltip.Height + 5, Color.DarkSlateBlue);
|
||||
CluwneLib.drawRectangle((int)(tooltipPos.X + x_pos + offset.X), tooltipPos.Y + 10 + offset.Y, tooltip.Width + 5, tooltip.Height + 5, Color.SteelBlue);
|
||||
CluwneLib.drawRectangle((int)(tooltipPos.X + x_pos + offset.X), tooltipPos.Y + 10 + offset.Y, tooltip.Width + 5, (tooltip.Height + 5), Color.DarkSlateBlue);
|
||||
tooltip.Draw();
|
||||
}
|
||||
}
|
||||
@@ -117,14 +117,14 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int)e.X, (int)e.Y)))
|
||||
{
|
||||
assignedAction.Activate();
|
||||
return true;
|
||||
@@ -132,11 +132,11 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void MouseMove(MouseMoveEventArgs e)
|
||||
public void MouseMove(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int)e.X, (int)e.Y)))
|
||||
{
|
||||
if (e.Buttons == MouseButtons.Left)
|
||||
if (e.Button == Mouse.Button.Left)
|
||||
{
|
||||
UiMgr.DragInfo.StartDrag(assignedAction);
|
||||
}
|
||||
@@ -147,7 +147,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
if (!mouseOver) mouseOverStart = DateTime.Now;
|
||||
mouseOver = true;
|
||||
}
|
||||
tooltipPos = new Point((int) e.Position.X, (int) e.Position.Y);
|
||||
tooltipPos = new Point((int)e.X, (int)e.Y);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -5,6 +5,7 @@ using SS14.Shared.IoC;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -19,8 +20,8 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
uiMgr = IoCManager.Resolve<IUserInterfaceManager>();
|
||||
assignedComp = _assignedComp;
|
||||
assignedComp.Changed += assignedComp_Changed;
|
||||
Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f));
|
||||
Position = new Point((int) (CluwneLib.CurrentRenderTarget.Size.X/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (CluwneLib.CurrentRenderTarget.Size.Y/2f) - (int) (ClientArea.Height/2f));
|
||||
assignedComp.CheckActionList();
|
||||
PopulateList();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ using System;
|
||||
using System.Drawing;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using SS14.Shared.Maths;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -57,10 +59,9 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
percent = (val - min)/(max - min);
|
||||
float barWidth = Size.Width*percent;
|
||||
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
backgroundColor);
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(ClientArea.X, ClientArea.Y, barWidth, ClientArea.Height, barColor);
|
||||
Gorgon.CurrentRenderTarget.Rectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
CluwneLib.drawRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height, backgroundColor);
|
||||
//TODO : CluwneLib.DrawHollowRectangle (ClientArea.X, ClientArea.Y, (int)barWidth, ClientArea.Height, barColor);
|
||||
CluwneLib.drawRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
borderColor);
|
||||
|
||||
Text.Draw();
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -29,8 +30,8 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
public PropEditWindow(Size size, IResourceManager resourceManager, Object obj)
|
||||
: base("Object Properties : " + obj, size, resourceManager)
|
||||
{
|
||||
Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f));
|
||||
Position = new Point((int) (CluwneLib.CurrentRenderTarget.Size.X/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (CluwneLib.CurrentRenderTarget.Size.Y/2f) - (int) (ClientArea.Height/2f));
|
||||
|
||||
search = new Textbox(150, resourceManager);
|
||||
search.Position = new Point(5, 5);
|
||||
@@ -262,9 +263,9 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
private void LabelName_Clicked(Label sender, MouseButtonEventArgs e)
|
||||
{
|
||||
switch (e.Buttons)
|
||||
switch (e.Button)
|
||||
{
|
||||
case MouseButtons.Left:
|
||||
case Mouse.Button.Left:
|
||||
{
|
||||
PropWindowStruct? selected = null;
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ using SFML.Window;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using SS14.Shared.Maths;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -35,11 +37,13 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
Size = size;
|
||||
|
||||
if (RenderTargetCache.Targets.Contains(uniqueName))
|
||||
//Now this is an ugly hack to work around duplicate RenderImages. Have to fix this later.
|
||||
uniqueName = uniqueName + Guid.NewGuid();
|
||||
//if (RenderTargetCache.Targets.Contains(uniqueName))
|
||||
// //Now this is an ugly hack to work around duplicate RenderImages. Have to fix this later.
|
||||
// uniqueName = uniqueName + Guid.NewGuid();
|
||||
|
||||
clippingRI = new RenderImage(uniqueName, Size.Width, Size.Height, ImageBufferFormats.BufferRGB888A8);
|
||||
clippingRI = new RenderImage((uint)Size.Width,(uint) Size.Height);
|
||||
clippingRI.setName = uniqueName;
|
||||
clippingRI.setImageBuffer = ImageBufferFormats.BufferRGB888A8;
|
||||
scrollbarH = new Scrollbar(true, _resourceManager);
|
||||
scrollbarV = new Scrollbar(false, _resourceManager);
|
||||
scrollbarV.size = Size.Height;
|
||||
@@ -47,11 +51,11 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
scrollbarH.Update(0);
|
||||
scrollbarV.Update(0);
|
||||
|
||||
clippingRI.SourceBlend = AlphaBlendOperation.SourceAlpha;
|
||||
clippingRI.DestinationBlend = AlphaBlendOperation.InverseSourceAlpha;
|
||||
//clippingRI.SourceBlend = AlphaBlendOperation.SourceAlpha;
|
||||
//clippingRI.DestinationBlend = AlphaBlendOperation.InverseSourceAlpha;
|
||||
|
||||
clippingRI.SourceBlendAlpha = AlphaBlendOperation.SourceAlpha;
|
||||
clippingRI.DestinationBlendAlpha = AlphaBlendOperation.InverseSourceAlpha;
|
||||
//clippingRI.SourceBlendAlpha = AlphaBlendOperation.SourceAlpha;
|
||||
//clippingRI.DestinationBlendAlpha = AlphaBlendOperation.InverseSourceAlpha;
|
||||
|
||||
Update(0);
|
||||
}
|
||||
@@ -65,7 +69,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
if (disposing || !IsVisible()) return;
|
||||
ClientArea = new Rectangle(Position, new Size(clippingRI.Width, clippingRI.Height));
|
||||
ClientArea = new Rectangle(Position, new Size((int)clippingRI.Height, (int)clippingRI.Height));
|
||||
|
||||
if (inner_focus != null && !components.Contains((GuiComponent) inner_focus)) ClearFocus();
|
||||
|
||||
@@ -91,11 +95,11 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
scrollbarH.max = (int) max_x - ClientArea.Width +
|
||||
(max_y > clippingRI.Height ? scrollbarV.ClientArea.Width : 0);
|
||||
if (max_x > clippingRI.Width) scrollbarH.SetVisible(true);
|
||||
if (max_x > clippingRI.Height) scrollbarH.SetVisible(true);
|
||||
else scrollbarH.SetVisible(false);
|
||||
|
||||
scrollbarV.max = (int) max_y - ClientArea.Height +
|
||||
(max_x > clippingRI.Width ? scrollbarH.ClientArea.Height : 0);
|
||||
(max_x > clippingRI.Height ? scrollbarH.ClientArea.Height : 0);
|
||||
if (max_y > clippingRI.Height) scrollbarV.SetVisible(true);
|
||||
else scrollbarV.SetVisible(false);
|
||||
|
||||
@@ -107,7 +111,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
if (disposing || !IsVisible()) return;
|
||||
|
||||
clippingRI.Clear(DrawBackground ? BackgroundColor : Color.Transparent);
|
||||
clippingRI.Clear(DrawBackground ? new SFML.Graphics.Color(BackgroundColor.R,BackgroundColor.G,BackgroundColor.B,BackgroundColor.A) : new SFML.Graphics.Color(0,0,0,255));
|
||||
clippingRI.BeginDrawing();
|
||||
|
||||
foreach (GuiComponent component in components)
|
||||
@@ -134,13 +138,13 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
}
|
||||
|
||||
clippingRI.EndDrawing();
|
||||
clippingRI.Blit(Position.X, Position.Y,clippingRI.Width, clippingRI.Height, Color.White, BlitterSizeMode.Crop);
|
||||
clippingRI.Blit(Position.X, Position.Y,clippingRI.Height, clippingRI.Height, Color.White, BlitterSizeMode.Crop);
|
||||
|
||||
scrollbarH.Render();
|
||||
scrollbarV.Render();
|
||||
|
||||
if (DrawBorder)
|
||||
Gorgon.CurrentRenderTarget.Rectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
CluwneLib.drawRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
Color.Black);
|
||||
}
|
||||
|
||||
@@ -195,21 +199,13 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
var modArgs = new MouseInputEventArgs
|
||||
(e.Buttons,
|
||||
e.ShiftButtons,
|
||||
new Vector2(e.Position.X - Position.X + scrollbarH.Value,
|
||||
e.Position.Y - Position.Y + scrollbarV.Value),
|
||||
e.WheelPosition,
|
||||
e.RelativePosition,
|
||||
e.WheelDelta,
|
||||
e.ClickCount);
|
||||
|
||||
|
||||
foreach (GuiComponent component in components)
|
||||
{
|
||||
if (component.MouseDown(modArgs))
|
||||
if (e.Button == Mouse.Button.ButtonCount)
|
||||
{
|
||||
SetFocus(component);
|
||||
return true;
|
||||
@@ -227,17 +223,10 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
if (scrollbarH.MouseUp(e)) return true;
|
||||
if (scrollbarV.MouseUp(e)) return true;
|
||||
|
||||
var modArgs = new MouseInputEventArgs
|
||||
(e.Buttons,
|
||||
e.ShiftButtons,
|
||||
new Vector2(e.Position.X - Position.X + scrollbarH.Value, e.Position.Y - Position.Y + scrollbarV.Value),
|
||||
e.WheelPosition,
|
||||
e.RelativePosition,
|
||||
e.WheelDelta,
|
||||
e.ClickCount);
|
||||
|
||||
|
||||
foreach (GuiComponent component in components)
|
||||
component.MouseUp(modArgs);
|
||||
component.MouseUp(e);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -248,43 +237,30 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
scrollbarH.MouseMove(e);
|
||||
scrollbarV.MouseMove(e);
|
||||
|
||||
var modArgs = new MouseInputEventArgs
|
||||
(e.Buttons,
|
||||
e.ShiftButtons,
|
||||
new Vector2(e.Position.X - Position.X + scrollbarH.Value, e.Position.Y - Position.Y + scrollbarV.Value),
|
||||
e.WheelPosition,
|
||||
e.RelativePosition,
|
||||
e.WheelDelta,
|
||||
e.ClickCount);
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (GuiComponent component in components)
|
||||
component.MouseMove(modArgs);
|
||||
component.MouseMove(e);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public override bool MouseWheelMove(MouseWheelEventArgs e)
|
||||
{
|
||||
var modArgs = new MouseInputEventArgs
|
||||
(e.Buttons,
|
||||
e.ShiftButtons,
|
||||
new Vector2(e.Position.X - Position.X + scrollbarH.Value, e.Position.Y - Position.Y + scrollbarV.Value),
|
||||
e.WheelPosition,
|
||||
e.RelativePosition,
|
||||
e.WheelDelta,
|
||||
e.ClickCount);
|
||||
|
||||
|
||||
if (inner_focus != null)
|
||||
{
|
||||
if (inner_focus.MouseWheelMove(modArgs))
|
||||
if (inner_focus.MouseWheelMove(e))
|
||||
return true;
|
||||
else if (scrollbarV.IsVisible() && ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
else if (scrollbarV.IsVisible() && ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
scrollbarV.MouseWheelMove(e);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (scrollbarV.IsVisible() && ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
else if (scrollbarV.IsVisible() && ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
scrollbarV.MouseWheelMove(e);
|
||||
return true;
|
||||
|
||||
@@ -4,6 +4,8 @@ using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
using SS14.Shared.Maths;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -52,7 +54,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
DEBUG.Color = Color.OrangeRed;
|
||||
DEBUG.ShadowColor = Color.DarkBlue;
|
||||
DEBUG.Shadowed = true;
|
||||
DEBUG.ShadowOffset = new Vector2(1, 1);
|
||||
// DEBUG.ShadowOffset = new Vector2(1, 1);
|
||||
Update(0);
|
||||
}
|
||||
|
||||
@@ -78,12 +80,12 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (!IsVisible()) return false;
|
||||
if (clientAreaButton.Contains((int) e.Position.X, (int) e.Position.Y))
|
||||
if (clientAreaButton.Contains((int) e.X, (int) e.Y))
|
||||
{
|
||||
dragging = true;
|
||||
return true;
|
||||
}
|
||||
else if (ClientArea.Contains((int) e.Position.X, (int) e.Position.Y))
|
||||
else if (ClientArea.Contains((int) e.X, (int) e.Y))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -106,8 +108,8 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
if (dragging)
|
||||
{
|
||||
if (Horizontal)
|
||||
currentPos = (int) e.Position.X - ClientArea.Location.X - (int) (scrollbarButton.Width/2f);
|
||||
else currentPos = (int) e.Position.Y - ClientArea.Location.Y - (int) (scrollbarButton.Height/2f);
|
||||
currentPos = (int) e.X - ClientArea.Location.X - (int) (scrollbarButton.Width/2f);
|
||||
else currentPos = (int) e.Y - ClientArea.Location.Y - (int) (scrollbarButton.Height/2f);
|
||||
currentPos = Math.Min(currentPos, actualSize);
|
||||
currentPos = Math.Max(currentPos, 0);
|
||||
RaiseEvent = true;
|
||||
@@ -116,7 +118,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseWheelMove(MouseWheelEventArgs e)
|
||||
{
|
||||
Value += ((Math.Sign(e.WheelDelta)*-1)*Math.Max(((max/20)), 1));
|
||||
Value += ((Math.Sign(e.Y)*-1)*Math.Max(((max/20)), 1));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -153,14 +155,12 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
if (!IsVisible()) return;
|
||||
if (drawBackground)
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width,
|
||||
ClientArea.Height, Color.DarkSlateGray);
|
||||
CluwneLib.drawRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height, Color.DarkSlateGray);
|
||||
scrollbarButton.Draw(clientAreaButton);
|
||||
DEBUG.Position = new Vector2(ClientArea.Location.X + 20, ClientArea.Location.Y + 20);
|
||||
DEBUG.Text = "current: " + actualVal.ToString();
|
||||
if (DRAW_DEBUG) DEBUG.Draw();
|
||||
Gorgon.CurrentRenderTarget.Rectangle(ClientArea.X + 0, ClientArea.Y + 0, ClientArea.Width - 0,
|
||||
ClientArea.Height - 0, Color.Black);
|
||||
CluwneLib.drawRectangle(ClientArea.X + 0, ClientArea.Y + 0, ClientArea.Width - 0, ClientArea.Height - 0, Color.Black);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public Size Size = new Size(300, 100);
|
||||
protected ImageButton _buttonLeft;
|
||||
private Color ctemp;
|
||||
protected ImageButton _buttonRight;
|
||||
protected int Selected
|
||||
{
|
||||
@@ -185,8 +186,8 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
new Point(ClientArea.Left + (int) (ClientArea.Width/2f - selected.Key.ClientArea.Width/2f),
|
||||
ClientArea.Top + (int) (ClientArea.Height/2f - selected.Key.ClientArea.Height/2f));
|
||||
if (FadeItems)
|
||||
selected.Key.Color = Color.FromArgb(255, Color.White);
|
||||
|
||||
ctemp = Color.FromArgb(255, Color.White);
|
||||
selected.Key.Color = new SFML.Graphics.Color(ctemp.R, ctemp.G, ctemp.B, ctemp.A);
|
||||
selected.Key.Render();
|
||||
|
||||
int lastPosLeft = selected.Key.ClientArea.Left - ItemSpacing;
|
||||
@@ -209,7 +210,8 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
lastPosLeft = selectedLeft.Key.ClientArea.Left - ItemSpacing;
|
||||
|
||||
if (FadeItems)
|
||||
selectedLeft.Key.Color = Color.FromArgb((int) (baseAlpha/alphaAdj), Color.White);
|
||||
ctemp = Color.FromArgb((int)(baseAlpha / alphaAdj), Color.White);
|
||||
selectedLeft.Key.Color = new SFML.Graphics.Color(ctemp.R, ctemp.G, ctemp.B, ctemp.A);
|
||||
|
||||
selectedLeft.Key.Render();
|
||||
}
|
||||
@@ -226,8 +228,8 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
lastPosRight = selectedRight.Key.ClientArea.Right + ItemSpacing;
|
||||
|
||||
if (FadeItems)
|
||||
selectedRight.Key.Color = Color.FromArgb((int) (baseAlpha/alphaAdj), Color.White);
|
||||
|
||||
ctemp = Color.FromArgb((int)(baseAlpha / alphaAdj), Color.White);
|
||||
selectedRight.Key.Color = new SFML.Graphics.Color(ctemp.R, ctemp.G, ctemp.B, ctemp.A);
|
||||
selectedRight.Key.Render();
|
||||
}
|
||||
}
|
||||
@@ -254,14 +256,14 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseWheelMove(MouseWheelEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (e.WheelDelta > 0)
|
||||
if (e.Delta > 0)
|
||||
{
|
||||
if (Selected + 1 <= _items.Count - 1) Selected++;
|
||||
return true;
|
||||
}
|
||||
else if (e.WheelDelta < 0)
|
||||
else if (e.Delta < 0)
|
||||
{
|
||||
if (Selected - 1 >= 0) Selected--;
|
||||
return true;
|
||||
@@ -272,7 +274,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override void MouseMove(MouseMoveEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
_buttonLeft.MouseMove(e);
|
||||
_buttonRight.MouseMove(e);
|
||||
@@ -286,7 +288,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
|
||||
if (ShowArrows)
|
||||
@@ -324,7 +326,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (_buttonLeft.MouseUp(e)) return true;
|
||||
if (_buttonRight.MouseUp(e)) return true;
|
||||
|
||||
@@ -6,6 +6,8 @@ using SFML.Window;
|
||||
using SFML.Graphics;
|
||||
using System;
|
||||
using Color = System.Drawing.Color;
|
||||
using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
@@ -32,13 +34,13 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public Color Color
|
||||
{
|
||||
get { return drawingSprite != null ? drawingSprite.Color : Color.White; }
|
||||
set { drawingSprite.Color = value; }
|
||||
get { return (drawingSprite != null ? System.Drawing.Color.White : System.Drawing.Color.White); }
|
||||
set { drawingSprite.Color = CluwneLib.SystemColorToSFML(value); }
|
||||
}
|
||||
|
||||
public BlendMode BlendingMode
|
||||
{
|
||||
get { return drawingSprite != null ? drawingSprite.BlendingMode : BlendingMode.None; }
|
||||
get { return drawingSprite != null ? drawingSprite.BlendingMode : drawingSprite.BlendingMode; }
|
||||
set { drawingSprite.BlendingMode = value; }
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using SFML.Window;
|
||||
using SS14.Shared.Maths;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -128,11 +129,11 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
public override void Render()
|
||||
{
|
||||
if (buttons.Count > 0)
|
||||
Gorgon.CurrentRenderTarget.Rectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
CluwneLib.drawRectangle(ClientArea.X, ClientArea.Y, ClientArea.Width, ClientArea.Height,
|
||||
Color.DimGray);
|
||||
|
||||
Gorgon.CurrentRenderTarget.Circle(Position.X, Position.Y, 3, Color.White);
|
||||
Gorgon.CurrentRenderTarget.Circle(Position.X, Position.Y, 2, Color.Gray);
|
||||
CluwneLib.drawCircle(Position.X, Position.Y, 3, Color.White);
|
||||
CluwneLib.drawCircle(Position.X, Position.Y, 2, Color.Gray);
|
||||
|
||||
foreach (StatusEffectButton button in buttons)
|
||||
button.Render();
|
||||
@@ -149,7 +150,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
var mousePoint = new Vector2((int) e.Position.X, (int) e.Position.Y);
|
||||
var mousePoint = new Vector2((int) e.X, (int) e.Y);
|
||||
|
||||
if ((mousePoint - new Vector2(Position.X, Position.Y)).Length <= 3)
|
||||
dragging = true;
|
||||
@@ -172,7 +173,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
if (dragging)
|
||||
{
|
||||
Position = new Point((int) e.Position.X, (int) e.Position.Y);
|
||||
Position = new Point((int) e.X, (int) e.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -5,6 +5,8 @@ using SS14.Shared.GO;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using SFML.Window;
|
||||
using SS14.Shared.Maths;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -47,7 +49,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override sealed void Update(float frameTime)
|
||||
{
|
||||
_buttonSprite.Position = Position;
|
||||
_buttonSprite.Position = new Vector2 (Position.X,Position.Y);
|
||||
if (assignedEffect.doesExpire)
|
||||
{
|
||||
string leftStr = Math.Truncate(assignedEffect.expiresAt.Subtract(DateTime.Now).TotalSeconds).ToString();
|
||||
@@ -66,10 +68,10 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override void Render()
|
||||
{
|
||||
_buttonSprite.Color = Color;
|
||||
_buttonSprite.Position = Position;
|
||||
_buttonSprite.Color = new SFML.Graphics.Color(Color.R, Color.G, Color.B, Color.A);
|
||||
_buttonSprite.Position =new Vector2( Position.X, Position.Y);
|
||||
_buttonSprite.Draw();
|
||||
_buttonSprite.Color = Color.White;
|
||||
_buttonSprite.Color = new SFML.Graphics.Color(Color.White.R, Color.White.G, Color.White.B);
|
||||
|
||||
if (assignedEffect.doesExpire)
|
||||
{
|
||||
@@ -93,14 +95,14 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
: "");
|
||||
|
||||
tooltip.Text = tooltipStr;
|
||||
float x_pos = (tooltipPos.X + 10 + tooltip.Width + 5) > Gorgon.CurrentClippingViewport.Width
|
||||
float x_pos = (tooltipPos.X + 10 + tooltip.Width + 5) > CluwneLib.CurrentClippingViewport.Width
|
||||
? 0 - tooltip.Width - 10
|
||||
: 10 + 5;
|
||||
tooltip.Position = new Vector2(tooltipPos.X + x_pos + 5, tooltipPos.Y + 5 + 10);
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(tooltipPos.X + x_pos, tooltipPos.Y + 10, tooltip.Width + 5,
|
||||
CluwneLib.drawRectangle((int)(tooltipPos.X + x_pos), tooltipPos.Y + 10, tooltip.Width + 5,
|
||||
tooltip.Height + 5, Color.SteelBlue);
|
||||
Gorgon.CurrentRenderTarget.Rectangle(tooltipPos.X + x_pos, tooltipPos.Y + 10, tooltip.Width + 5,
|
||||
tooltip.Height + 5, Color.DarkSlateBlue);
|
||||
CluwneLib.drawRectangle((int)(tooltipPos.X + x_pos), tooltipPos.Y + 10, tooltip.Width + 5,
|
||||
tooltip.Height + 5, Color.DarkSlateBlue);
|
||||
tooltip.Draw();
|
||||
}
|
||||
}
|
||||
@@ -124,10 +126,10 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override void MouseMove(MouseMoveEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
showTooltip = true;
|
||||
tooltipPos = new Point((int) e.Position.X, (int) e.Position.Y);
|
||||
tooltipPos = new Point((int) e.X, (int) e.Y);
|
||||
}
|
||||
else
|
||||
showTooltip = false;
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (!ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y))) return false;
|
||||
if (!ClientArea.Contains(new Point((int) e.X, (int) e.Y))) return false;
|
||||
|
||||
TargetingDummyElement prevSelection = (from element in _elements
|
||||
where element.IsSelected()
|
||||
|
||||
@@ -5,6 +5,8 @@ using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using SFML.Window;
|
||||
using Image = SFML.Graphics.Image;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
using SS14.Shared.Maths;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -22,7 +24,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
public float MaxHealth;
|
||||
private Point _clickPoint;
|
||||
|
||||
private CluwneSprite _elementSprite;
|
||||
private CluwneSprite _elementSprite;
|
||||
private Boolean _selected;
|
||||
|
||||
public TargetingDummyElement(string spriteName, BodyPart part, IResourceManager resourceManager)
|
||||
@@ -52,31 +54,31 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override sealed void Update(float frameTime)
|
||||
{
|
||||
_elementSprite.Position = Position;
|
||||
_elementSprite.Position = new Vector2(Position.X,Position.Y);
|
||||
ClientArea = new Rectangle(Position,
|
||||
new Size((int) _elementSprite.AABB.Width, (int) _elementSprite.AABB.Height));
|
||||
new Size((int)_elementSprite.AABB.Width, (int)_elementSprite.AABB.Height));
|
||||
}
|
||||
|
||||
public override void Render()
|
||||
{
|
||||
//elementSprite.Color = selected ? Color.DarkRed : Color.White;
|
||||
float healthPct = CurrentHealth/MaxHealth;
|
||||
float healthPct = CurrentHealth / MaxHealth;
|
||||
|
||||
if (healthPct > 0.75) _elementSprite.Color = Color.DarkGreen;
|
||||
else if (healthPct > 0.50) _elementSprite.Color = Color.Yellow;
|
||||
else if (healthPct > 0.25) _elementSprite.Color = Color.DarkOrange;
|
||||
else if (healthPct > 0) _elementSprite.Color = Color.Red;
|
||||
else _elementSprite.Color = Color.Black;
|
||||
if (healthPct > 0.75) _elementSprite.Color = new SFML.Graphics.Color(Color.DarkGreen.R,Color.DarkGreen.G,Color.DarkGreen.B,Color.DarkGreen.A);
|
||||
else if (healthPct > 0.50) _elementSprite.Color = new SFML.Graphics.Color(Color.Yellow.R, Color.Yellow.G, Color.Yellow.B, Color.Yellow.A);
|
||||
else if (healthPct > 0.25) _elementSprite.Color = new SFML.Graphics.Color(Color.DarkOrange.R, Color.DarkOrange.G, Color.DarkOrange.B, Color.DarkOrange.A);
|
||||
else if (healthPct > 0) _elementSprite.Color = new SFML.Graphics.Color(Color.Red.R, Color.Red.G, Color.Red.B, Color.Red.A);
|
||||
else _elementSprite.Color = new SFML.Graphics.Color(Color.Black.R,Color.Black.G,Color.Black.B,Color.Black.R);
|
||||
|
||||
_elementSprite.Position = Position;
|
||||
_elementSprite.Position = new Vector2(Position.X,Position.Y);
|
||||
_elementSprite.Draw();
|
||||
_elementSprite.Color = Color.White;
|
||||
_elementSprite.Color = new SFML.Graphics.Color(Color.White.R, Color.White.G, Color.White.B, Color.White.R);
|
||||
|
||||
if (!_selected) return;
|
||||
|
||||
Gorgon.CurrentRenderTarget.Circle(Position.X + _clickPoint.X, Position.Y + _clickPoint.Y, 5, Color.Black);
|
||||
Gorgon.CurrentRenderTarget.Circle(Position.X + _clickPoint.X, Position.Y + _clickPoint.Y, 4, Color.DarkRed);
|
||||
Gorgon.CurrentRenderTarget.Circle(Position.X + _clickPoint.X, Position.Y + _clickPoint.Y, 3, Color.Black);
|
||||
CluwneLib.drawCircle(Position.X + _clickPoint.X, Position.Y + _clickPoint.Y, 5, Color.Black);
|
||||
CluwneLib.drawCircle(Position.X + _clickPoint.X, Position.Y + _clickPoint.Y, 4, Color.DarkRed);
|
||||
CluwneLib.drawCircle(Position.X + _clickPoint.X, Position.Y + _clickPoint.Y, 3, Color.Black);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
@@ -87,24 +89,24 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (!ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y))) return false;
|
||||
if (!ClientArea.Contains(new Point((int)e.X, (int)e.Y))) return false;
|
||||
|
||||
var spritePosition = new Point((int) e.Position.X - Position.X + (int) _elementSprite.ImageOffset.X,
|
||||
(int) e.Position.Y - Position.Y + (int) _elementSprite.ImageOffset.Y);
|
||||
var spritePosition = new Point((int)e.X - Position.X + (int)_elementSprite.ImageOffset.X,
|
||||
(int)e.Y - Position.Y + (int)_elementSprite.ImageOffset.Y);
|
||||
|
||||
Image.ImageLockBox imgData = _elementSprite.Image.GetImageData();
|
||||
imgData.Lock(false);
|
||||
// Image.ImageLockBox imgData = _elementSprite.Image.GetImageData();
|
||||
//imgData.Lock(false);
|
||||
|
||||
Color pixColour = Color.FromArgb((int) (imgData[spritePosition.X, spritePosition.Y]));
|
||||
imgData.Dispose();
|
||||
imgData.Unlock();
|
||||
Color pixColour = Color.Red;
|
||||
//imgData.Dispose();
|
||||
//imgData.Unlock();
|
||||
|
||||
if (pixColour.A != 0)
|
||||
{
|
||||
if (Clicked != null) Clicked(this);
|
||||
_clickPoint = new Point((int) e.Position.X - Position.X, (int) e.Position.Y - Position.Y);
|
||||
_clickPoint = new Point((int)e.X - Position.X, (int)e.Y - Position.Y);
|
||||
_selected = true;
|
||||
return true;
|
||||
}
|
||||
@@ -113,7 +115,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
background.Position = Position;
|
||||
background.Position = new SFML.System.Vector2f(Position.X,Position.Y);
|
||||
//_targetArea.Position = new Point(Position.X + 5, Position.Y + 5);
|
||||
_targetArea.Position =
|
||||
new Point(Position.X + (int) (ClientArea.Width/2f) - (int) (_targetArea.ClientArea.Width/2f),
|
||||
@@ -68,14 +68,14 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
return _targetArea.MouseDown(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using SS14.Client.Interfaces.Resource;
|
||||
using System;
|
||||
using Color = System.Drawing.Color;
|
||||
using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -52,7 +55,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
Width = width;
|
||||
|
||||
Label = new TextSprite("Textbox", "", _resourceManager.GetFont("CALIBRI")) {Color = Color.Black};
|
||||
Label = new TextSprite("Textbox", "", _resourceManager.GetFont("CALIBRI")) {Color = Color.Black};
|
||||
|
||||
Update(0);
|
||||
}
|
||||
@@ -94,9 +97,9 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
if (drawColor != Color.White)
|
||||
{
|
||||
_textboxLeft.Color = drawColor;
|
||||
_textboxMain.Color = drawColor;
|
||||
_textboxRight.Color = drawColor;
|
||||
_textboxLeft.Color = CluwneLib.SystemColorToSFML(drawColor);
|
||||
_textboxMain.Color = CluwneLib.SystemColorToSFML(drawColor);
|
||||
_textboxRight.Color = CluwneLib.SystemColorToSFML(drawColor);
|
||||
}
|
||||
|
||||
_textboxLeft.Draw(_clientAreaLeft);
|
||||
@@ -104,15 +107,15 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
_textboxRight.Draw(_clientAreaRight);
|
||||
|
||||
if (Focus && blinkCount <= 0.25f)
|
||||
Gorgon.CurrentRenderTarget.FilledRectangle(_caretPos - _caretWidth,
|
||||
Label.Position.Y + (Label.Height/2f) - (_caretHeight/2f),
|
||||
_caretWidth, _caretHeight, Color.WhiteSmoke);
|
||||
//Draw Textbox
|
||||
|
||||
// CluwneLib.CurrentRenderTarget.Draw(_caretPos - _caretWidth, Label.Position.Y + (Label.Height/2f) - (_caretHeight/2f),_caretWidth, _caretHeight, new Color(255,255,250));
|
||||
|
||||
if (drawColor != Color.White)
|
||||
{
|
||||
_textboxLeft.Color = Color.White;
|
||||
_textboxMain.Color = Color.White;
|
||||
_textboxRight.Color = Color.White;
|
||||
_textboxLeft.Color = CluwneLib.SystemColorToSFML(Color.White);
|
||||
_textboxMain.Color = CluwneLib.SystemColorToSFML(Color.White);
|
||||
_textboxRight.Color =CluwneLib.SystemColorToSFML( Color.White);
|
||||
}
|
||||
|
||||
Label.Color = textColor;
|
||||
@@ -133,7 +136,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -150,44 +153,43 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
if (!Focus) return false;
|
||||
|
||||
if (e.Ctrl && e.CharacterMapping.Character == 'v')
|
||||
if (e.Control && e.Code == Keyboard.Key.V)
|
||||
{
|
||||
if (Clipboard.ContainsText())
|
||||
{
|
||||
string ret = Clipboard.GetText();
|
||||
|
||||
string ret = System.Windows.Forms.Clipboard.GetText();
|
||||
Text = Text.Insert(_caretIndex, ret);
|
||||
if (_caretIndex < _text.Length) _caretIndex += ret.Length;
|
||||
SetVisibleText();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (e.Ctrl && e.CharacterMapping.Character == 'c')
|
||||
if (e.Control && e.Code == Keyboard.Key.C)
|
||||
{
|
||||
Clipboard.SetText(Text);
|
||||
|
||||
System.Windows.Forms.Clipboard.SetText(Text);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (e.Key == KeyboardKeys.Left)
|
||||
if (e.Code == Keyboard.Key.Left)
|
||||
{
|
||||
if (_caretIndex > 0) _caretIndex--;
|
||||
SetVisibleText();
|
||||
return true;
|
||||
}
|
||||
else if (e.Key == KeyboardKeys.Right)
|
||||
else if (e.Code == Keyboard.Key.Right)
|
||||
{
|
||||
if (_caretIndex < _text.Length) _caretIndex++;
|
||||
SetVisibleText();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (e.Key == KeyboardKeys.Return && Text.Length >= 1)
|
||||
if (e.Code == Keyboard.Key.Return && Text.Length >= 1)
|
||||
{
|
||||
Submit();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (e.Key == KeyboardKeys.Back && Text.Length >= 1)
|
||||
if (e.Code == Keyboard.Key.BackSpace && Text.Length >= 1)
|
||||
{
|
||||
if (_caretIndex == 0) return true;
|
||||
|
||||
@@ -197,7 +199,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
if (e.Key == KeyboardKeys.Delete && Text.Length >= 1)
|
||||
if (e.Code == Keyboard.Key.Delete && Text.Length >= 1)
|
||||
{
|
||||
if (_caretIndex >= Text.Length) return true;
|
||||
Text = Text.Remove(_caretIndex, 1);
|
||||
@@ -205,24 +207,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
if (char.IsLetterOrDigit(e.CharacterMapping.Character) || char.IsPunctuation(e.CharacterMapping.Character) ||
|
||||
char.IsWhiteSpace(e.CharacterMapping.Character))
|
||||
{
|
||||
if (Text.Length == MaxCharacters) return false;
|
||||
if (e.Shift)
|
||||
{
|
||||
Text = Text.Insert(_caretIndex, e.CharacterMapping.Shifted.ToString());
|
||||
if (_caretIndex < _text.Length) _caretIndex++;
|
||||
SetVisibleText();
|
||||
}
|
||||
else
|
||||
{
|
||||
Text = Text.Insert(_caretIndex, e.CharacterMapping.Character.ToString());
|
||||
if (_caretIndex < _text.Length) _caretIndex++;
|
||||
SetVisibleText();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -49,8 +50,8 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
BuildTileList();
|
||||
|
||||
Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f));
|
||||
Position = new Point((int) (CluwneLib.CurrentRenderTarget.Size.X/2f) - (int) (ClientArea.Width/2f),
|
||||
(int) (CluwneLib.CurrentRenderTarget.Size.Y/2f) - (int) (ClientArea.Height/2f));
|
||||
_placementManager.PlacementCanceled += PlacementManagerPlacementCanceled;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ using System;
|
||||
using System.Drawing;
|
||||
using SFML.Window;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
using VertexFieldContext = SS14.Client.Graphics.CluwneLib.Vertex.VertexEnums.VertexFieldContext;
|
||||
using VertexFieldType = SS14.Client.Graphics.CluwneLib.Vertex.VertexEnums.VertexFieldType;
|
||||
using SS14.Client.Graphics.CluwneLib.Vertex;
|
||||
using VertexFieldContext = SS14.Client.Graphics.CluwneLib.VertexData.VertexEnums.VertexFieldContext;
|
||||
using VertexFieldType = SS14.Client.Graphics.CluwneLib.VertexData.VertexEnums.VertexFieldType;
|
||||
using SS14.Client.Graphics.CluwneLib.VertexData;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -53,13 +53,13 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
|
||||
public override void Render()
|
||||
{
|
||||
_sprite.Color = _color;
|
||||
_sprite.Color = new SFML.Graphics.Color(_color.R, _color.G, _color.B, _color.A); ;
|
||||
_sprite.Draw(new Rectangle(Position, new Size((int) _sprite.AABB.Width, (int) _sprite.AABB.Height)));
|
||||
if (_entSprite != null)
|
||||
_entSprite.Draw(new Rectangle((int) (Position.X + _sprite.AABB.Width/2f - _entSprite.AABB.Width/2f),
|
||||
(int) (Position.Y + _sprite.AABB.Height/2f - _entSprite.AABB.Height/2f),
|
||||
(int) _entSprite.Width, (int) _entSprite.Height));
|
||||
_sprite.Color = Color.White;
|
||||
_sprite.Color = new SFML.Graphics.Color(Color.White.R, Color.White.G, Color.White.B, Color.White.A);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
@@ -70,7 +70,7 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
ResetEntity();
|
||||
return true;
|
||||
@@ -80,7 +80,7 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (_userInterfaceManager.DragInfo.IsEntity && _userInterfaceManager.DragInfo.IsActive)
|
||||
{
|
||||
@@ -94,7 +94,7 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
|
||||
public override void MouseMove(MouseMoveEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
_color = Color.LightSteelBlue;
|
||||
else
|
||||
_color = Color.White;
|
||||
|
||||
@@ -11,6 +11,7 @@ using System;
|
||||
using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using SFML.Window;
|
||||
using SS14.Shared.Maths;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Inventory
|
||||
{
|
||||
@@ -59,7 +60,7 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
|
||||
public override sealed void Update(float frameTime)
|
||||
{
|
||||
_buttonSprite.Position = Position;
|
||||
_buttonSprite.Position = new Vector2(Position.X,Position.Y);
|
||||
ClientArea = new Rectangle(Position,
|
||||
new Size((int) _buttonSprite.AABB.Width, (int) _buttonSprite.AABB.Height));
|
||||
|
||||
@@ -88,10 +89,10 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
|
||||
public override void Render()
|
||||
{
|
||||
_buttonSprite.Color = _color;
|
||||
_buttonSprite.Position = Position;
|
||||
_buttonSprite.Color = new SFML.Graphics.Color(_color.R, _color.G, _color.B);
|
||||
_buttonSprite.Position = new Vector2(Position.X,Position.Y);
|
||||
_buttonSprite.Draw();
|
||||
_buttonSprite.Color = Color.White;
|
||||
_buttonSprite.Color = new SFML.Graphics.Color(Color.White.R, Color.White.G, Color.White.B); ;
|
||||
|
||||
if (_currentEntSprite != null && CurrentEntity != null)
|
||||
_currentEntSprite.Draw(
|
||||
@@ -112,7 +113,7 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (_playerManager.ControlledEntity == null)
|
||||
return false;
|
||||
@@ -130,7 +131,7 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (_playerManager.ControlledEntity == null)
|
||||
return false;
|
||||
@@ -160,7 +161,7 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
|
||||
public override void MouseMove(MouseMoveEventArgs e)
|
||||
{
|
||||
_color = ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y))
|
||||
_color = ClientArea.Contains(new Point((int) e.X, (int) e.Y))
|
||||
? Color.LightSteelBlue
|
||||
: Color.White;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using SS14.Client.Graphics.CluwneLib.Sprite;
|
||||
using SFML.Window;
|
||||
using SS14.Shared.Maths;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Inventory
|
||||
{
|
||||
@@ -292,7 +293,7 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
|
||||
public override bool KeyDown(KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == KeyboardKeys.I)
|
||||
if (e.Code == Keyboard.Key.I)
|
||||
{
|
||||
_showTabbedWindow = !_showTabbedWindow;
|
||||
_craftStatus.Text = "Status";
|
||||
@@ -514,12 +515,12 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
_inventory = new InventoryViewer(invComp, _userInterfaceManager, _resourceManager);
|
||||
}
|
||||
|
||||
_comboBg.Position = Position;
|
||||
_comboBg.Position = new Vector2 (Position.X, Position.Y);
|
||||
|
||||
Point equipBgPos = Position;
|
||||
_equipBg.Position = Position;
|
||||
_equipBg.Position = new Vector2 (Position.X,Position.Y);
|
||||
equipBgPos.Offset((int) (_comboBg.AABB.Width/2f - _equipBg.AABB.Width/2f), 40);
|
||||
_equipBg.Position = equipBgPos;
|
||||
_equipBg.Position = new Vector2(equipBgPos.X,equipBgPos.Y);
|
||||
|
||||
Point comboClosePos = Position;
|
||||
comboClosePos.Offset(264, 11); //Magic photoshop ruler numbers.
|
||||
@@ -529,19 +530,19 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
Point tabEquipPos = Position;
|
||||
tabEquipPos.Offset(-26, 76); //Magic photoshop ruler numbers.
|
||||
_tabEquip.Position = tabEquipPos;
|
||||
_tabEquip.Color = _currentTab == 1 ? Color.White : _inactiveColor;
|
||||
_tabEquip.Color = _currentTab == 1 ? new SFML.Graphics.Color(Color.White.R, Color.White.G, Color.White.B) : new SFML.Graphics.Color(_inactiveColor.R, _inactiveColor.G, _inactiveColor.B);
|
||||
_tabEquip.Update(frameTime);
|
||||
|
||||
Point tabHealthPos = tabEquipPos;
|
||||
tabHealthPos.Offset(0, 3 + _tabEquip.ClientArea.Height);
|
||||
_tabHealth.Position = tabHealthPos;
|
||||
_tabHealth.Color = _currentTab == 2 ? Color.White : _inactiveColor;
|
||||
_tabHealth.Color = _currentTab == 2 ? new SFML.Graphics.Color(Color.White.R, Color.White.G, Color.White.B) : new SFML.Graphics.Color(_inactiveColor.R, _inactiveColor.G, _inactiveColor.B);
|
||||
_tabHealth.Update(frameTime);
|
||||
|
||||
Point tabCraftPos = tabHealthPos;
|
||||
tabCraftPos.Offset(0, 3 + _tabHealth.ClientArea.Height);
|
||||
_tabCraft.Position = tabCraftPos;
|
||||
_tabCraft.Color = _currentTab == 3 ? Color.White : _inactiveColor;
|
||||
_tabCraft.Color = _currentTab == 3 ? new SFML.Graphics.Color(Color.White.R, Color.White.G, Color.White.B) : new SFML.Graphics.Color(_inactiveColor.R, _inactiveColor.G,_inactiveColor.B);
|
||||
_tabCraft.Update(frameTime);
|
||||
|
||||
ClientArea = new Rectangle(Position.X, Position.Y, (int) _comboBg.AABB.Width, (int) _comboBg.AABB.Height);
|
||||
@@ -770,7 +771,7 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
var mouseAABB = new PointF(e.Position.X, e.Position.Y);
|
||||
var mouseAABB = new PointF(e.X, e.Y);
|
||||
|
||||
switch (_currentTab)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
|
||||
public override void Render()
|
||||
{
|
||||
_slotSprite.Color = _currentColor;
|
||||
_slotSprite.Color = new SFML.Graphics.Color(_currentColor.R, _currentColor.G, _currentColor.B, _currentColor.A); ;
|
||||
_slotSprite.Draw(new Rectangle(Position,
|
||||
new Size((int) _slotSprite.AABB.Width, (int) _slotSprite.AABB.Height)));
|
||||
if (_entitySprite != null)
|
||||
@@ -50,7 +50,7 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
new Rectangle((int) (Position.X + _slotSprite.AABB.Width/2f - _entitySprite.AABB.Width/2f),
|
||||
(int) (Position.Y + _slotSprite.AABB.Height/2f - _entitySprite.AABB.Height/2f),
|
||||
(int) _entitySprite.Width, (int) _entitySprite.Height));
|
||||
_slotSprite.Color = Color.White;
|
||||
_slotSprite.Color = new SFML.Graphics.Color(Color.White.R, Color.White.G, Color.White.B, Color.White.A);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
@@ -61,7 +61,7 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (Clicked != null) Clicked(this);
|
||||
return true;
|
||||
@@ -71,7 +71,7 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
|
||||
public override void MouseMove(MouseMoveEventArgs e)
|
||||
{
|
||||
_currentColor = ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y))
|
||||
_currentColor = ClientArea.Contains(new Point((int) e.X, (int) e.Y))
|
||||
? Color.LightSteelBlue
|
||||
: Color.White;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace SS14.Client.Services.UserInterface.Inventory
|
||||
{
|
||||
//If dropped on container add to inventory.
|
||||
if (_inventoryContainer.MouseUp(e)) return true;
|
||||
if (_inventoryContainer.ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)) &&
|
||||
if (_inventoryContainer.ClientArea.Contains(new Point((int) e.X, (int) e.Y)) &&
|
||||
_userInterfaceManager.DragInfo.IsEntity && _userInterfaceManager.DragInfo.IsActive)
|
||||
{
|
||||
if (!_inventoryComponent.ContainsEntity(_userInterfaceManager.DragInfo.DragEntity))
|
||||
|
||||
@@ -5,6 +5,7 @@ using SFML.Window;
|
||||
using SS14.Shared;
|
||||
using SS14.Shared.IoC;
|
||||
using System.Drawing;
|
||||
using SS14.Client.Graphics.CluwneLib;
|
||||
|
||||
namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
@@ -55,7 +56,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
Sprite = "lobby_depgrad",
|
||||
Color = Color.FromArgb(120, Color.White),
|
||||
BlendingMode = BlendingModes.None
|
||||
// BlendingMode = BlendingModes.None
|
||||
};
|
||||
_imgDepGrad.Update(0);
|
||||
_imgDepGrad.Position = new Point(_shwDepa.ClientArea.X + (int)(_shwDepa.ClientArea.Width / 2f - _imgDepGrad.ClientArea.Width / 2f), _shwDepa.ClientArea.Top);
|
||||
@@ -91,7 +92,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
Sprite = "lobby_jobgrad",
|
||||
Color = Color.FromArgb(120, Color.White),
|
||||
BlendingMode = BlendingModes.None
|
||||
// BlendingMode = BlendingModes.None
|
||||
};
|
||||
_imgJobGrad.Update(0);
|
||||
_imgJobGrad.Position = new Point(_shwJobs.ClientArea.X + (int)(_shwJobs.ClientArea.Width / 2f - _imgJobGrad.ClientArea.Width / 2f), _shwJobs.ClientArea.Top);
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
{
|
||||
protected int ScrollOffset = 0;
|
||||
public Size ItemOffsets = new Size(0,0);
|
||||
private Color ctemp;
|
||||
|
||||
protected override void _buttonRight_Clicked(ImageButton sender)
|
||||
{
|
||||
@@ -90,7 +91,8 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
new Point(ItemOffsets.Width + ClientArea.Left + (int)(ClientArea.Width / 2f - middle.Key.ClientArea.Width / 2f),
|
||||
ItemOffsets.Height + ClientArea.Top + (int)(ClientArea.Height / 2f - middle.Key.ClientArea.Height / 2f));
|
||||
if (FadeItems)
|
||||
middle.Key.Color = Color.FromArgb(255, Color.White);
|
||||
ctemp = Color.FromArgb(255, Color.White);
|
||||
middle.Key.Color = new SFML.Graphics.Color(ctemp.R, ctemp.G, ctemp.B, ctemp.A);
|
||||
|
||||
if (_selectionGlow != null && Selected == ScrollOffset)
|
||||
{
|
||||
@@ -122,7 +124,8 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
}
|
||||
|
||||
if (FadeItems)
|
||||
currLeft.Key.Color = Color.FromArgb((int) (baseAlpha/alphaAdj), Color.White);
|
||||
ctemp = Color.FromArgb((int) (baseAlpha/alphaAdj), Color.White);
|
||||
currLeft.Key.Color = new SFML.Graphics.Color(ctemp.R,ctemp.G,ctemp.B,ctemp.A);
|
||||
|
||||
currLeft.Key.Render();
|
||||
}
|
||||
@@ -141,7 +144,8 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
}
|
||||
|
||||
if (FadeItems)
|
||||
currRight.Key.Color = Color.FromArgb((int) (baseAlpha/alphaAdj), Color.White);
|
||||
ctemp = Color.FromArgb((int) (baseAlpha/alphaAdj), Color.White);
|
||||
currRight.Key.Color = new SFML.Graphics.Color(ctemp.R,ctemp.G,ctemp.B,ctemp.A);
|
||||
|
||||
currRight.Key.Render();
|
||||
}
|
||||
@@ -164,16 +168,16 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseWheelMove(MouseWheelEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (ScrollingNeeded())
|
||||
{
|
||||
if (e.WheelDelta > 0)
|
||||
if (e.Delta> 0)
|
||||
{
|
||||
if (ScrollOffset + 1 <= _items.Count - 1) ScrollOffset++;
|
||||
return true;
|
||||
}
|
||||
else if (e.WheelDelta < 0)
|
||||
else if (e.Delta < 0)
|
||||
{
|
||||
if (ScrollOffset - 1 >= 0) ScrollOffset--;
|
||||
return true;
|
||||
@@ -185,7 +189,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override void MouseMove(MouseMoveEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
_buttonLeft.MouseMove(e);
|
||||
_buttonRight.MouseMove(e);
|
||||
@@ -199,7 +203,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
|
||||
if (ShowArrows && ScrollingNeeded())
|
||||
@@ -237,7 +241,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
|
||||
public override bool MouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ClientArea.Contains(new Point((int) e.Position.X, (int) e.Position.Y)))
|
||||
if (ClientArea.Contains(new Point((int) e.X, (int) e.Y)))
|
||||
{
|
||||
if (_buttonLeft.MouseUp(e)) return true;
|
||||
if (_buttonRight.MouseUp(e)) return true;
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace SS14.Client.Services.UserInterface.Components
|
||||
for (int i = _tabs.Count - 1; i >= 0; i--)
|
||||
{
|
||||
KeyValuePair<ImageButton, TabContainer> curr = _tabs[i];
|
||||
Sprite currTabSprite = curr.Value.tabSprite;
|
||||
CluwneSprite currTabSprite = curr.Value.tabSprite;
|
||||
|
||||
curr.Key.Render();
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace SS14.Client.Services.UserInterface
|
||||
DragInfo = new DragDropInfo();
|
||||
_components = new List<IGuiComponent>();
|
||||
_config = IoCManager.Resolve<IConfigurationManager>();
|
||||
_console = new DebugConsole("dbgConsole", new Size(Gorgon.Screen.Width, 400), resourceManager);
|
||||
_console = new DebugConsole("dbgConsole", new Size((int)VideoMode.DesktopMode.Width, 400), resourceManager);
|
||||
_console.SetVisible(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace SS14.Client
|
||||
#region Fields
|
||||
|
||||
private IConfigurationManager _configurationManager;
|
||||
private Input _input;
|
||||
// private Input _input;
|
||||
private INetworkGrapher _netGrapher;
|
||||
private INetworkManager _networkManager;
|
||||
private IStateManager _stateManager;
|
||||
@@ -205,7 +205,8 @@ namespace SS14.Client
|
||||
|
||||
CluwneLib.Initialize();
|
||||
CluwneLib.SetMode(this, (int) displayWidth, (int) displayHeight, !fullscreen, false, false, refresh);
|
||||
CluwneLib.Screen.BackgroundColor = new Color(255, 50, 50, 50);
|
||||
CluwneLib.Screen.BackgroundColor = new Color(50, 50, 50);
|
||||
|
||||
CluwneLib.Idle += GorgonIdle;
|
||||
}
|
||||
|
||||
|
||||
@@ -517,7 +517,7 @@ namespace SS14.Shared.Maths
|
||||
result.X = (((value1.X * num6) + (value2.X * num5)) + (tangent1.X * num4)) + (tangent2.X * num3);
|
||||
result.Y = (((value1.Y * num6) + (value2.Y * num5)) + (tangent1.Y * num4)) + (tangent2.Y * num3);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Returns a vector pointing in the opposite direction.</summary>
|
||||
/// <param name="value">Source vector.</param>
|
||||
public static Vector2 Negate(Vector2 value)
|
||||
|
||||
11
SS14.Tools.ParticleEditor/CluwneSprite.cs
Normal file
11
SS14.Tools.ParticleEditor/CluwneSprite.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace SS14.Tools.ParticleEditor
|
||||
{
|
||||
class CluwneSprite
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using GorgonLibrary;
|
||||
using GorgonLibrary.Graphics;
|
||||
|
||||
using SS14.Client.GameObjects;
|
||||
using SS14.Client.Services.Resources;
|
||||
using SS14.Shared.Maths;
|
||||
@@ -16,8 +15,8 @@ namespace SS14.Tools.ParticleEditor
|
||||
#region Properties
|
||||
public ParticleConfigurator ParticleConfigurator { get; set; }
|
||||
private ParticleSystem _particleSystem;
|
||||
private Sprite _particleSprite;
|
||||
private GorgonLibrary.Graphics.Image _particleImage;
|
||||
private CluwneSprite _particleSprite;
|
||||
private RenderImage _particleImage;
|
||||
public ResourceManager ResourceManager { get; set; }
|
||||
public ParticleEditorMainForm MainForm { get; set; }
|
||||
#endregion
|
||||
@@ -32,7 +31,7 @@ namespace SS14.Tools.ParticleEditor
|
||||
private void Screen_OnFrameBegin(object sender, FrameEventArgs e)
|
||||
{
|
||||
// Clear the screen.
|
||||
Gorgon.Screen.Clear();
|
||||
CluwneLib.Screen.Clear();
|
||||
_particleSystem.Update(e.FrameDeltaTime);
|
||||
_particleSystem.Render();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user