1
0
mirror of synced 2024-11-12 02:00:50 +01:00

Add in game render preview setting

This commit is contained in:
KillzXGaming 2019-09-16 21:02:00 -04:00
parent 902bfc4d98
commit 84c81fec96
6 changed files with 98 additions and 39 deletions

View File

@ -174,7 +174,7 @@ namespace LayoutBXLYT
public static void DrawBoundryPane(BasePane pane, byte effectiveAlpha, List<BasePane> SelectedPanes) public static void DrawBoundryPane(BasePane pane, byte effectiveAlpha, List<BasePane> SelectedPanes)
{ {
if (!Runtime.LayoutEditor.DisplayBoundryPane) if (!Runtime.LayoutEditor.DisplayBoundryPane || Runtime.LayoutEditor.IsGamePreview)
return; return;
Vector2[] TexCoords = new Vector2[] { Vector2[] TexCoords = new Vector2[] {
@ -203,7 +203,7 @@ namespace LayoutBXLYT
public static void DrawAlignmentPane(BasePane pane, byte effectiveAlpha, List<BasePane> SelectedPanes) public static void DrawAlignmentPane(BasePane pane, byte effectiveAlpha, List<BasePane> SelectedPanes)
{ {
if (!Runtime.LayoutEditor.DisplayAlignmentPane) if (!Runtime.LayoutEditor.DisplayAlignmentPane || Runtime.LayoutEditor.IsGamePreview)
return; return;
@ -232,7 +232,7 @@ namespace LayoutBXLYT
public static void DrawScissorPane(BasePane pane, byte effectiveAlpha, List<BasePane> SelectedPanes) public static void DrawScissorPane(BasePane pane, byte effectiveAlpha, List<BasePane> SelectedPanes)
{ {
if (!Runtime.LayoutEditor.DisplayScissorPane) if (!Runtime.LayoutEditor.DisplayScissorPane || Runtime.LayoutEditor.IsGamePreview)
return; return;
Vector2[] TexCoords = new Vector2[] { Vector2[] TexCoords = new Vector2[] {
@ -676,6 +676,8 @@ namespace LayoutBXLYT
} }
private static void DrawQuad(float x, float y, float w, float h, Vector2[] texCoords, Color[] colors) private static void DrawQuad(float x, float y, float w, float h, Vector2[] texCoords, Color[] colors)
{
if (!Runtime.LayoutEditor.IsGamePreview)
{ {
GL.Disable(EnableCap.AlphaTest); GL.Disable(EnableCap.AlphaTest);
GL.Disable(EnableCap.Blend); GL.Disable(EnableCap.Blend);
@ -692,6 +694,7 @@ namespace LayoutBXLYT
GL.Enable(EnableCap.AlphaTest); GL.Enable(EnableCap.AlphaTest);
GL.Enable(EnableCap.Blend); GL.Enable(EnableCap.Blend);
}
GL.Begin(PrimitiveType.Quads); GL.Begin(PrimitiveType.Quads);
GL.Color4(colors[0]); GL.Color4(colors[0]);
@ -928,6 +931,11 @@ namespace LayoutBXLYT
} }
else else
{ {
if (!Runtime.LayoutEditor.IsGamePreview)
{
GL.Disable(EnableCap.Blend);
GL.Disable(EnableCap.AlphaTest);
GL.PolygonMode(MaterialFace.Front, PolygonMode.Line); GL.PolygonMode(MaterialFace.Front, PolygonMode.Line);
GL.Enable(EnableCap.LineSmooth); GL.Enable(EnableCap.LineSmooth);
GL.LineWidth(1f); GL.LineWidth(1f);
@ -944,6 +952,10 @@ namespace LayoutBXLYT
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
GL.PolygonOffset(0f, 0f); GL.PolygonOffset(0f, 0f);
GL.Enable(EnableCap.Blend);
GL.Enable(EnableCap.AlphaTest);
}
GL.Begin(PrimitiveType.Quads); GL.Begin(PrimitiveType.Quads);
GL.Color4(colors[0]); GL.Color4(colors[0]);
GL.MultiTexCoord2(TextureUnit.Texture0, texCoords[0].X, texCoords[0].Y); GL.MultiTexCoord2(TextureUnit.Texture0, texCoords[0].X, texCoords[0].Y);

View File

@ -46,6 +46,7 @@
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.renderInGamePreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.textureListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.textureListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.textConverterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.textConverterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.orthographicViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.orthographicViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -53,6 +54,7 @@
this.displayyBoundryPanesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.displayyBoundryPanesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.displayWindowPanesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.displayWindowPanesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.displayPicturePanesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.displayPicturePanesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.displayGridToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.backColorDisplay)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.backColorDisplay)).BeginInit();
this.stToolStrip1.SuspendLayout(); this.stToolStrip1.SuspendLayout();
this.stMenuStrip1.SuspendLayout(); this.stMenuStrip1.SuspendLayout();
@ -211,6 +213,8 @@
// viewToolStripMenuItem // viewToolStripMenuItem
// //
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.renderInGamePreviewToolStripMenuItem,
this.displayGridToolStripMenuItem,
this.textureListToolStripMenuItem, this.textureListToolStripMenuItem,
this.textConverterToolStripMenuItem, this.textConverterToolStripMenuItem,
this.orthographicViewToolStripMenuItem, this.orthographicViewToolStripMenuItem,
@ -222,17 +226,25 @@
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20); this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.viewToolStripMenuItem.Text = "View"; this.viewToolStripMenuItem.Text = "View";
// //
// renderInGamePreviewToolStripMenuItem
//
this.renderInGamePreviewToolStripMenuItem.CheckOnClick = true;
this.renderInGamePreviewToolStripMenuItem.Name = "renderInGamePreviewToolStripMenuItem";
this.renderInGamePreviewToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.renderInGamePreviewToolStripMenuItem.Text = "Render In Game Preview";
this.renderInGamePreviewToolStripMenuItem.Click += new System.EventHandler(this.renderInGamePreviewToolStripMenuItem_Click);
//
// textureListToolStripMenuItem // textureListToolStripMenuItem
// //
this.textureListToolStripMenuItem.Name = "textureListToolStripMenuItem"; this.textureListToolStripMenuItem.Name = "textureListToolStripMenuItem";
this.textureListToolStripMenuItem.Size = new System.Drawing.Size(194, 22); this.textureListToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.textureListToolStripMenuItem.Text = "Texture List"; this.textureListToolStripMenuItem.Text = "Texture List";
this.textureListToolStripMenuItem.Click += new System.EventHandler(this.textureListToolStripMenuItem_Click); this.textureListToolStripMenuItem.Click += new System.EventHandler(this.textureListToolStripMenuItem_Click);
// //
// textConverterToolStripMenuItem // textConverterToolStripMenuItem
// //
this.textConverterToolStripMenuItem.Name = "textConverterToolStripMenuItem"; this.textConverterToolStripMenuItem.Name = "textConverterToolStripMenuItem";
this.textConverterToolStripMenuItem.Size = new System.Drawing.Size(194, 22); this.textConverterToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.textConverterToolStripMenuItem.Text = "Text Converter"; this.textConverterToolStripMenuItem.Text = "Text Converter";
this.textConverterToolStripMenuItem.Click += new System.EventHandler(this.textConverterToolStripMenuItem_Click); this.textConverterToolStripMenuItem.Click += new System.EventHandler(this.textConverterToolStripMenuItem_Click);
// //
@ -242,7 +254,7 @@
this.orthographicViewToolStripMenuItem.CheckOnClick = true; this.orthographicViewToolStripMenuItem.CheckOnClick = true;
this.orthographicViewToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.orthographicViewToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.orthographicViewToolStripMenuItem.Name = "orthographicViewToolStripMenuItem"; this.orthographicViewToolStripMenuItem.Name = "orthographicViewToolStripMenuItem";
this.orthographicViewToolStripMenuItem.Size = new System.Drawing.Size(194, 22); this.orthographicViewToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.orthographicViewToolStripMenuItem.Text = "Orthographic View"; this.orthographicViewToolStripMenuItem.Text = "Orthographic View";
this.orthographicViewToolStripMenuItem.Click += new System.EventHandler(this.orthographicViewToolStripMenuItem_Click); this.orthographicViewToolStripMenuItem.Click += new System.EventHandler(this.orthographicViewToolStripMenuItem_Click);
// //
@ -252,7 +264,7 @@
this.displayNullPanesToolStripMenuItem.CheckOnClick = true; this.displayNullPanesToolStripMenuItem.CheckOnClick = true;
this.displayNullPanesToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.displayNullPanesToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.displayNullPanesToolStripMenuItem.Name = "displayNullPanesToolStripMenuItem"; this.displayNullPanesToolStripMenuItem.Name = "displayNullPanesToolStripMenuItem";
this.displayNullPanesToolStripMenuItem.Size = new System.Drawing.Size(194, 22); this.displayNullPanesToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.displayNullPanesToolStripMenuItem.Text = "Display Null Panes"; this.displayNullPanesToolStripMenuItem.Text = "Display Null Panes";
this.displayNullPanesToolStripMenuItem.Click += new System.EventHandler(this.displayPanesToolStripMenuItem_Click); this.displayNullPanesToolStripMenuItem.Click += new System.EventHandler(this.displayPanesToolStripMenuItem_Click);
// //
@ -262,7 +274,7 @@
this.displayyBoundryPanesToolStripMenuItem.CheckOnClick = true; this.displayyBoundryPanesToolStripMenuItem.CheckOnClick = true;
this.displayyBoundryPanesToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.displayyBoundryPanesToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.displayyBoundryPanesToolStripMenuItem.Name = "displayyBoundryPanesToolStripMenuItem"; this.displayyBoundryPanesToolStripMenuItem.Name = "displayyBoundryPanesToolStripMenuItem";
this.displayyBoundryPanesToolStripMenuItem.Size = new System.Drawing.Size(194, 22); this.displayyBoundryPanesToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.displayyBoundryPanesToolStripMenuItem.Text = "Display Boundry Panes"; this.displayyBoundryPanesToolStripMenuItem.Text = "Display Boundry Panes";
this.displayyBoundryPanesToolStripMenuItem.Click += new System.EventHandler(this.displayPanesToolStripMenuItem_Click); this.displayyBoundryPanesToolStripMenuItem.Click += new System.EventHandler(this.displayPanesToolStripMenuItem_Click);
// //
@ -272,7 +284,7 @@
this.displayWindowPanesToolStripMenuItem.CheckOnClick = true; this.displayWindowPanesToolStripMenuItem.CheckOnClick = true;
this.displayWindowPanesToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.displayWindowPanesToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.displayWindowPanesToolStripMenuItem.Name = "displayWindowPanesToolStripMenuItem"; this.displayWindowPanesToolStripMenuItem.Name = "displayWindowPanesToolStripMenuItem";
this.displayWindowPanesToolStripMenuItem.Size = new System.Drawing.Size(194, 22); this.displayWindowPanesToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.displayWindowPanesToolStripMenuItem.Text = "Display Window Panes"; this.displayWindowPanesToolStripMenuItem.Text = "Display Window Panes";
this.displayWindowPanesToolStripMenuItem.Click += new System.EventHandler(this.displayPanesToolStripMenuItem_Click); this.displayWindowPanesToolStripMenuItem.Click += new System.EventHandler(this.displayPanesToolStripMenuItem_Click);
// //
@ -282,10 +294,18 @@
this.displayPicturePanesToolStripMenuItem.CheckOnClick = true; this.displayPicturePanesToolStripMenuItem.CheckOnClick = true;
this.displayPicturePanesToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.displayPicturePanesToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.displayPicturePanesToolStripMenuItem.Name = "displayPicturePanesToolStripMenuItem"; this.displayPicturePanesToolStripMenuItem.Name = "displayPicturePanesToolStripMenuItem";
this.displayPicturePanesToolStripMenuItem.Size = new System.Drawing.Size(194, 22); this.displayPicturePanesToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.displayPicturePanesToolStripMenuItem.Text = "Display Picture Panes"; this.displayPicturePanesToolStripMenuItem.Text = "Display Picture Panes";
this.displayPicturePanesToolStripMenuItem.Click += new System.EventHandler(this.displayPanesToolStripMenuItem_Click); this.displayPicturePanesToolStripMenuItem.Click += new System.EventHandler(this.displayPanesToolStripMenuItem_Click);
// //
// displayGridToolStripMenuItem
//
this.displayGridToolStripMenuItem.CheckOnClick = true;
this.displayGridToolStripMenuItem.Name = "displayGridToolStripMenuItem";
this.displayGridToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.displayGridToolStripMenuItem.Text = "Display Grid";
this.displayGridToolStripMenuItem.Click += new System.EventHandler(this.displayGridToolStripMenuItem_Click);
//
// LayoutEditor // LayoutEditor
// //
this.AllowDrop = true; this.AllowDrop = true;
@ -341,5 +361,7 @@
private System.Windows.Forms.ToolStripMenuItem displayyBoundryPanesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem displayyBoundryPanesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem displayWindowPanesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem displayWindowPanesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem displayPicturePanesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem displayPicturePanesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem renderInGamePreviewToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem displayGridToolStripMenuItem;
} }
} }

View File

@ -65,6 +65,8 @@ namespace LayoutBXLYT
displayyBoundryPanesToolStripMenuItem.Checked = Runtime.LayoutEditor.DisplayBoundryPane; displayyBoundryPanesToolStripMenuItem.Checked = Runtime.LayoutEditor.DisplayBoundryPane;
displayPicturePanesToolStripMenuItem.Checked = Runtime.LayoutEditor.DisplayPicturePane; displayPicturePanesToolStripMenuItem.Checked = Runtime.LayoutEditor.DisplayPicturePane;
displayWindowPanesToolStripMenuItem.Checked = Runtime.LayoutEditor.DisplayWindowPane; displayWindowPanesToolStripMenuItem.Checked = Runtime.LayoutEditor.DisplayWindowPane;
renderInGamePreviewToolStripMenuItem.Checked = Runtime.LayoutEditor.IsGamePreview;
displayGridToolStripMenuItem.Checked = Runtime.LayoutEditor.DisplayGrid;
ObjectSelected += OnObjectSelected; ObjectSelected += OnObjectSelected;
ObjectChanged += OnObjectChanged; ObjectChanged += OnObjectChanged;
@ -634,8 +636,19 @@ namespace LayoutBXLYT
Runtime.LayoutEditor.DisplayPicturePane = displayPicturePanesToolStripMenuItem.Checked; Runtime.LayoutEditor.DisplayPicturePane = displayPicturePanesToolStripMenuItem.Checked;
Runtime.LayoutEditor.DisplayWindowPane = displayWindowPanesToolStripMenuItem.Checked; Runtime.LayoutEditor.DisplayWindowPane = displayWindowPanesToolStripMenuItem.Checked;
if (ActiveViewport != null) ActiveViewport?.UpdateViewport();
ActiveViewport.UpdateViewport(); }
private void renderInGamePreviewToolStripMenuItem_Click(object sender, EventArgs e)
{
Runtime.LayoutEditor.IsGamePreview = renderInGamePreviewToolStripMenuItem.Checked;
ActiveViewport?.UpdateViewport();
}
private void displayGridToolStripMenuItem_Click(object sender, EventArgs e)
{
Runtime.LayoutEditor.DisplayGrid = displayGridToolStripMenuItem.Checked;
ActiveViewport?.UpdateViewport();
} }
} }
} }

