Skip to content

Commit

Permalink
EditorPage would open and close a map via methods
Browse files Browse the repository at this point in the history
  • Loading branch information
iconstudio committed Oct 6, 2023
1 parent 43c4f2b commit 7e1528a
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions Editor/TestEditor/Infrastructures/EditorPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ public EditorPage()
InitializeComponent();
}

private void Render(CanvasDrawingSession context)
private void OpenMap(in Map map)
{
using (context)
{
context.Clear(flushColour);

context.DrawEllipse(155, 115, 80, 30, Colors.Black, 3);
context.DrawText("Hello, Win2D world!", 100, 100, Colors.Yellow);
}
CurrentMap = map;
}
private void CloseCurrentMap()
{
CurrentMap = null;
}
private async void ProcessTransition(EditorTransitionCategory cat)
{
Expand Down Expand Up @@ -79,7 +77,7 @@ private async void ProcessTransition(EditorTransitionCategory cat)
{
Debug.Print($"A map '{map.Name}' is loaded");

CurrentMap = map;
OpenMap(map);
}
else
{
Expand All @@ -90,14 +88,24 @@ private async void ProcessTransition(EditorTransitionCategory cat)

case EditorTransitionCategory.Exit:
{
CurrentMap = null;
CloseCurrentMap();
}
break;

default:
break;
}
}
private void Render(CanvasDrawingSession context)
{
using (context)
{
context.Clear(flushColour);

context.DrawEllipse(155, 115, 80, 30, Colors.Black, 3);
context.DrawText("Hello, Win2D world!", 100, 100, Colors.Yellow);
}
}

private LRESULT EditorHook(HWND hwnd, uint msg, WPARAM wparam, LPARAM lparam, nuint id, nuint refdata)
{
Expand Down

0 comments on commit 7e1528a

Please sign in to comment.