Пример #1
1
		public void Setup()
		{
			Bitmap bmp = new Bitmap(200, 100);
			m_graphics = Graphics.FromImage(bmp);

			m_gm = new GraphicsManager(null, m_graphics);
		}
Пример #2
0
 public virtual void Initialize(GraphicsManager graphics)
 {
     Type t = this.GetType();
     m_IsEntity = t.FullName;
     IsCollidable = true;
     t = null;
 }
Пример #3
0
 public void Draw(GameTime gameTime, GraphicsManager graphMan)
 {
     //Collider.DoTest(graphMan);
     currentLevel.Draw(gameTime, graphMan);
     entMan.Draw(gameTime, graphMan);
     blockMan.Draw(gameTime, graphMan);
 }
Пример #4
0
 public override void Draw(GameTime gameTime, GraphicsManager graphMan)
 {
     graphMan.DrawUISprite(title);
     graphMan.DrawUISprite(el_newgame);
     graphMan.DrawUISprite(el_options);
     graphMan.DrawUISprite(el_quit);
     graphMan.DrawUISprite(cursor);
 }
Пример #5
0
        internal CalibrationWindow(int width, int height, GraphicsManager gm)
            : base(0, 0, width, height)
        {
            this.gm = gm;

            Background = new SolidColorBrush(Color.CornflowerBlue);
            CrosshairPen = new Pen(Color.Red, 1);
        }
Пример #6
0
        internal Desktop(int width, int height, GraphicsManager gm)
            : base(0, 0, width, height)
        {
            this.gm = gm;

            Name = "Desktop";
            Background = new SolidColorBrush(Color.Black);

            font = Resources.GetFont(Resources.FontResources.CourierNew_10);
        }
Пример #7
0
        public static void RenderAll()
        {
            if (batch.Count > 0)
            {
                GraphicsManager.SetBlendState(DeviceStates.blendStateSolid);
                GraphicsManager.SetDepthState(DeviceStates.depthDefaultState);
                GraphicsManager.SetPrimitiveTopology(SharpDX.Direct3D.PrimitiveTopology.TriangleList);

                ShaderManager.Apply("VS_Model");
                ShaderManager.Apply("PS_Model");

                Display.context.PixelShader.SetShaderResource(0, ForegroundGame.unitPlaceholder.ressource);

                batch.Draw();
            }
        }
Пример #8
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            DiagManager.Instance.LoadMsg = "Loading System";
            GraphicsManager.InitSystem(GraphicsDevice);

            CurrentPhase = LoadPhase.Content;

            Thread thread = new Thread(LoadInBackground);

            thread.IsBackground = true;
            //thread.CurrentCulture = Thread.CurrentThread.CurrentCulture;
            //thread.CurrentUICulture = Thread.CurrentThread.CurrentUICulture;
            thread.Start();

            base.Initialize();
        }
Пример #9
0
        public void Draw(float dt)
        {
            anim.skeleton.X = (float)this.X;
            anim.skeleton.Y = (float)this.Y - (Pokemon.Height / 2);

            GraphicsManager.DrawQuad(new Vector3d(anim.skeleton.X - 0.4, 0.002, -0.3),
                                     new Vector3d(anim.skeleton.X + 0.4, 0.002, -0.3),
                                     new Vector3d(anim.skeleton.X + 0.4, 0.002, 0.3),
                                     new Vector3d(anim.skeleton.X - 0.4, 0.002, 0.3),
                                     ResourceManager.Shadow);

            anim.Draw();

            PreviousVelocity = CurrentVelocity;
            CurrentVelocity  = body.GetLinearVelocity();
        }
Пример #10
0
 // Use this for initialization
 void Start()
 {
     if (DiscRef == null)
     {
         DiscRef = Disc.Instance.gameObject;
     }
     if (GraphicsManagerRef == null)
     {
         GraphicsManagerRef = GraphicsManager.Instance;
     }
     _currentSpawnTime = BaseSpawnTime;
     if (CanSpawn)
     {
         SetAutoSpawnActive(true);
     }
 }
Пример #11
0
        public override void Draw(float fDeltaTime, SpriteBatch DrawBatch)
        {
            // Draw background
            GraphicsManager g    = GraphicsManager.Get();
            Rectangle       rect = new Rectangle(g.Width / 2 - 200, g.Height / 2 - 115,
                                                 400, 250);

            g.DrawFilled(DrawBatch, rect, Color.Black, 4.0f, Color.HotPink);

            Vector2 vOffset = Vector2.Zero;

            vOffset.Y -= 75;
            DrawCenteredString(DrawBatch, m_PausedText, m_TitleFont, Color.White, vOffset);

            base.Draw(fDeltaTime, DrawBatch);
        }
Пример #12
0
        /// <summary> Copies the geometry. </summary>
        ///
        /// <param name="mask">  The mask. </param>
        /// <param name="level"> The level. </param>
        ///
        /// <returns> An int. </returns>
        public static int CopyGeometry(QuickMaskType mask, int level)
        {
            SelectionManager.UnselectAllGeometry();

            SelectionManager.SelectGeometryByMask(mask);

            LevelsManager.SetLevelName(level, "Copied geometry via API");

            var result = GeometryManipulationManager.CopySelectedGeometryToLevel(level, true);

            GraphicsManager.ClearColors(new GroupSelectionMask());

            HideLevels(level);

            return(result);
        }
