new scene and game template

This commit is contained in:
Mike 2019-09-20 22:26:15 -07:00
parent ab8debb952
commit f1b2278849
2 changed files with 6 additions and 9 deletions

View File

@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Nez;
using Nez.Sprites;
namespace project_name
{
@ -10,8 +11,6 @@ namespace project_name
{
SetDesignResolution(Screen.Width, Screen.Height, Scene.SceneResolutionPolicy.None);
AddRenderer(new DefaultRenderer());
CreateEntity("demo imgui draw commands")
.SetPosition(new Vector2(150, 150))
.AddComponent<DemoComponent>()
@ -20,7 +19,7 @@ namespace project_name
var logo = Content.Load<Texture2D>("nez-logo-black");
CreateEntity("logo")
.SetPosition(Screen.Center)
.AddComponent(new Nez.Sprites.Sprite(logo));
.AddComponent(new SpriteRenderer(logo));
}
}
}

View File

@ -8,24 +8,22 @@ namespace project_name
public Game1() : base()
{
// uncomment this line for scaled pixel art games
//Environment.SetEnvironmentVariable("FNA_OPENGL_BACKBUFFER_SCALE_NEAREST", "1");
// System.Environment.SetEnvironmentVariable("FNA_OPENGL_BACKBUFFER_SCALE_NEAREST", "1");
}
override protected void Initialize()
{
base.Initialize();
#if DEBUG
System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(System.Console.Out));
#endif
Scene = new DefaultScene();
#if DEBUG
System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(System.Console.Out));
// optionally render Nez in an ImGui window
var imGuiManager = new ImGuiManager();
Core.RegisterGlobalManager(imGuiManager);
#if DEBUG
// optionally load up ImGui DLL if not using the above setup so that its command gets loaded in the DebugConsole
//System.Reflection.Assembly.Load("Nez.ImGui")
#endif