Skip to content

Commit e753145

Browse files
committed
Tile Viewer
1 parent c33ba8c commit e753145

File tree

9 files changed

+63
-5
lines changed

9 files changed

+63
-5
lines changed

Canvas.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ public virtual void ProcessTasks()
253253
{
254254
LoadData();
255255
taskManager.Add(EditorTasks.ReloadPicker);
256+
taskManager.Add(EditorTasks.ReloadTileViewer);
256257
}
257258

258259
if (taskManager .Pop(EditorTasks.OverworldBlueMap, out task))

EditorTasks.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ public enum EditorTasks
9595
ToggleLayer,
9696
ToggleDrawingLayer,
9797
ToggleInfoBox,
98+
ToggleTileViewer,
99+
ReloadTileViewer,
98100

99101
ResizeMap,
100102
ResizeToggle,

Game1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace FFRMapEditorMono
1515
public class Game1 : Game
1616
{
1717
// Set mode to switch between FFR or FFMQ editing mode
18-
private GameMode gameMode = GameMode.FFR;
18+
private GameMode gameMode = GameMode.FFMQ;
1919
private GraphicsDeviceManager _graphics;
2020
private SpriteBatch _spriteBatch;
2121

MysticQuest/CanvasMQ.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public class CanvasMQ : Canvas
7878

7979
private Texture2D pixelTexture;
8080
private RenderTarget2D tilesGraphics;
81+
public Texture2D TilesGraphics => (Texture2D)tilesGraphics;
8182

8283
// Globals
8384
private MapAttributes attributes;

MysticQuest/EditorModeMQ.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ public override void LoadContent(ContentManager content, GraphicsDevice graphics
5858
OptionPickers = new()
5959
{
6060
new TilePickerMQ(textures["selectors16"], textures["placingicons"], Canvas, font, SpriteBatch, TaskManager, Mouse),
61-
new MapResize(textures["resizeicons"], textures["selectors32"], font, SpriteBatch, TaskManager, Mouse)
61+
new MapResize(textures["resizeicons"], textures["selectors32"], font, SpriteBatch, TaskManager, Mouse),
62+
new TilesViewer(textures["selectors16"], textures["placingicons"], Canvas, font, SpriteBatch, TaskManager, Mouse),
6263
};
6364

6465
// Warning Windows

MysticQuest/TilesGraphicView.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using Microsoft.Xna.Framework.Graphics;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using Microsoft.Xna.Framework;
8+
9+
namespace FFRMapEditorMono.MysticQuest
10+
{
11+
public class TilesViewer : OptionPicker
12+
{
13+
private CanvasMQ canvas;
14+
public TilesViewer(Texture2D _selector, Texture2D _placedicons, CanvasMQ _canvas, SpriteFont _font, SpriteBatch _spriteBatch, TaskManager _tasks, MouseState _mouse) : base(_font, _spriteBatch, _tasks, _mouse)
15+
{
16+
optionsWindow = _canvas.TilesGraphics;
17+
optionSelector = _selector;
18+
optionIcons = _placedicons;
19+
canvas = _canvas;
20+
21+
Show = false;
22+
ToggleTask = EditorTasks.ToggleTileViewer;
23+
Position = new Vector2(64, 0);
24+
zoom = 2.0f;
25+
optionsRows = 0x08;
26+
optionsColumns = 0x20;
27+
optionsSize = 8;
28+
29+
options = new();
30+
/*
31+
var tiles = _canvas.Tiles;
32+
options = tiles.Select((t, i) => ($"{t.PropertyByte1:X2} {t.PropertyByte2:X2}",
33+
new List<EditorTask>() { },
34+
new List<EditorTask>() )).ToList();*/
35+
36+
//SetOptionTextLength();
37+
lastSelection = 0x00;
38+
placedOptions = new();
39+
unplacedOptions = new();
40+
showPlaced = false;
41+
}
42+
public override void ProcessTasks()
43+
{
44+
EditorTask task;
45+
46+
if (taskManager.Pop(EditorTasks.ReloadTileViewer, out task))
47+
{
48+
optionsWindow = canvas.TilesGraphics;
49+
}
50+
51+
}
52+
}
53+
}

MysticQuest/Tools.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void UpdateGridSize(int size)
5353
("Toggle Layer", new() { new EditorTask(EditorTasks.ToggleLayer, 1) }, new() { new EditorTask(EditorTasks.ToggleLayer, -1) }),
5454
("Resize", new() { new EditorTask(EditorTasks.ResizeToggle) }, new() { new EditorTask(EditorTasks.None) }),
5555
("Selector", new() { new EditorTask(EditorTasks.SelectorSetTool) }, new() { new EditorTask(EditorTasks.None) }),
56-
("Docks", new() { new EditorTask(EditorTasks.DocksOpen), new EditorTask(EditorTasks.DocksSetTool) }, new() { new EditorTask(EditorTasks.None) }),
56+
("Tile Viewer", new() { new EditorTask(EditorTasks.ToggleTileViewer) }, new()),
5757
("MapObjects", new() { new EditorTask(EditorTasks.MapObjectsOpen), new EditorTask(EditorTasks.MapObjectsSetTool) }, new() { new EditorTask(EditorTasks.None) }),
5858
("Undo", new() { new EditorTask(EditorTasks.PaintingUndo) }, new() ),
5959
("Redo", new() { new EditorTask(EditorTasks.PaintingRedo) }, new() ),

WindowsManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public void ProcessTasks(TaskManager tasks)
172172

173173
static List<EditorTasks> toggleTaskToType = new()
174174
{
175-
EditorTasks.BrushesToggle, EditorTasks.TilesToggle, EditorTasks.ResizeToggle
175+
EditorTasks.BrushesToggle, EditorTasks.TilesToggle, EditorTasks.ResizeToggle, EditorTasks.ToggleTileViewer
176176

177177
};
178178
static Dictionary<EditorTasks, List<Type>> openTaskToType = new()

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Source code at
2323
1.05: - Add Selection and Copy/Paste.
2424
1.04: - Add Gridlines and Coordinates options.
2525
1.03: - Fixed FFR locations error at import.
26-
1.02: - Added Undo/Redo options for paiting actions on the map.
26+
1.02: - Added Undo/Redo options for painting actions on the map.
2727
- Added automatic backup ("backupowmap.json" in root folder)
2828
1.01: - Added safeguards to New Map and Load Map functions.
2929
- New Map now clear Map Objects.

0 commit comments

Comments
 (0)