Пример #13
0
        private static void AddToStreetLightList(Dictionary <int, MapObjectProperties> streetLightList, StreetLightType streetLightType, LightType lightType, Vector2 lightOffset, MapObjectShadowType shadowType, Point objectSize, Point shadowPointLeft, Point shadowPointTop, bool alwaysOn, int elevation)
        {
            int rowIndex = (int)streetLightType * 4;

            for (int i = 0; i < 4; i++)
            {
                Piece   piece = PieceController.GetPiece(10, rowIndex + i);
                Light   light = GraphicsManager.GetLight(lightType);
                Vector2 currentLightOffset = RotateVectorRight(lightOffset, GroundLayerController.tileSize, i);
                float   radian             = RotateRadiansRight(0, i);
                Point   shadowPointOffset  = GetShadowPoint(shadowPointLeft, shadowPointTop, GroundLayerController.tileSize, i, objectSize);
                Shadow  shadowLeft         = new Shadow(ShadowSpriteController.GetShadowSprite(shadowType, ShadowSide.LEFT, i), 0, 0, ShadowSide.LEFT, i, shadowPointOffset);
                Shadow  shadowRight        = new Shadow(ShadowSpriteController.GetShadowSprite(shadowType, ShadowSide.RIGHT, i), 0, 0, ShadowSide.RIGHT, i, shadowPointOffset);
                streetLightList.Add(rowIndex + i, new StreetLight(piece, light, currentLightOffset, radian, shadowLeft, shadowRight, shadowPointOffset, alwaysOn, elevation));
            }
        }
Пример #14
0
        public void Draw(SpriteBatch spriteBatch, Loc offset)
        {
            Loc      drawLoc = GetDrawLoc(offset);
            TileData entry   = DataManager.Instance.GetTile(ID);

            if (!Revealed) //draw texture
            {
                entry = DataManager.Instance.GetTile(0);
            }

            if (entry.Anim.AnimIndex != "")
            {
                DirSheet sheet = GraphicsManager.GetObject(entry.Anim.AnimIndex);
                sheet.DrawDir(spriteBatch, drawLoc.ToVector2(), entry.Anim.GetCurrentFrame(GraphicsManager.TotalFrameTick, sheet.TotalFrames), entry.Anim.GetDrawDir(Dir8.None), Color.White * ((Owner == TileOwner.Player) ? 0.70f : 1f));
            }
        }
Пример #15
0
        public virtual void Draw(RenderContext context, GraphicsManager gfx)
        {
            if (BorderColor.HasValue)
            {
                var oldThickness = gfx.LineThickness;
                gfx.LineThickness = BorderThickness;
                context.Rectangle(ShapeMode.Stroke,
                                  CalculatedPosition,
                                  CalculatedSize.X,
                                  CalculatedSize.Y,
                                  BorderColor.Value);
                gfx.LineThickness = oldThickness;
            }

            ForeachInChildren(control => control.Draw(context, gfx));
        }
Пример #16
0
        public static void Main()
        {
            var spi1Controller = SpiController.FromName(FEZ.SpiBus.Spi1);
            var gpioController = GpioController.GetDefault();

            var st7735 = new ST7735Controller(spi1Controller.GetDevice(ST7735Controller.GetConnectionSettings(SpiChipSelectType.Gpio, FEZ.GpioPin.D10)), gpioController.OpenPin(FEZ.GpioPin.D8));

            st7735.SetDataAccessControl(false, false, false, false);
            st7735.SetDrawWindow(0, 40);

            var display = DisplayController.FromProvider(st7735);

            display.SetConfiguration(new SpiDisplayControllerSettings {
                Width = 128, Height = 80, DataFormat = DisplayDataFormat.Rgb444
            });
            display.Enable();

            var hdc    = GraphicsManager.RegisterDrawTarget(new DrawTarget(display));
            var screen = Graphics.FromHdc(hdc);

            var cnt  = 0;
            var font = new Font("GHIMono8x5", 8);

            while (true)
            {
                screen.Clear(Color.Black);

                screen.DrawString(cnt++.ToString(), font, new SolidBrush(Color.Purple), 0, 40);
                screen.DrawEllipse(new Pen(Color.Blue), 0, 0, 10, 10);
                screen.DrawRectangle(new Pen(Color.Red), 10, 0, 10, 10);
                screen.DrawLine(new Pen(Color.Green, 1), 25, 0, 22, 24);
                screen.DrawString("The quick brown fox jumped over the lazy dogs.", font, new SolidBrush(Color.Teal), new RectangleF(40, 0, 60, 40));

                var idx = 0;
                screen.DrawLine(new Pen(Color.Black, 1), 60 + idx, 40, 60 + idx, 70); idx  += 4;
                screen.DrawLine(new Pen(Color.White, 1), 60 + idx, 40, 60 + idx, 70); idx  += 4;
                screen.DrawLine(new Pen(Color.Gray, 1), 60 + idx, 40, 60 + idx, 70); idx   += 4;
                screen.DrawLine(new Pen(Color.Red, 1), 60 + idx, 40, 60 + idx, 70); idx    += 4;
                screen.DrawLine(new Pen(Color.Green, 1), 60 + idx, 40, 60 + idx, 70); idx  += 4;
                screen.DrawLine(new Pen(Color.Blue, 1), 60 + idx, 40, 60 + idx, 70); idx   += 4;
                screen.DrawLine(new Pen(Color.Yellow, 1), 60 + idx, 40, 60 + idx, 70); idx += 4;
                screen.DrawLine(new Pen(Color.Purple, 1), 60 + idx, 40, 60 + idx, 70); idx += 4;
                screen.DrawLine(new Pen(Color.Teal, 1), 60 + idx, 40, 60 + idx, 70); idx   += 4;

                screen.Flush();
            }
        }
