Ejemplo n.º 1
0
        //public Color color;
        //public SpriteEffects effect;

        public void render(MonoRenderer renderer, Material material, Vector2 offset, float rotation, float depth, Color color, SpriteEffects effect)
        {
            var scale    = new Vector2(destination.Width, destination.Height);
            var origin   = new Vector2(0.5f, 0.5f);
            var position = destination.Center + offset;

            renderer.DrawInternal(material, position, scale, source, color, rotation, origin, effect, depth);
        }
        public IntersectGame()
        {
            //Setup an error handler
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            Strings.Load();

            mGraphics = new GraphicsDeviceManager(this);
            mGraphics.PreferredBackBufferWidth  = 800;
            mGraphics.PreferredBackBufferHeight = 480;
            mGraphics.PreferHalfPixelOffset     = true;
            mGraphics.PreparingDeviceSettings  += (object s, PreparingDeviceSettingsEventArgs args) =>
            {
                args.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage =
                    RenderTargetUsage.PreserveContents;
            };

            Content.RootDirectory  = "";
            IsMouseVisible         = true;
            Globals.ContentManager = new MonoContentManager();
            Globals.Database       = new MonoDatabase();

            /* Load configuration */
            ClientConfiguration.LoadAndSave(ClientConfiguration.DefaultPath);

            Globals.Database.LoadPreferences();

            Globals.InputManager = new MonoInput(this);

            var renderer = new MonoRenderer(mGraphics, Content, this);

            Core.Graphics.Renderer = renderer;
            if (renderer == null)
            {
                throw new NullReferenceException("No renderer.");
            }

            Globals.System = new MonoSystem();
            Interface.Interface.GwenRenderer = new IntersectRenderer(null, Core.Graphics.Renderer);
            Interface.Interface.GwenInput    = new IntersectInput();
            Controls.Init();

            Window.Position     = new Microsoft.Xna.Framework.Point(-20, -2000);
            Window.IsBorderless = false;
            Window.AllowAltF4   = false;

            if (!string.IsNullOrWhiteSpace(ClientConfiguration.Instance.UpdateUrl))
            {
                mUpdater = new Updater.Updater(ClientConfiguration.Instance.UpdateUrl, Path.Combine("version.json"), true, 5);
            }
        }
Ejemplo n.º 3
0
        private IntersectGame(IClientContext context, Action postStartupAction)
        {
            Context           = context;
            PostStartupAction = postStartupAction;

            Strings.Load();

            mGraphics = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth  = 800,
                PreferredBackBufferHeight = 480,
                PreferHalfPixelOffset     = true
            };

            mGraphics.PreparingDeviceSettings += (s, args) =>
            {
                args.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage =
                    RenderTargetUsage.PreserveContents;
            };

            Content.RootDirectory  = "";
            IsMouseVisible         = true;
            Globals.ContentManager = new MonoContentManager();
            Globals.Database       = new MonoDatabase();

            /* Load configuration */
            ClientConfiguration.LoadAndSave(ClientConfiguration.DefaultPath);

            Globals.Database.LoadPreferences();

            Window.IsBorderless = Context.StartupOptions.BorderlessWindow;

            var renderer = new MonoRenderer(mGraphics, Content, this)
            {
                OverrideResolution = Context.StartupOptions.ScreenResolution
            };

            Globals.InputManager   = new MonoInput(this);
            GameClipboard.Instance = new MonoClipboard();

            Core.Graphics.Renderer = renderer;

            Globals.System = new MonoSystem();
            Interface.Interface.GwenRenderer = new IntersectRenderer(null, Core.Graphics.Renderer);
            Interface.Interface.GwenInput    = new IntersectInput();
            Controls.Init();

            Window.Position   = new Microsoft.Xna.Framework.Point(-20, -2000);
            Window.AllowAltF4 = false;

            // If we're going to be rendering a custom mouse cursor, hide the default one!
            if (!string.IsNullOrWhiteSpace(ClientConfiguration.Instance.MouseCursor))
            {
                IsMouseVisible = false;
            }

            if (!string.IsNullOrWhiteSpace(ClientConfiguration.Instance.UpdateUrl))
            {
                mUpdater = new Updater.Updater(
                    ClientConfiguration.Instance.UpdateUrl, Path.Combine("version.json"), true, 5
                    );
            }
        }