Skip to content

Commit

Permalink
Renamed Vector2Int to Vector2i
Browse files Browse the repository at this point in the history
  • Loading branch information
Tornado-Technology committed Aug 29, 2024
1 parent 5fa1896 commit 9250327
Show file tree
Hide file tree
Showing 25 changed files with 144 additions and 142 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public sealed class TextureManager : ITextureManager
{
[Dependency] private readonly IResourceLoader _resourceLoader = default!;

public ITexture CreateBlank(Vector2Int size, Color color)
public ITexture CreateBlank(Vector2i size, Color color)
{
var data = new byte[size.X * size.Y * 4];

Expand Down
4 changes: 2 additions & 2 deletions Hypercube.Client/Graphics/Viewports/Camera2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ public sealed class Camera2D : ICamera
public Vector3 Position => _transform.Position;
public Vector3 Rotation => _transform.Rotation.ToEuler();
public Vector3 Scale => _transform.Scale;
public Vector2Int Size { get; private set; }
public Vector2i Size { get; private set; }

private readonly float _zFar;
private readonly float _zNear;

private Transform3 _transform = new();

public Camera2D(Vector2Int size, Vector2 position, float zNear, float zFar)
public Camera2D(Vector2i size, Vector2 position, float zNear, float zFar)
{
Size = size;
_zNear = zNear;
Expand Down
4 changes: 2 additions & 2 deletions Hypercube.Client/Graphics/Viewports/CameraManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ public void SetMainCamera(ICamera camera)
MainCamera = camera;
}

public ICamera CreateCamera2D(Vector2Int size)
public ICamera CreateCamera2D(Vector2i size)
{
return CreateCamera2D(size, Vector2.Zero);
}

public ICamera CreateCamera2D(Vector2Int size, Vector2 position, float zNear = 0.1f, float zFar = 100f)
public ICamera CreateCamera2D(Vector2i size, Vector2 position, float zNear = 0.1f, float zFar = 100f)
{
return new Camera2D(size, position, zNear, zFar);
}
Expand Down
2 changes: 1 addition & 1 deletion Hypercube.Client/Graphics/Viewports/ICamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public interface ICamera
Vector3 Position { get; }
Vector3 Rotation { get; }
Vector3 Scale { get; }
Vector2Int Size { get; }
Vector2i Size { get; }

void SetPosition(Vector3 position);
void SetRotation(Vector3 rotation);
Expand Down
2 changes: 1 addition & 1 deletion Hypercube.Client/Graphics/Viewports/ICameraManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public interface ICameraManager


void SetMainCamera(ICamera camera);
ICamera CreateCamera2D(Vector2Int size);
ICamera CreateCamera2D(Vector2i size);
void UpdateInput(ICamera? camera, float delta);
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public sealed class GlfwMonitorRegistration : MonitorHandle
public readonly Monitor* Pointer;


public GlfwMonitorRegistration(MonitorId id, string name, Vector2Int size, int refreshRate, VideoMode[] videoModes, Monitor* pointer) : base(id, name, size, refreshRate, videoModes)
public GlfwMonitorRegistration(MonitorId id, string name, Vector2i size, int refreshRate, VideoMode[] videoModes, Monitor* pointer) : base(id, name, size, refreshRate, videoModes)
{
Pointer = pointer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public void WindowSetTitle(WindowHandle window, string title)

public void WindowSetMonitor(WindowHandle window, MonitorHandle registration)
{
WindowSetMonitor(window, registration, Vector2Int.Zero);
WindowSetMonitor(window, registration, Vector2i.Zero);
}

public void WindowRequestAttention(WindowHandle window)
Expand All @@ -217,7 +217,7 @@ public void WindowRequestAttention(WindowHandle window)
OpenTK.Windowing.GraphicsLibraryFramework.GLFW.RequestWindowAttention(glfwWindow);
}

public void WindowSetSize(WindowHandle window, Vector2Int size)
public void WindowSetSize(WindowHandle window, Vector2i size)
{
if (window is not GlfwWindowHandle glfwWindow)
return;
Expand Down Expand Up @@ -247,7 +247,7 @@ public void WindowSetOpacity(WindowHandle window, float opacity)
OpenTK.Windowing.GraphicsLibraryFramework.GLFW.SetWindowOpacity(glfwWindow, opacity);
}

public void WindowSetPosition(WindowHandle window, Vector2Int position)
public void WindowSetPosition(WindowHandle window, Vector2i position)
{
if (window is not GlfwWindowHandle glfwWindow)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public nint GetProcAddress(string procName)
return OpenTK.Windowing.GraphicsLibraryFramework.GLFW.GetProcAddress(procName);
}

public void WindowSetMonitor(WindowHandle window, MonitorHandle monitor, Vector2Int vector)
public void WindowSetMonitor(WindowHandle window, MonitorHandle monitor, Vector2i vector)
{
if (monitor is not GlfwMonitorRegistration glfwMonitor)
return;
Expand Down
6 changes: 3 additions & 3 deletions Hypercube.Graphics/Monitors/MonitorHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ public class MonitorHandle
{
public MonitorId Id { get; }
public string Name { get; }
public Vector2Int Size { get; }
public Vector2i Size { get; }
public int RefreshRate { get; }
public VideoMode[] VideoModes { get; }

public MonitorHandle(MonitorId id, string name, Vector2Int size, int refreshRate, VideoMode[] videoModes)
public MonitorHandle(MonitorId id, string name, Vector2i size, int refreshRate, VideoMode[] videoModes)
{
Id = id;
Name = name;
Expand All @@ -25,7 +25,7 @@ public MonitorHandle(MonitorId id, string name, int width, int height, int refre
{
Id = id;
Name = name;
Size = new Vector2Int(width, height);
Size = new Vector2i(width, height);
RefreshRate = refreshRate;
VideoModes = videoModes;
}
Expand Down
2 changes: 1 addition & 1 deletion Hypercube.Graphics/Shaders/IShaderProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public interface IShaderProgram : IDisposable
void SetUniform(string name, double value);

void SetUniform(string name, Vector2 value);
void SetUniform(string name, Vector2Int value);
void SetUniform(string name, Vector2i value);
void SetUniform(string name, Vector3 value);

void SetUniform(string name, Matrix3X3 value, bool transpose = false);
Expand Down
2 changes: 1 addition & 1 deletion Hypercube.Graphics/Texturing/ITextureManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Hypercube.Graphics.Texturing;
[PublicAPI]
public interface ITextureManager
{
ITexture CreateBlank(Vector2Int size, Color color);
ITexture CreateBlank(Vector2i size, Color color);
ITexture CreateTexture(ResourcePath path);

ITextureHandle CreateTextureHandle(ITexture texture);
Expand Down
4 changes: 2 additions & 2 deletions Hypercube.Graphics/Texturing/Texture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Hypercube.Graphics.Texturing;
public const int PixelPerUnit = 32;

public ResourcePath Path { get; }
public Vector2Int Size { get; }
public Vector2i Size { get; }

public byte[] Data { get; }

Expand All @@ -27,7 +27,7 @@ public Box2 Quad
}
}

public Texture(ResourcePath path, Vector2Int size, byte[] data)
public Texture(ResourcePath path, Vector2i size, byte[] data)
{
Path = path;
Size = size;
Expand Down
6 changes: 3 additions & 3 deletions Hypercube.Graphics/Windowing/IWindowing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ public interface IWindowing : IDisposable
void WindowDestroy(WindowHandle window);
void WindowSetTitle(WindowHandle window, string title);
void WindowSetMonitor(WindowHandle window, MonitorHandle monitor);
void WindowSetMonitor(WindowHandle window, MonitorHandle monitor, Vector2Int vector2Int);
void WindowSetMonitor(WindowHandle window, MonitorHandle monitor, Vector2i vector2I);
void WindowRequestAttention(WindowHandle window);
void WindowSetOpacity(WindowHandle window, float opacity);
void WindowSetVisible(WindowHandle window, bool visible);
void WindowSetSize(WindowHandle window, Vector2Int size);
void WindowSetPosition(WindowHandle window, Vector2Int position);
void WindowSetSize(WindowHandle window, Vector2i size);
void WindowSetPosition(WindowHandle window, Vector2i position);
void WindowSwapBuffers(WindowHandle window);
void WindowSetIcons(WindowHandle window, List<ITexture> images);

Expand Down
2 changes: 1 addition & 1 deletion Hypercube.Graphics/Windowing/WindowCreateSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public sealed class WindowCreateSettings
public int Height => Size.Y;

public string Title { get; init; } = "Hypercube Window";
public Vector2Int Size { get; init; } = new(1280, 720);
public Vector2i Size { get; init; } = new(1280, 720);

public ITexture[]? WindowImages { get; init; }
public MonitorHandle? Monitor { get; init; }
Expand Down
8 changes: 4 additions & 4 deletions Hypercube.Graphics/Windowing/WindowHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ public abstract class WindowHandle
public bool DisposeOnClose { get; }
public bool IsDisposed { get; }
public float Ratio { get; init; }
public Vector2Int Size { get; set; }
public Vector2Int FramebufferSize { get; init; }
public Vector2i Size { get; set; }
public Vector2i FramebufferSize { get; init; }

protected WindowHandle(WindowId id, nint pointer)
{
Id = id;
Pointer = pointer;
}

public void SetSize(Vector2Int size)
public void SetSize(Vector2i size)
{
Size = size;
}

public void SetSize(int width, int height)
{
Size = new Vector2Int(width, height);
Size = new Vector2i(width, height);
}

public override string ToString()
Expand Down
2 changes: 1 addition & 1 deletion Hypercube.ImGui/IImGuiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface IImGuiController : IImGui
void Render();

void InputFrame();
void UpdateMousePosition(Vector2Int position);
void UpdateMousePosition(Vector2i position);
void UpdateKey(Key key, KeyState state, KeyModifiers modifiers);
void UpdateMouseButtons(MouseButton button, KeyState state, KeyModifiers modifiers);
void UpdateMouseScroll(Vector2 offset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void InputFrame()
{
}

public void UpdateMousePosition(Vector2Int position)
public void UpdateMousePosition(Vector2i position)
{
_io.MousePos = position;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private void Render(ImDrawDataPtr data)
if (data.CmdListsCount == 0)
return;

var frameBufferSize = new Vector2Int(
var frameBufferSize = new Vector2i(
data.DisplaySize.X * data.FramebufferScale.X,
data.DisplaySize.Y * data.FramebufferScale.Y);

Expand Down Expand Up @@ -128,7 +128,7 @@ private void Render(ImDrawDataPtr data)
GL.Disable(EnableCap.ScissorTest);
}

private void SetupRender(ImDrawDataPtr data, Vector2Int frameBufferSize)
private void SetupRender(ImDrawDataPtr data, Vector2i frameBufferSize)
{
GL.Enable(EnableCap.Blend);
GL.Enable(EnableCap.ScissorTest);
Expand Down
4 changes: 2 additions & 2 deletions Hypercube.Mathematics/Vectors/Vector2.Compatibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ public readonly partial struct Vector2
*/

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Vector2Int(Vector2 vector)
public static implicit operator Vector2i(Vector2 vector)
{
return new Vector2Int((int)vector.X, (int)vector.Y);
return new Vector2i((int)vector.X, (int)vector.Y);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

namespace Hypercube.Mathematics.Vectors;

public readonly partial struct Vector2Int
public readonly partial struct Vector2i
{
/*
* Self Compatibility
*/

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Vector2(Vector2Int vector)
public static implicit operator Vector2(Vector2i vector)
{
return new Vector2(vector.X, vector.Y);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Vector3(Vector2Int vector)
public static implicit operator Vector3(Vector2i vector)
{
return new Vector3(vector.X, vector.Y, 0f);
}
Expand All @@ -25,13 +25,13 @@ public static implicit operator Vector3(Vector2Int vector)
*/

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Vector2Int((int x, int y) a)
public static implicit operator Vector2i((int x, int y) a)
{
return new Vector2Int(a.x, a.y);
return new Vector2i(a.x, a.y);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator (int x, int y)(Vector2Int a)
public static implicit operator (int x, int y)(Vector2i a)
{
return (a.X, a.Y);
}
Expand All @@ -41,13 +41,13 @@ public static implicit operator (int x, int y)(Vector2Int a)
*/

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Vector2Int(System.Numerics.Vector2 vector)
public static implicit operator Vector2i(System.Numerics.Vector2 vector)
{
return new Vector2Int((int)vector.X, (int)vector.Y);
return new Vector2i((int)vector.X, (int)vector.Y);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator System.Numerics.Vector2(Vector2Int vector)
public static implicit operator System.Numerics.Vector2(Vector2i vector)
{
return new System.Numerics.Vector2(vector.X, vector.Y);
}
Expand All @@ -57,13 +57,13 @@ public static implicit operator System.Numerics.Vector2(Vector2Int vector)
*/

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Vector2Int(System.Drawing.Size size)
public static implicit operator Vector2i(System.Drawing.Size size)
{
return new Vector2Int(size.Width, size.Height);
return new Vector2i(size.Width, size.Height);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator System.Drawing.Size(Vector2Int vector2)
public static implicit operator System.Drawing.Size(Vector2i vector2)
{
return new System.Drawing.Size(vector2.X, vector2.Y);
}
Expand All @@ -73,13 +73,13 @@ public static implicit operator System.Drawing.Size(Vector2Int vector2)
*/

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Vector2Int(OpenTK.Mathematics.Vector2i vector)
public static implicit operator Vector2i(OpenTK.Mathematics.Vector2i vector)
{
return new Vector2Int(vector.X, vector.Y);
return new Vector2i(vector.X, vector.Y);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator OpenTK.Mathematics.Vector2i(Vector2Int vector)
public static implicit operator OpenTK.Mathematics.Vector2i(Vector2i vector)
{
return new OpenTK.Mathematics.Vector2i(vector.X, vector.Y);
}
Expand All @@ -89,13 +89,13 @@ public static implicit operator OpenTK.Mathematics.Vector2i(Vector2Int vector)
*/

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Vector2Int(OpenToolkit.Mathematics.Vector2i vector)
public static implicit operator Vector2i(OpenToolkit.Mathematics.Vector2i vector)
{
return new Vector2Int(vector.X, vector.Y);
return new Vector2i(vector.X, vector.Y);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator OpenToolkit.Mathematics.Vector2i(Vector2Int vector)
public static implicit operator OpenToolkit.Mathematics.Vector2i(Vector2i vector)
{
return new OpenToolkit.Mathematics.Vector2i(vector.X, vector.Y);
}
Expand Down
Loading

0 comments on commit 9250327

Please sign in to comment.