Пример #17
0
        /// <summary> Draws a block on the specified level. </summary>
        ///
        /// <param name="topPoint1">    The first top point. </param>
        /// <param name="topPoint2">    The second top point. </param>
        /// <param name="depth"> The depth. </param>
        /// <param name="level">        The level. </param>
        public static void DrawBlock(Point3D topPoint1, Point3D topPoint2, double depth, int level)
        {
            SelectionManager.UnselectAllGeometry();

            // Create the top rectangle
            var topRectangle = GeometryCreationManager.CreateRectangle(topPoint1, topPoint2);

            foreach (var element in topRectangle)
            {
                element.Color = 48; // Green
                element.Commit();
            }

            SelectionManager.SelectGeometryByMask(QuickMaskType.Lines);

            // Translate a copy down in Z for the bottom rectangle
            GeometryManipulationManager.TranslateGeometry(
                new Point3D(0, 0, topPoint1.z),
                new Point3D(0, 0, depth),
                ViewManager.GraphicsView,
                ViewManager.GraphicsView,
                true);

            SelectionManager.UnselectAllGeometry();

            // Create the vertices
            var verticalLines = new ArrayList
            {
                new LineGeometry(new Point3D(topPoint1.x, topPoint1.y, topPoint1.z), new Point3D(topPoint1.x, topPoint1.y, depth)),
                new LineGeometry(new Point3D(topPoint1.x, topPoint2.y, topPoint1.z), new Point3D(topPoint1.x, topPoint2.y, depth)),
                new LineGeometry(new Point3D(topPoint2.x, topPoint2.y, topPoint1.z), new Point3D(topPoint2.x, topPoint2.y, depth)),
                new LineGeometry(new Point3D(topPoint2.x, topPoint1.y, topPoint1.z), new Point3D(topPoint2.x, topPoint1.y, depth))
            };

            foreach (Geometry line in verticalLines)
            {
                line.Color = 48; // Green
                line.Level = level;
                line.Commit();
            }

            const int ViewNumber = (int)GraphicsViewType.Iso;

            ViewManager.GraphicsView = SearchManager.GetViews(ViewNumber)[0];
            GraphicsManager.FitScreen();
            GraphicsManager.ClearColors(new GroupSelectionMask());
        }
Пример #18
0
        /// <summary>Draws the button.</summary>
        /// <param name="graphics">The graphics to draw on.</param>
        /// <param name="rectangle">The rectangle to draw on.</param>
        private void DrawButton(Graphics graphics, Rectangle rectangle)
        {
            if (!_buttonVisible)
            {
                return;
            }

            Point _buttonImageLocation;
            Size  _buttonImageSize;

            switch (_buttonStyle)
            {
            case ButtonStyles.Arrow:
            {
                _buttonImageSize     = new Size(10, 6);
                _buttonImageLocation = new Point((rectangle.X + (rectangle.Width / 2)) - (_buttonImageSize.Width / 2), (rectangle.Y + (rectangle.Height / 2)) - (_buttonImageSize.Height / 2));
                GraphicsManager.DrawTriangle(graphics, new Rectangle(_buttonImageLocation, _buttonImageSize), new SolidBrush(_buttonColor), false);

                break;
            }

            case ButtonStyles.Bars:
            {
                _buttonImageSize     = new Size(18, 10);
                _buttonImageLocation = new Point((rectangle.X + (rectangle.Width / 2)) - (_buttonImageSize.Width / 2), (rectangle.Y + (rectangle.Height / 2)) - _buttonImageSize.Height);
                Bars.DrawBars(graphics, _buttonImageLocation, _buttonImageSize, _buttonColor, 3, 5);

                break;
            }

            case ButtonStyles.Image:
            {
                if (_buttonImage != null)
                {
                    _buttonImageLocation = new Point((rectangle.X + (rectangle.Width / 2)) - (_buttonImage.Width / 2), (rectangle.Y + (rectangle.Height / 2)) - (_buttonImage.Height / 2));
                    graphics.DrawImage(_buttonImage, _buttonImageLocation);
                }

                break;
            }

            default:
            {
                throw new ArgumentOutOfRangeException();
            }
            }
        }
Пример #19
0
        public UIMainMenu(ContentManager Content) :
            base(Content)
        {
            m_TitleFont  = m_Content.Load <SpriteFont>("SpaceAge");
            m_ButtonFont = m_Content.Load <SpriteFont>("SquaredDisplay_Bold");

            // Create buttons
            Point vPos = new Point();

            //vPos.X = (int) (GraphicsManager.Get().Width / 1.3f);

            vPos.X = (int)(GraphicsManager.Get().Width / 2.0f);
            vPos.Y = (int)(GraphicsManager.Get().Height / 2.5f);

            m_Title = "Rhythm Runner";

            m_Buttons.AddLast(new Button(vPos, "Runner Mode",
                                         m_ButtonFont, Color.Aquamarine,
                                         Color.White, SongSelection, eButtonAlign.Center));

            vPos.Y += 80;
            m_Buttons.AddLast(new Button(vPos, "Dance Pad Mode",
                                         m_ButtonFont, Color.Aquamarine,
                                         Color.White, DancePadMode, eButtonAlign.Center));

            vPos.Y += 80;
            m_Buttons.AddLast(new Button(vPos, "Edit Song",
                                         m_ButtonFont, Color.Aquamarine,
                                         Color.White, EditSong, eButtonAlign.Center));

            /*
             * vPos.Y += 80;
             * m_Buttons.AddLast(new Button(vPos, "Options",
             *  m_ButtonFont, Color.Aquamarine,
             *  Color.White, Options, eButtonAlign.Center));
             */

            vPos.Y += 80;
            m_Buttons.AddLast(new Button(vPos, "High Scores",
                                         m_ButtonFont, Color.Aquamarine,
                                         Color.White, HighScore, eButtonAlign.Center));

            vPos.Y += 80;
            m_Buttons.AddLast(new Button(vPos, "Exit",
                                         m_ButtonFont, Color.Aquamarine,
                                         Color.White, Exit, eButtonAlign.Center));
        }
Пример #20
0
        static void Main(string[] args)
        {
            GraphicsManager.UseExperimentalFullAlpha = true;
            GraphicsManager.DisableDepthTest         = true;
            GraphicsManager.SetTitle("Pokemon Rumble");
            GraphicsManager.Render += new GraphicsManager.Renderer(Draw);
            GraphicsManager.Update += new GraphicsManager.Updater(GraphicsManager_Update);
            GraphicsManager.SetBackground(Color.SkyBlue);
            GraphicsManager.EnableMipmap = true;
            GraphicsManager.CameraUp     = Vector3.UnitY;
            GraphicsManager.SetWindowState(WindowState.Maximized);



            Initialize();
            GraphicsManager.Start();
        }
