Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var game = new GuppyLoader()
                       .Initialize()
                       .BuildGame <ExampleGame>();

            game.TryStart(false);
        }
Ejemplo n.º 2
0
        public static T BuildGame <T>(this GuppyLoader guppy, ServiceConfigurationKey?key = null)
            where T : Game
        {
            if (!guppy.Initialized)
            {
                throw new Exception("Please initialize Guppy before building a game instance.");
            }

            return(guppy.BuildServiceProvider().GetService <T>(key ?? ServiceConfigurationKey.From <T>()));
        }
Ejemplo n.º 3
0
        public static GuppyLoader ConfigureMonoGame(this GuppyLoader loader, GraphicsDeviceManager graphics, ContentManager content, GameWindow window)
        {
            loader.Services.RegisterSingleton <GraphicsDeviceManager>(graphics);
            loader.Services.RegisterSingleton <ContentManager>(content);
            loader.Services.RegisterSingleton <GameWindow>(window);
            loader.Services.RegisterSingleton <GraphicsDevice>(graphics.GraphicsDevice);
            loader.RegisterServiceLoader(new MonoGameServiceLoader());

            return(loader);
        }
Ejemplo n.º 4
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            guppy = new GuppyLoader();

            this.IsMouseVisible           = true;
            this.Window.AllowUserResizing = true;
            this.IsFixedTimeStep          = false;

            this.graphics.PreparingDeviceSettings += (s, e) =>
            {
                e.GraphicsDeviceInformation.PresentationParameters.PresentationInterval = PresentInterval.Immediate;
                e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage    = RenderTargetUsage.PreserveContents;
            };
            this.graphics.SynchronizeWithVerticalRetrace = false;
            this.graphics.GraphicsProfile = GraphicsProfile.HiDef;
            this.graphics.ApplyChanges();
        }
Ejemplo n.º 5
0
        public static GuppyLoader ConfigureTerminal(this GuppyLoader guppy)
        {
            guppy.RegisterServiceLoader(new TerminalServiceLoader());

            return(guppy);
        }