View File

@ -264,7 +264,7 @@ namespace LayoutBXLYT
private void DrawDefaultPane(BasePane pane) private void DrawDefaultPane(BasePane pane)
{ {
if (!Runtime.LayoutEditor.DisplayNullPane) if (!Runtime.LayoutEditor.DisplayNullPane || Runtime.LayoutEditor.IsGamePreview)
return; return;
Vector2[] TexCoords = new Vector2[] { Vector2[] TexCoords = new Vector2[] {
@ -376,6 +376,9 @@ namespace LayoutBXLYT
private void DrawXyLines() private void DrawXyLines()
{ {
if (Runtime.LayoutEditor.IsGamePreview)
return;
int lineLength = 20; int lineLength = 20;
GL.Color3(Color.Green); GL.Color3(Color.Green);
@ -393,6 +396,9 @@ namespace LayoutBXLYT
private void DrawGrid() private void DrawGrid()
{ {
if (!Runtime.LayoutEditor.DisplayGrid)
return;
var size = 40; var size = 40;
var amount = 300; var amount = 300;

View File

@ -270,6 +270,9 @@ namespace Toolbox.Library
case "DisplayWindowPane": case "DisplayWindowPane":
bool.TryParse(node.InnerText, out Runtime.LayoutEditor.DisplayWindowPane); bool.TryParse(node.InnerText, out Runtime.LayoutEditor.DisplayWindowPane);
break; break;
case "LayoutDisplayGrid":
bool.TryParse(node.InnerText, out Runtime.LayoutEditor.DisplayGrid);
break;
} }
} }
@ -389,6 +392,7 @@ namespace Toolbox.Library
layoutSettingsNode.AppendChild(createNode(doc, "LayoutShadingMode", Runtime.LayoutEditor.Shading.ToString())); layoutSettingsNode.AppendChild(createNode(doc, "LayoutShadingMode", Runtime.LayoutEditor.Shading.ToString()));
layoutSettingsNode.AppendChild(createNode(doc, "LayoutBackgroundColor", ColorTranslator.ToHtml(Runtime.LayoutEditor.BackgroundColor))); layoutSettingsNode.AppendChild(createNode(doc, "LayoutBackgroundColor", ColorTranslator.ToHtml(Runtime.LayoutEditor.BackgroundColor)));
layoutSettingsNode.AppendChild(createNode(doc, "IsGamePreview", Runtime.LayoutEditor.IsGamePreview.ToString())); layoutSettingsNode.AppendChild(createNode(doc, "IsGamePreview", Runtime.LayoutEditor.IsGamePreview.ToString()));
layoutSettingsNode.AppendChild(createNode(doc, "LayoutDisplayGrid", Runtime.LayoutEditor.DisplayGrid.ToString()));
layoutSettingsNode.AppendChild(createNode(doc, "DisplayNullPane", Runtime.LayoutEditor.DisplayNullPane.ToString())); layoutSettingsNode.AppendChild(createNode(doc, "DisplayNullPane", Runtime.LayoutEditor.DisplayNullPane.ToString()));
layoutSettingsNode.AppendChild(createNode(doc, "DisplayBoundryPane", Runtime.LayoutEditor.DisplayBoundryPane.ToString())); layoutSettingsNode.AppendChild(createNode(doc, "DisplayBoundryPane", Runtime.LayoutEditor.DisplayBoundryPane.ToString()));
layoutSettingsNode.AppendChild(createNode(doc, "DisplayPicturePane", Runtime.LayoutEditor.DisplayPicturePane.ToString())); layoutSettingsNode.AppendChild(createNode(doc, "DisplayPicturePane", Runtime.LayoutEditor.DisplayPicturePane.ToString()));

View File

@ -47,6 +47,8 @@ namespace Toolbox.Library
public static bool DisplayAlignmentPane = true; public static bool DisplayAlignmentPane = true;
public static bool DisplayScissorPane = true; public static bool DisplayScissorPane = true;
public static bool DisplayGrid = true;
public static Color BackgroundColor = Color.FromArgb(130, 130, 130); public static Color BackgroundColor = Color.FromArgb(130, 130, 130);
public static DebugShading Shading = DebugShading.Default; public static DebugShading Shading = DebugShading.Default;