Пример #21
0
        private void ShowBrush()
        {
            switch (_brushType)
            {
            case "surface":
                _brushVisual.sprite = GraphicsManager.GetSprite(string.IsNullOrEmpty(_brush) ? "empty" : "surface." + _brush);
                break;

            case "objects":
                _brushVisual.sprite = GraphicsManager.GetSprite(string.IsNullOrEmpty(_brush) ? "empty" : "objects." + _brush);
                break;

            case "waypoints":
                _brushVisual.sprite = GraphicsManager.GetSprite(_wpBrush == Direction.None ? "empty" : "waypoints." + _wpBrush.Stringify());
                break;
            }
        }
Пример #22
0
        public void ToggleFullscreen()
        {
            GraphicsManager.ToggleFullScreen();

            if (GraphicsManager.IsFullScreen)
            {
                GraphicsManager.PreferredBackBufferWidth  = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
                GraphicsManager.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
            }
            else
            {
                GraphicsManager.PreferredBackBufferWidth  = View.ResolutionWidth * 3;
                GraphicsManager.PreferredBackBufferHeight = View.ResolutionHeight * 3;
            }

            GraphicsManager.ApplyChanges();
        }
Пример #23
0
        // The main point of entry for the application.
        private static void Main(string[] args)
        {
            // Check the folders and files in the system.
            FolderSystem.Check();

            // Load the game data.
            DataManager.Load();

            // Initialize the audio system.
            AudioManager.Initialize();

            // Initialize the game graphics.
            GraphicsManager.Initialize();

            // Start the game-loop.
            TowerDefense.GameLoop();
        }
Пример #24
0
        /// <summary>
        /// Creates the Game instance, instantiating the underlying <see cref="Komodo.Core.MonoGame"/> instance, <see cref="Komodo.Core.Engine.Graphics.GraphicsManager"/>, and <see cref="Komodo.Core.ECS.Systems.ISystem"/> objects.
        /// </summary>
        public Game()
        {
            _monoGame       = new MonoGame(this);
            GraphicsManager = new GraphicsManager(this)
            {
                IsMouseVisible = true
            };

            Content = _monoGame.Content;

            BehaviorSystem  = new BehaviorSystem(this);
            CameraSystem    = new CameraSystem(this);
            PhysicsSystems  = new List <PhysicsSystem>();
            Render2DSystems = new List <Render2DSystem>();
            Render3DSystems = new List <Render3DSystem>();
            SoundSystem     = new SoundSystem(this);
        }
Пример #25
0
        /// <summary> Select geometry by level. </summary>
        ///
        /// <param name="level"> The level. </param>
        public static void SelectGeometryByLevel(int level)
        {
            var geometries = SearchManager.GetGeometry().ToList();

            if (!geometries.Any())
            {
                return;
            }

            foreach (var entity in geometries.Where(ent => ent.Level == level))
            {
                entity.Selected = true;
                entity.Commit();
            }

            GraphicsManager.Repaint(true);
        }
Пример #26
0
        public BuildingEditor(Rectangle localLocation, DockType docktype) : base(localLocation, docktype, true)
        {
            name = "Editor";

            alwaysOnTop         = true;
            spriteBack          = GraphicsManager.GetSpriteColour(3);
            drawSpriteBack      = true;
            canChangeFocusOrder = false;

            AddBorder(2, Resizing.NONE, 3);
            AddHeading(50, "Building Editor", GraphicsManager.GetSpriteFont(Font.OpenSans20Bold), Color.White, false, false, false, false, false, GraphicsManager.GetSpriteColour(6));



            buildingsBinary = Data.LoadBuildingsBinary();
            AddControls();
        }
Пример #27
0
        public Controls(Rectangle localLocation, DockType dockType) : base(localLocation, dockType, true)
        {
            state               = ActionState.None;
            name                = "Controls";
            alwaysOnTop         = true;
            spriteBack          = GraphicsManager.GetSpriteColour(3);
            drawSpriteBack      = true;
            canChangeFocusOrder = false;
            AddBorder(2, Resizing.NONE, 3);
            AddHeading(50, "Control Settings", GraphicsManager.GetSpriteFont(Font.OpenSans20Bold), Color.White, false, false, false, false, false, GraphicsManager.GetSpriteColour(6));



            SetSizeBounds(0, 0, 900, 2000);
            AddScrollV(15, 6, 20);
            AddButtons();
        }
Пример #28
0
        public override void Draw(float fDeltaTime, SpriteBatch DrawBatch)
        {
            // Draw background
            GraphicsManager g    = GraphicsManager.Get();
            Rectangle       rect = new Rectangle(0, 0,
                                                 g.Width, g.Height);

            g.DrawFilled(DrawBatch, rect, Color.Black, 4.0f, Color.Black);

            Vector2 vOffset = Vector2.Zero;

            vOffset.Y -= GraphicsManager.Get().Height / 3.5f;
            //vOffset.X -= GraphicsManager.Get().Width / 3.3f;
            DrawCenteredString(DrawBatch, m_OptionsText, m_TitleFont, Color.White, vOffset);

            base.Draw(fDeltaTime, DrawBatch);
        }
