Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Windows - Version 1.0 actives
Browse files Browse the repository at this point in the history
  • Loading branch information
Phoenixfirewingz committed May 2, 2023
1 parent 25b912d commit d0c92c5
Show file tree
Hide file tree
Showing 28 changed files with 1,360 additions and 586 deletions.
857 changes: 857 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

87 changes: 83 additions & 4 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,83 @@
using SquareSmash.client;
Client c = new();
c.Run();
Console.ReadLine();
using OpenTK.Graphics.ES30;
using OpenTK.Windowing.Common;
using OpenTK.Windowing.Desktop;
using SquareSmash.objects;
using SquareSmash.objects.components;
using SquareSmash.renderer;

namespace SquareSmash
{
internal class Client : GameWindow
{
public static readonly int Width = 720;
public static readonly int Height = 640;
private long PreviousTime { get; set; }
public QuadBatchRenderer Renderer { get; private set; }
public Paddle paddle;
public Level level;
/*private static readonly DebugProc DebugMessageDelegate = OnDebugMessage;
private static void OnDebugMessage(DebugSource source,DebugType type,int id,DebugSeverity severity,int length,IntPtr pMessage,IntPtr pUserParam)
{
string message = Marshal.PtrToStringAnsi(pMessage, length);
Console.WriteLine("[{0} source={1} type={2} id={3}] {4}", severity, source, type, id, message);
if (type == DebugType.DebugTypeError)
throw new Exception(message);
}*/

public Client()
: base(GameWindowSettings.Default, new()
{
Size = new(Width, Height),
Title = "DISCout",
Flags = ContextFlags.ForwardCompatible,
MinimumSize = new(Width, Height),
MaximumSize = new(Width, Height)
})
{
//GL.DebugMessageCallback(DebugMessageDelegate, IntPtr.Zero);
Renderer = new();
paddle = new();
level = new();
PreviousTime = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
GL.ClearColor(0, 0, 0, 1);
}
public void LevelWon()
{
level = new Level();
}

protected override void OnUnload()
{
Renderer.Flush();
base.OnUnload();
}

protected override void OnUpdateFrame(FrameEventArgs args)
{
base.OnUpdateFrame(args);
long currentTime = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
long DeltaTime = (currentTime - PreviousTime);
PreviousTime = currentTime;
paddle?.OnUpdate(this, DeltaTime);
level?.OnUpdate(this, DeltaTime);
}

protected override void OnRenderFrame(FrameEventArgs args)
{
base.OnRenderFrame(args);
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
paddle?.OnRendering(Renderer);
level?.OnRendering(Renderer);
Renderer.Flush();
SwapBuffers();
}
}
static class ProgramMain
{
public static void Main()
{
Client client = new();
client.Run();
}
}
}
108 changes: 0 additions & 108 deletions client/Client.cs

This file was deleted.

22 changes: 0 additions & 22 deletions client/Utils/CollisionUtil.cs

This file was deleted.

24 changes: 0 additions & 24 deletions client/objects/GameObjects.cs

This file was deleted.

60 changes: 0 additions & 60 deletions client/objects/Level.cs

This file was deleted.

66 changes: 0 additions & 66 deletions client/objects/components/Ball.cs

This file was deleted.

Loading

0 comments on commit d0c92c5

Please sign in to comment.