Пример #29
0
        public void ApplyEffect(RenderTarget2D sceneRenderTarget, RenderTarget2D renderTarget1, RenderTarget2D renderTarget2)
        {
            m_Game.GraphicsDevice.SamplerStates[1] = SamplerState.LinearClamp;

            // Pass 1: draw the scene into rendertarget 1, using a
            // shader that extracts only the brightest parts of the image.
            m_BloomExtractEffect.Parameters["BloomThreshold"].SetValue(
                GlobalDefines.fBloomThreshold);

            GraphicsManager.Get().DrawFullscreenQuad(sceneRenderTarget, renderTarget1,
                                                     m_BloomExtractEffect);

            // Pass 2: draw from rendertarget 1 into rendertarget 2,
            // using a shader to apply a horizontal gaussian blur filter.
            SetBlurEffectParameters(1.0f / (float)renderTarget1.Width, 0);

            GraphicsManager.Get().DrawFullscreenQuad(renderTarget1, renderTarget2,
                                                     m_GaussianBlurEffect);

            // Pass 3: draw from rendertarget 2 back into rendertarget 1,
            // using a shader to apply a vertical gaussian blur filter.
            SetBlurEffectParameters(0, 1.0f / (float)renderTarget1.Height);

            GraphicsManager.Get().DrawFullscreenQuad(renderTarget2, renderTarget1,
                                                     m_GaussianBlurEffect);

            // Pass 4: draw both rendertarget 1 and the original scene
            // image back into the main backbuffer, using a shader that
            // combines them to produce the final bloomed result.
            m_Game.GraphicsDevice.SetRenderTarget(null);

            EffectParameterCollection parameters = m_BloomCombineEffect.Parameters;

            parameters["BloomIntensity"].SetValue(GlobalDefines.fBloomIntensity);
            parameters["BaseIntensity"].SetValue(GlobalDefines.fBaseIntensity);
            parameters["BloomSaturation"].SetValue(GlobalDefines.fBloomSaturation);
            parameters["BaseSaturation"].SetValue(GlobalDefines.fBaseSaturation);

            m_Game.GraphicsDevice.Textures[1] = sceneRenderTarget;

            Viewport viewport = m_Game.GraphicsDevice.Viewport;

            GraphicsManager.Get().DrawFullscreenQuad(renderTarget1,
                                                     viewport.Width, viewport.Height,
                                                     m_BloomCombineEffect);
        }
Пример #30
0
        /// <summary>
        ///     Renders a given layer of the scene graph.
        /// </summary>
        /// <param name="layer">Layer of scene graph to render.</param>
        public void Render(int layer)
        {
            // Render all the camera views.
            foreach (CameraNode camera in _cameraList)
            {
                GraphicsManager.ClearRenderState();

                // camera.Render(new Transformation(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f), camera, 0);
                Transformation cameraTransformation = camera.CalculateTransformation();

                // Clear the depth buffer so that this layer renders ontop of all others.
                GraphicsManager.ClearDepthBuffer();

                // Clear the depth buffer so this layer is drawn above all others.
                _rootNode.Render(cameraTransformation, camera, layer);
            }
        }
Пример #31
0
 public ListBox(string name, Rectangle location, Sprite spriteBack, Font font, ContainerCamera parentContainerCamera)
 {
     currentCount               = 0;
     retranslateDraw            = true;
     listBoxCamera              = new ListBoxCamera();
     listBoxScrollV             = new ListBoxScrollV(listBoxCamera, location);
     this.parentContainerCamera = parentContainerCamera;
     itemList         = new List <ListBoxObject>();
     drawSpriteBack   = true;
     this.spriteBack  = spriteBack;
     this.name        = name;
     currentUiScale   = DisplayController.uiScale;
     preScaleLocation = location;
     spriteFont       = GraphicsManager.GetSpriteFont(font);
     Rescale();
     UpdateViewport();
 }
Пример #32
0
        /// <summary>Draws the text title.</summary>
        /// <param name="graphics">The specified graphics to draw on.</param>
        private void DrawTitle(Graphics graphics)
        {
            try
            {
                Size _textSize = GraphicsManager.MeasureTextRenderer(Text, Font);

                // Fixes: Lower hanging characters like 'g'.
                _textSize.Height = _textSize.Height + 1;

                Point _titleLocation;

                switch (_titleAlignment)
                {
                case Alignment.TextAlignment.Center:
                {
                    _titleLocation = new Point((Width / 2) - (_textSize.Width / 2), _textRectangle.Y);
                    break;
                }

                case Alignment.TextAlignment.Left:
                {
                    _titleLocation = new Point(_vsImage.Point.X + _vsImage.Size.Width + 1, _textRectangle.Y);
                    break;
                }

                case Alignment.TextAlignment.Right:
                {
                    _titleLocation = new Point(Width - _border.Thickness - _textSize.Width - _visualControlBox.Width - 1, _textRectangle.Y);
                    break;
                }

                default:
                {
                    throw new ArgumentOutOfRangeException();
                }
                }

                _textRectangle = new Rectangle(_titleLocation.X, _titleLocation.Y, _textSize.Width, _textSize.Height);
                graphics.DrawString(Text, Font, new SolidBrush(ForeColor), _textRectangle);
            }
            catch (Exception e)
            {
                VisualExceptionDialog.Show(e);
            }
        }
Пример #33
0
        // The main point of entry for the application.
        private static void Main(string[] args)
        {
            // Check the folders and files in the system.
            FolderSystem.Check();

            // Load the game data.
            DataManager.Load();

            // Initialize the audio system.
            AudioManager.Initialize();
            AudioManager.Player.PlayMusic("McGameJam.flac", true);

            // Initialize the game graphics.
            GraphicsManager.Initialize();

            // Start the game-loop.
            Game.GameLoop();
        }
    private void LayoutQualityControls(ref Vector2 offset, Vector2 size)
    {
        float width = size.x / 3f;

        if (GUI.Button(new Rect(offset.x, offset.y, width, size.y), "Low"))
        {
            GraphicsManager.Get().RenderQualityLevel = GraphicsQuality.Low;
        }
        if (GUI.Button(new Rect(offset.x + width, offset.y, width, size.y), "Medium"))
        {
            GraphicsManager.Get().RenderQualityLevel = GraphicsQuality.Medium;
        }
        if (GUI.Button(new Rect(offset.x + (width * 2f), offset.y, width, size.y), "High"))
        {
            GraphicsManager.Get().RenderQualityLevel = GraphicsQuality.High;
        }
        offset.y += 1.5f * size.y;
    }
Пример #35
0
        /// <summary>
        ///		Renders all child nodes of this node.
        /// </summary>
        public void RenderChildren(Transformation transformation, CameraNode camera, int layer)
        {
            foreach (SceneNode child in _childList)
            {
                // Not on the same layer? Not got any children? Return.
                if (layer != child.DepthLayer && (child.Children.Count == 0))
                {
                    continue;
                }

                //HighPreformanceTimer timer = new HighPreformanceTimer();
                GraphicsManager.PushRenderState();
                child.Render(transformation, camera, layer);
                GraphicsManager.PopRenderState();
                //if (timer.DurationMillisecond > 2)
                //     System.Console.WriteLine(child.ToString() + " (" + ((child as EntityNode) != null ? (((EntityNode)child).Image != null ? ((EntityNode)child).Image.URL : "") + "," + ((EntityNode)child).RenderMode : "") + ") - Rendered in " + timer.DurationMillisecond);
            }
        }
Пример #36
0
        private DirSheet getAnimSheet()
        {
            DirSheet sheet = null;

            if (Anim.AnimIndex == "")
            {
                if (ItemAnim < 0)
                {
                    return(null);
                }
                sheet = GraphicsManager.GetItem(ItemAnim);
            }
            else
            {
                sheet = GraphicsManager.GetAttackSheet(Anim.AnimIndex);
            }
            return(sheet);
        }
Пример #37
0
        public static void DrawEditor(GraphicsManager graphMan)
        {
            if (!editor_active) return;

            if (editor_pose_loaded && !editor_part_selected)
            {
                drawPoseBox(graphMan, Color.Green);
                drawPartBox(graphMan, Color.Purple, new Vector2(selectedPart.x, selectedPart.y));
            }
            if (editor_pose_loaded && editor_part_selected && !editor_option_selected)
            {
                drawPoseBox(graphMan, new Color(0,0.2f,0));
                Color col = Color.Blue;
                drawPartBox(graphMan, new Vector2(selectedPart.x, selectedPart.y));
            }
            if (editor_pose_loaded && editor_part_selected && editor_option_selected)
            {
                drawPoseBox(graphMan, Color.DarkBlue);
                drawPartBox(graphMan, new Vector2(selectedPart.x, selectedPart.y));
            }
        }
Пример #38
0
        protected override void OnCreateControl()
        {
            base.OnCreateControl();

            TimeHelper.Initialize();
            LoadHelper.Initialize(ContentMgr);

            SceneManager = new LofiEngine.Scenes.SceneManager();
            if(!DesignMode)
                GraphicsManager = new GraphicsManager(GraphicsDevice);

            dragTexture = LoadHelper.LoadTexture2D("Common/Black");
            dragColor = Color.White;
            dragColor.A = 128;
            boundTexture = LoadHelper.LoadTexture2D("Common/Bound");
            bodyTexture = LoadHelper.LoadTexture2D("Common/Body");
        }
Пример #39
0
 public void Draw(GraphicsManager graphics)
 {
     base.Draw(graphics.SpriteBatch);
 }
Пример #40
0
 public override void Draw(GameTime gameTime, GraphicsManager graphMan)
 {
     //graphMan.GetCamera(1).rot = 0;
     graphMan.DrawWorldSprite(bg);
 }
Пример #41
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Destroy all divisions and pages
		/// </summary>
		/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources;
		/// <c>false</c> to release only unmanaged resources.</param>
		/// ------------------------------------------------------------------------------------
		protected override void Dispose(bool disposing)
		{
			Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
			// Must not be run more than once. Also don't call again while we're still in here
			// (which will happen because base.Dispose() calls DestroyHandle which will call
			// this.Dispose.
			if (IsDisposed || Disposing)
				return;

			if( disposing )
			{
				if(components != null)
					components.Dispose();

				// Even if disposing is false, we still dispose of our pages and and divisions
				// to force their rootboxes to close.
				// NOTE from RandyR: No. If it is false,
				// then the other disposable stuff may have been finalized already,
				// and accessing those kinds of objects will throw exceptions.
				DisposePages();	// also calls m_pages.Clear();

				if (m_divisions != null)
				{
					foreach (DivisionLayoutMgr div in m_divisions)
						div.Dispose();
				}
				if (m_divisions != null)
					m_divisions.Clear();

				if (m_editingHelper != null)
					m_editingHelper.Dispose();

				if (m_sharedStreams != null)
				{
					foreach (IVwRootBox rootb in m_sharedStreams)
						rootb.Close();
				}

				if (m_screenGraphics != null)
					m_screenGraphics.Dispose();
				if (m_printerGraphics != null)
					m_printerGraphics.Dispose();
				if (m_Timer != null)
					m_Timer.Dispose();
			}
			m_divisions = null;
			m_sharedStreams = null;
			components = null;
			m_editingHelper = null;
			m_screenGraphics = null;
			m_printerGraphics = null;
			m_Timer = null;

			base.Dispose(disposing);

			if (disposing)
			{
				if (m_sequencer != null)
					m_sequencer.Dispose();
		}
			m_sequencer = null;
		}
Пример #42
0
 public void Draw(GameTime gameTime, GraphicsManager graphMan)
 {
     if (!inTitle) graphMan.DrawUISprite(darken);
     currentMenu.Draw(gameTime, graphMan);
 }
Пример #43
0
 public void Draw(GraphicsManager graphics)
 {
     if (MouseTexture != null)
     {
     //    graphics.SpriteBatch.Draw(MouseTexture[0], m_MousePosition, null, Color.White, 0.0f,
     //        new Vector2((int)(MouseTexture[0].Width / 2f), (int)(MouseTexture[0].Height / 2f)),
     //        1.0f, SpriteEffects.None, 0f);
         m_TextureOrigin.X = m_MouseTexture[0].Width / 2f;
         m_TextureOrigin.Y = m_MouseTexture[0].Height / 2f;
         graphics.SpriteBatch.Draw(m_MouseTexture[0], m_MousePosition, null, Color.White, 0f, m_TextureOrigin, TextureScale, SpriteEffects.None, 0.0f);
     }
 }
Пример #44
0
 //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 //                             _CORE PROCESSES_
 // START
 // Use this for initialization
 void Start()
 {
     Application.targetFrameRate = 60;
     //currentSong = Overseer.selectedSong;
     currentSong = TestSong.getTestSong();
     Overseer.songScore = 0;
     Debug.Log (currentSong.SongName);
     Debug.Log(currentSong.LoopList[0].SongName);
     currentLoop = currentSong.LoopList[0];
     loopRepetition = 1;
     timer = new TimingManager(currentLoop.BeatsPerMinute);
     graphics = GameObject.FindObjectOfType<GraphicsManager>();
     levels = GameObject.FindObjectOfType<LevelManager>();
     inputManager = GameObject.FindObjectOfType<InputManager>();
     sounds = GameObject.FindObjectOfType<SoundManager>();
     score = FindObjectOfType<ScoreController>();
     beatNo = timer.currentBeat();
     // Find the first edge.
     currentEdge = currentLoop.EdgeList[0];
     currentNode = currentEdge.FromNode;
     endNode = currentLoop.NodeList[currentLoop.NodeList.Count - 1];
     if (currentNode.StartNode){
         startNode = currentNode;
         //Debug.Log("All loaded, we're good to go! - " + ((double)(Time.time - TimingManager.StartTime)).ToString());
         //Debug.Log(currentNode.NodeName + " " + CurrentNode.NodeType.ToString());
     }
     playerEdge = currentEdge;
     playerNode = currentNode;
     graphics.beginGraphicsProcess();
     loaded = true;
 }
Пример #45
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public SimpleRootSite()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			m_dxdLayoutWidth = kForceLayout; // Unlikely to be real current window width!
			m_wsPending = -1;
			BackColor = SystemColors.Window;
			//AllowScrolling = true;
			m_messageSequencer = new MessageSequencer(this);
			m_graphicsManager = CreateGraphicsManager();
			m_orientationManager = CreateOrientationManager();
			if (UIAutomationServerProviderFactory == null)
				UIAutomationServerProviderFactory = () => new SimpleRootSiteDataProvider(this);
			#if __MonoCS__
			KeyboardController.Register(this, new IbusRootSiteEventHandler(this));
			#endif
		}
Пример #46
0
 public void Draw(GraphicsManager graphics)
 {
     if (EnableFontShadow)
     {
         m_Font.Draw(graphics.SpriteBatch, m_Text, m_ShadowPosition, ShadowColor);
     }
     m_Font.Draw(graphics.SpriteBatch, m_Text, m_Position);
 }
Пример #47
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		protected override void Dispose(bool disposing)
		{
			Debug.WriteLineIf(!disposing, "****************** Missing Dispose() call for " + GetType().Name + "******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)
			{
				// Do this here, before disposing m_messageSequencer,
				// as we still get messages during dispose.
				// Once the the base class has shut down the window handle,
				// we are good to go on.
				// If we find we getting messages during this call,
				// we will be forced to call DestroyHandle() first.
				// That is done part way through the base method code,
				// but it may not be soon enough, for all the re-entrant events
				// that keep showing up.
				m_fAllowLayout = false;
				DestroyHandle();
			}

			base.Dispose(disposing);

			if (disposing)
			{
				if (m_rootb != null)
					CloseRootBox();

				if (m_Timer != null)
				{
					m_Timer.Stop();
					m_Timer.Tick -= OnTimer;
					m_Timer.Dispose();
				}

				// Remove the filter when we are disposed now.
				if (m_messageFilterInstalled)
				{
					Application.RemoveMessageFilter(this);
					m_messageFilterInstalled = false;
				}

				if (m_editingHelper != null)
					m_editingHelper.Dispose();
				if (m_messageSequencer != null)
					m_messageSequencer.Dispose();
				if (m_graphicsManager != null)
				{
					// Uninit() first in case we're in the middle of displaying something.  See LT-7365.
					m_graphicsManager.Uninit();
					m_graphicsManager.Dispose();
				}
				if (components != null)
					components.Dispose();
				#if __MonoCS__
				KeyboardController.Unregister(this);
				#endif
			}

			if (m_vdrb != null && Marshal.IsComObject(m_vdrb))
				Marshal.ReleaseComObject(m_vdrb);
			m_vdrb = null;
			if (m_styleSheet != null && Marshal.IsComObject(m_styleSheet))
				Marshal.ReleaseComObject(m_styleSheet);
			if (m_rootb != null && Marshal.IsComObject(m_rootb))
				Marshal.ReleaseComObject(m_rootb);
			m_rootb = null;
			m_styleSheet = null;
			m_graphicsManager = null;
			m_editingHelper = null;
			m_Timer = null;
			m_mediator = null;
			m_wsf = null;
			m_messageSequencer = null;

			// Don't do it here.
			//base.Dispose( disposing );

			m_fDisposed = true;
		}
Пример #48
0
 public void Draw(GraphicsManager graphics)
 {
     if(MouseTexture != null)
     graphics.SpriteBatch.Draw(MouseTexture[0], m_MousePosition, null, Color.White, 0.0f,
         new Vector2((int)(MouseTexture[0].Width / 2f), (int)(MouseTexture[0].Height / 2f)),
         1.0f, SpriteEffects.None, 0f);
 }
Пример #49
0
 private static void drawPoseBox(GraphicsManager graphMan, Color col)
 {
     graphMan.AddLine(pose_pos.X - (pose_box.X / 2),
                     pose_pos.Y - (pose_box.Y / 2), col,
                     pose_pos.X + (pose_box.X / 2),
                     pose_pos.Y - (pose_box.Y / 2), col);
     graphMan.AddLine(pose_pos.X + (pose_box.X / 2),
                     pose_pos.Y - (pose_box.Y / 2), col,
                     pose_pos.X + (pose_box.X / 2),
                     pose_pos.Y + (pose_box.Y / 2), col);
     graphMan.AddLine(pose_pos.X + (pose_box.X / 2),
                     pose_pos.Y + (pose_box.Y / 2), col,
                     pose_pos.X - (pose_box.X / 2),
                     pose_pos.Y + (pose_box.Y / 2), col);
     graphMan.AddLine(pose_pos.X - (pose_box.X / 2),
                     pose_pos.Y + (pose_box.Y / 2), col,
                     pose_pos.X - (pose_box.X / 2),
                     pose_pos.Y - (pose_box.Y / 2), col);
 }
Пример #50
0
 public abstract void Draw(GraphicsManager graphics);
Пример #51
0
 private static void drawPartBox(GraphicsManager graphMan, Color col, Vector2 offset)
 {
     graphMan.AddLine(offset.X + pose_pos.X - (pose_box.X / 16),
                     offset.Y + pose_pos.Y - (pose_box.Y / 16), col,
                     offset.X + pose_pos.X + (pose_box.X / 16),
                     offset.Y + pose_pos.Y - (pose_box.Y / 16), col);
     graphMan.AddLine(offset.X + pose_pos.X + (pose_box.X / 16),
                     offset.Y + pose_pos.Y - (pose_box.Y / 16), col,
                     offset.X + pose_pos.X + (pose_box.X / 16),
                     offset.Y + pose_pos.Y + (pose_box.Y / 16), col);
     graphMan.AddLine(offset.X + pose_pos.X + (pose_box.X / 16),
                     offset.Y + pose_pos.Y + (pose_box.Y / 16), col,
                     offset.X + pose_pos.X - (pose_box.X / 16),
                     offset.Y + pose_pos.Y + (pose_box.Y / 16), col);
     graphMan.AddLine(offset.X + pose_pos.X - (pose_box.X / 16),
                     offset.Y + pose_pos.Y + (pose_box.Y / 16), col,
                     offset.X + pose_pos.X - (pose_box.X / 16),
                     offset.Y + pose_pos.Y - (pose_box.Y / 16), col);
 }
Пример #52
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:PublicationControl"/> class with
		/// no divisions.
		/// </summary>
		/// <param name="stylesheet">The stylesheet.</param>
		/// <param name="publication">The publication that this PublicationControl gets
		/// it's information from (or null to keep the defaults)</param>
		/// <param name="printDateTime">The print date time.</param>
		/// <param name="fApplyStyleOverrides">if set to <c>true</c>, apply style overrides.</param>
		/// <param name="fUniformLineSpacing">if set to <c>true</c> apply uniform line spacing,
		/// rather than proportional spacing.</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// ------------------------------------------------------------------------------------
		public PublicationControl(FwStyleSheet stylesheet, IPublication publication,
			DateTime printDateTime, bool fApplyStyleOverrides, bool fUniformLineSpacing,
			IHelpTopicProvider helpTopicProvider)
		{
			m_origStylesheet = stylesheet;
			if (publication != null) // Can be null in tests
				m_cache = publication.Cache;
			m_publication = publication;
			m_printDateTime = printDateTime;
			m_fApplyStyleOverrides = fApplyStyleOverrides;
			m_fUniformLineSpacing = fUniformLineSpacing;
			m_helpTopicProvider = helpTopicProvider;

			AutoScroll = true;
			BackColor = SystemColors.Window;
			components = new System.ComponentModel.Container();
			m_Timer = new Timer(this.components);
			m_sequencer = new MessageSequencer(this);

			SetInfoFromDB();

			PrinterUtils.GetDefaultPrinterDPI(out m_printerDpiX, out m_printerDpiY);
			m_screenGraphics = new GraphicsManager(this);
			m_printerGraphics = new GraphicsManager(this);

			// If view overrides the stylesheet
			if (fApplyStyleOverrides)
			{
				m_origStylesheet.InitStylesheet += new EventHandler(OnInitOriginalStylesheet);

				ApplyPubOverrides();
			}
			else
				m_stylesheet = m_origStylesheet;
		}
Пример #53
0
 private static void drawPartBox(GraphicsManager graphMan, Vector2 offset)
 {
     Color col = Color.Blue;
     float x = offset.X + pose_pos.X;
     float y = offset.Y + pose_pos.Y;
     float s = 0.5f;
     float r = 0.0f;
     switch (selectedOption)
     {
         case 0: col = Color.White; graphMan.DrawString(x, y, col, s, r, "xy"); break;
         case 1: col = Color.Blue; graphMan.DrawString(x, y, col, s, r, "R"); break;
         case 2: col = Color.Yellow; graphMan.DrawString(x, y, col, s, r, "S"); break;
         case 3: col = Color.Red; graphMan.DrawString(x, y, col, s, r, "r"); break;
         case 4: col = Color.Green; graphMan.DrawString(x, y, col, s, r, "g"); break;
         case 5: col = Color.Blue; graphMan.DrawString(x, y, col, s, r, "b"); break;
         default: break;
     }
     drawPartBox(graphMan, col, offset);
 }
Пример #54
0
 public void Draw(GameTime gameTime, GraphicsManager graphics)
 {
     graphics.DrawUISprite(bg);
     graphics.DrawUISprite(thing);
 }
Пример #55
0
 public virtual void DrawPoly(Entity e, GraphicsManager graphMan, GameTime gameTime)
 {
 }
Пример #56
0
		public void Teardown()
		{
			m_gm.Dispose();
			m_gm = null;
			m_graphics.Dispose();
		}
Пример #57
0
 protected void m_UpdatePositionByResolution(GraphicsManager graphics)
 {
     base.Position = ExperiaHelper.Instance.PositionByResolution(m_PercentPosition);
 }