Ejemplo n.º 1
0
 public AGSInventoryFactory(Resolver resolver, IGameState gameState, IGraphicsFactory graphics, IObjectFactory obj)
 {
     _resolver  = resolver;
     _gameState = gameState;
     _graphics  = graphics;
     _object    = obj;
 }
Ejemplo n.º 2
0
            public static async Task LoadAll(IGame game)
            {
                IGraphicsFactory f = game.Factory.Graphics;

                for (int i = 0; i < Names.Length; ++i)
                {
                    string name     = Names[i];
                    IImage carmodel = await f.LoadImageAsync(string.Format("{0}carmodel{1}.png", ObjectAssetFolder, i + 1), MagicColor.TopLeftPixel);

                    CarModels.Add(name, carmodel);
                    IImage portrait = await f.LoadImageAsync(string.Format("{0}face{1}.png", UIAssetFolder, i + 1), MagicColor.TopLeftPixel);

                    Drivers.Add(name, new DriverCharacter(name, portrait, carmodel, 90.0F));
                }

                RacerFrames = new IImage[Race.MAX_RACING_CARS];
                for (int i = 0; i < Race.MAX_RACING_CARS; ++i)
                {
                    RacerFrames[i] = await f.LoadImageAsync($"{UIAssetFolder}racerframe{i + 1}.png", MagicColor.TopLeftPixel);
                }
                BannerReady = await f.LoadImageAsync(UIAssetFolder + "banner1.png", MagicColor.TopLeftPixel);

                BannerSet = await f.LoadImageAsync(UIAssetFolder + "banner2.png", MagicColor.TopLeftPixel);

                BannerGo = await f.LoadImageAsync(UIAssetFolder + "banner3.png", MagicColor.TopLeftPixel);

                BannerLoose = await f.LoadImageAsync(UIAssetFolder + "banner4.png", MagicColor.TopLeftPixel);

                BannerWin = await f.LoadImageAsync(UIAssetFolder + "banner5.png", MagicColor.TopLeftPixel);
            }
Ejemplo n.º 3
0
        public TimeDiagram CreateDiagram <T>(IGraphicsFactory <T, IGraph> factory, out InteractiveDiagram interactiveDiagram) where T : InteractiveDiagram
        {
            List <string> labels = new List <string>(Parameters.ChannelCount + Parameters.QueueCapacity + 3);

            labels.Add("Заявки");

            for (int i = 0; i < Parameters.ChannelCount; i++)
            {
                labels.Add($"Канал { Parameters.ChannelCount - i }");
            }

            for (int i = 0; i < Parameters.QueueCapacity; i++)
            {
                labels.Add($"Место { Parameters.QueueCapacity - i }");
            }

            labels.Add("Обслужено");
            labels.Add("Отказ");

            T idg = factory.CreateEmptyDiagram(labels);

            TimeDiagram diagram = new TimeDiagram(Parameters.ChannelCount, Parameters.QueueCapacity, idg);

            FillDiagram(diagram);

            interactiveDiagram = idg;

            return(diagram);
        }
Ejemplo n.º 4
0
 public AGSUIFactory(IContainer resolver, IGameState gameState, IGraphicsFactory graphics, IObjectFactory obj)
 {
     _resolver  = resolver;
     _gameState = gameState;
     _graphics  = graphics;
     _object    = obj;
 }
		private static ISprite getDefaultSprite(IImage image, IGraphicsFactory factory)
		{
			ISprite sprite = factory.GetSprite();
			sprite.Image = image;
			sprite.Location = AGSLocation.Empty();
			return sprite;
		}
Ejemplo n.º 6
0
		public AGSUIFactory(IContainer resolver, IGameState gameState, IGraphicsFactory graphics, IObjectFactory obj)
		{
			_resolver = resolver;
			_gameState = gameState;
			_graphics = graphics;
			_object = obj;
		}
Ejemplo n.º 7
0
        /// <summary>
        /// Loads a Track definition file and constructs a Track object.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static async Task <Track> LoadAsync(string defpath, string assetpath, IGraphicsFactory f)
        {
            FileIniDataParser file = new FileIniDataParser();

            file.Parser.Configuration.CommentString = "//";
            IniData inidata = file.ReadFile(defpath);

            if (inidata == null)
            {
                return(null);
            }

            IniGetter ini      = new IniGetter(inidata);
            string    bkgpath  = ini.GetString("track", "background");
            string    maskpath = ini.GetString("track", "mask");
            Dictionary <Color, int> regionColors = new Dictionary <Color, int>();
            int regions = ini.GetInt("track", "regions");

            for (int i = 0; i < regions; ++i)
            {
                string secname = string.Format("region{0}", i);
                if (!inidata.Sections.ContainsSection(secname))
                {
                    continue;
                }
                Color col = Color.FromArgb(255,
                                           (byte)ini.GetInt(secname, "color_r"),
                                           (byte)ini.GetInt(secname, "color_g"),
                                           (byte)ini.GetInt(secname, "color_b"));
                regionColors[col] = i;
            }

            IImage background = await f.LoadImageAsync(assetpath + bkgpath);

            IBitmap mask = await f.LoadBitmapAsync(assetpath + maskpath);

            /*
             * // TODO: find out whether engine provides faster solution
             * int[,] regionMap = new int[mask.Width, mask.Height];
             * for (int x = 0; x < mask.Width; ++x)
             * {
             *  // NOTE: since MonoAGS has Y axis pointing up, we need to invert the lookup array's Y index
             *  for (int y = 0, mapy = mask.Height - 1; y < mask.Height; ++y, --mapy)
             *  {
             *      Color col = mask.GetPixel(x, y);
             *      int index = 0;
             *      regionColors.TryGetValue(col, out index);
             *      regionMap[x, mapy] = index;
             *  }
             * }
             *
             * return new Track(background, regionColors.Count, regionMap);
             */
            Size            trackSize   = mask != null ? new Size(mask.Width, mask.Height) : new Size();
            List <RaceNode> checkpoints = loadCheckpoints(assetpath, trackSize);

            TrackAIData aiData = await loadAIData(assetpath, trackSize, f);

            return(new Track(background, regionColors.Count, mask, regionColors, checkpoints, aiData));
        }
Ejemplo n.º 8
0
        public DemoGame(Options options, IGamePlatformFactory gamePlatformFactory, IGraphicsFactory graphicsFactory, IInputFactory inputFactory)
            : base(options, gamePlatformFactory, graphicsFactory, inputFactory)
        {
            _options        = options;
            _textureFactory = graphicsFactory.CreateTextureFactory();

            _camera = new Camera(new Vector3(0, 0, 5), _options.Graphics.Resolution.Width / (float)_options.Graphics.Resolution.Height);
        }
Ejemplo n.º 9
0
        private static ISprite getDefaultSprite(IImage image, IGraphicsFactory factory)
        {
            ISprite sprite = factory.GetSprite();

            sprite.Image    = image;
            sprite.Position = Position.Empty;
            return(sprite);
        }
    public SomeService(IGraphicsFactory graphicsFactory)
    {
        if (graphicsFactory == null)
        {
            throw new ArgumentNullException("graphicsFactory")

                  this.graphicsFactory = graphicsFactory;
        }
    }
Ejemplo n.º 11
0
        private static void loadFonts(IGame game)
        {
            IGraphicsFactory f = game.Factory.Graphics;

            // Cyan and pink italic fonts, used for generic purposes
            var fontImage = f.LoadImage(LF.FontAssetFolder + "font-italic-cyan.png", LF.MagicColor.TopLeftPixel);

            LF.Fonts.AzureItalicFont = SpriteFont.CreateFromBitmap(fontImage.OriginalBitmap, f, 13, 13, 0, 0, 126, null, null);

            fontImage = f.LoadImage(LF.FontAssetFolder + "font-italic-cyan.png", LF.MagicColor.TopLeftPixel);
            LF.Fonts.PurpleItalicFont = SpriteFont.CreateFromBitmap(fontImage.OriginalBitmap, f, 13, 13, 0, 0, 126, null, null);

            // Silver 'Racer' font
            int last  = 126;
            int total = last + 1;

            int[] offs   = new int[total];
            int[] widths = new int[total];
            for (int i = 0; i < total; i++)
            {
                offs[i] = 0;
            }
            for (int i = 0; i < total; i++)
            {
                widths[i] = 28;
            }
            // !, '(aposthrophe), .(dot), ,(comma), I, i, j, l, :, ; and |
            //offs['1'] = 4;
            offs['t'] = 3;
            offs['!'] = 9;
            offs['`'] = 9;
            offs['.'] = 9;
            offs[','] = 9;
            offs['I'] = 9;
            offs['i'] = 9;
            offs['j'] = 0;
            offs['l'] = 9;
            offs[':'] = 9;
            offs[';'] = 9;
            offs['|'] = 9;
            //widths['1'] -= (4 + 9) - 4;
            widths['t'] -= (3 + 7) - 4;
            widths['!'] -= 18 - 4;
            widths['`'] -= 18 - 4;
            widths['.'] -= 18 - 4;
            widths[','] -= 18 - 4;
            widths['I'] -= 18 - 4;
            widths['i'] -= 18 - 4;
            widths['j'] -= 9 - 4;
            widths['l'] -= 18 - 4;
            widths[':'] -= 18 - 4;
            widths[';'] -= 18 - 4;
            widths['|'] -= 18 - 4;

            fontImage           = f.LoadImage(LF.FontAssetFolder + "font-racer-silver.png", LF.MagicColor.TopLeftPixel);
            LF.Fonts.SilverFont = SpriteFont.CreateFromBitmap(fontImage.OriginalBitmap, f, 32, 34, 24, 0, last, offs, widths);
        }
Ejemplo n.º 12
0
            public static async Task LoadAll(IGame game)
            {
                IGraphicsFactory f = game.Factory.Graphics;

                Selector = await f.LoadImageAsync(UIAssetFolder + "hor.png", MagicColor.TopLeftPixel);

                VBar = await f.LoadImageAsync(UIAssetFolder + "vert.png", MagicColor.TopLeftPixel);

                PortraitFrame = await f.LoadImageAsync(UIAssetFolder + "blackframe.png", MagicColor.TopLeftPixel);
            }
Ejemplo n.º 13
0
        protected GameBase(Options options, IGamePlatformFactory gamePlatformFactory, IGraphicsFactory graphicsFactory, IInputFactory inputFactory)
        {
            _options             = options;
            _gamePlatformFactory = gamePlatformFactory;
            GraphicsFactory      = graphicsFactory;
            _inputFactory        = inputFactory;
            _inputMapper         = new InputMapper(_inputFactory);

            _gameLoop = _gamePlatformFactory.CreateGameLoop();
        }
Ejemplo n.º 14
0
        public Game(int windowWidth, int windowHeight, string windowTitle)
        {
            _graphics = new OpenGLGraphicsFactory();
            _window   = _graphics.CreateWindow(windowWidth, windowHeight, windowTitle, false);
            _renderer = _graphics.CreateRenderer();
            _renderer.Init();

            OnUpdate();
            NewGame();
        }
Ejemplo n.º 15
0
 public AGSUIFactory(Resolver resolver, IGameState gameState, IGraphicsFactory graphics, IObjectFactory obj,
                     IGameSettings settings, IFocusedUI focusedUI)
 {
     _settings  = settings;
     _resolver  = resolver;
     _gameState = gameState;
     _graphics  = graphics;
     _borders   = graphics.Borders;
     _object    = obj;
     _focus     = focusedUI;
 }
Ejemplo n.º 16
0
 public AGSUIFactory(Resolver resolver, IGameState gameState, IGraphicsFactory graphics, IObjectFactory obj,
                     IFocusedUI focusedUI, IFontFactory fonts)
 {
     _fonts     = fonts;
     _resolver  = resolver;
     _gameState = gameState;
     _graphics  = graphics;
     _borders   = graphics.Borders;
     _object    = obj;
     _focus     = focusedUI;
 }
Ejemplo n.º 17
0
        internal GameObjectFactory(IContentManager contentManager, IGraphicsFactory graphicsFactory, IGravitySimulator gravitySimulator, IDrawingManager drawingManager, IUniverse universe, IShipComponentFactory shipComponentFactory)
        {
            _contentManager = contentManager;
            _graphicsFactory = graphicsFactory;
            _gravitySimulator = gravitySimulator;
            _drawingManager = drawingManager;
            _universe = universe;

            _shipComponentFactory = shipComponentFactory;
            _gameObjects = new List<IGameObject>();
        }
Ejemplo n.º 18
0
		public AGSGameFactory(IGraphicsFactory graphics, IInventoryFactory inventory, IUIFactory ui,
			IRoomFactory room, IOutfitFactory outfit, IObjectFactory obj, IDialogFactory dialog, IAudioFactory sound)
		{
			Graphics = graphics;
			Inventory = inventory;
			UI = ui;
			Room = room;
			Outfit = outfit;
			Object = obj;
			Dialog = dialog;
			Sound = sound;
		}
Ejemplo n.º 19
0
 internal Renderer(IGraphicsFactory graphicsFactory, Template template, DocumentData documentData = null, DocumentProperties documentProperties = null, PageSizeInfo pageSizeInfo = null, bool debug = false, PrinterInteractionMode printerInteractionMode = PrinterInteractionMode.None)
 {
     _template               = template;
     _documentData           = documentData;
     _documentProperties     = documentProperties;
     _printerInteractionMode = printerInteractionMode;
     _pageSizeInfo           = pageSizeInfo ?? new PageSizeInfo(PageSize.A4);
     if (debug)
     {
         _debugData = new DebugData();
     }
     _graphicsFactory = graphicsFactory;
 }
Ejemplo n.º 20
0
 public AGSGameFactory(IGraphicsFactory graphics, IInventoryFactory inventory, IUIFactory ui,
                       IRoomFactory room, IOutfitFactory outfit, IObjectFactory obj, IDialogFactory dialog,
                       IAudioFactory sound, IFontLoader fontFactory)
 {
     Graphics  = graphics;
     Inventory = inventory;
     UI        = ui;
     Room      = room;
     Outfit    = outfit;
     Object    = obj;
     Dialog    = dialog;
     Sound     = sound;
     Fonts     = fontFactory;
 }
Ejemplo n.º 21
0
 public GLImageRenderer(Dictionary <string, ITexture> textures,
                        IGLColorBuilder colorBuilder, IGLTextureRenderer renderer,
                        IGraphicsFactory graphicsFactory, IGLUtils glUtils,
                        IBitmapLoader bitmapLoader)
 {
     _graphicsFactory   = graphicsFactory;
     _createTextureFunc = createNewTexture; //Creating a delegate in advance to avoid memory allocations on critical path
     _textures          = textures;
     _colorBuilder      = colorBuilder;
     _renderer          = renderer;
     _glUtils           = glUtils;
     _bitmapLoader      = bitmapLoader;
     _emptyTexture      = new Lazy <ITexture>(() => initEmptyTexture());
     _colorAdjusters    = new IHasImage[2];
 }
Ejemplo n.º 22
0
 public AGSImageComponent(IHasImage image, IGraphicsFactory factory, IRenderPipeline pipeline,
                          IGLTextureRenderer renderer, ITextureCache textures,
                          ITextureFactory textureFactory, IGLColorBuilder colorBuilder)
 {
     IsImageVisible          = true;
     _getTextureFunc         = textureFactory.CreateTexture; //Creating a delegate in advance to avoid memory allocations on critical path
     _textures               = textures;
     _colorBuilder           = colorBuilder;
     _image                  = image;
     _factory                = factory;
     _colorAdjusters         = new IHasImage[2];
     _image.PropertyChanged += onPropertyChanged;
     _pipeline               = pipeline;
     _boxesPool              = new ObjectPool <AGSBoundingBoxes>(_ => new AGSBoundingBoxes(), 2);
     _instructionPool        = new ObjectPool <Instruction>(instructionPool => new Instruction(instructionPool, _boxesPool, renderer), 2);
 }
Ejemplo n.º 23
0
        internal Ship(string name, Vector2 position, float radius, Color color, IGraphicsFactory graphicsFactory, IShipComponentFactory shipComponentFactory)
            : base(position, radius, 1)
        {
            Name = name;
            Color = color;

            _controller = new NullShipController();

            _energyStore = shipComponentFactory.CreateEnergyStore();
            _shield = shipComponentFactory.CreateShield(this);
            _hull = shipComponentFactory.CreateHull(this);
            _thrusterArray = shipComponentFactory.CreateThrusterArray(this);

            _graphicsFactory = graphicsFactory;
            _arrows = new List<IArrow>();
        }
Ejemplo n.º 24
0
        public GLImageRenderer (Dictionary<string, ITexture> textures, 
			IGLMatrixBuilder hitTestMatrixBuilder, IGLMatrixBuilder renderMatrixBuilder, IGLBoundingBoxBuilder boundingBoxBuilder,
			IGLColorBuilder colorBuilder, IGLTextureRenderer renderer, IGLBoundingBoxes bgBoxes,
            IGLViewportMatrixFactory layerViewports, IGraphicsFactory graphicsFactory, IGLUtils glUtils)
		{
            _graphicsFactory = graphicsFactory;
			_textures = textures;
			_renderMatrixBuilder = renderMatrixBuilder;
            _hitTestMatrixBuilder = hitTestMatrixBuilder;
			_boundingBoxBuilder = boundingBoxBuilder;
			_colorBuilder = colorBuilder;
			_renderer = renderer;
			_layerViewports = layerViewports;
			BoundingBoxes = bgBoxes;
            _glUtils = glUtils;
            _emptyTexture = new Lazy<ITexture>(() => initEmptyTexture());
		}
Ejemplo n.º 25
0
 public GLImageRenderer(Dictionary <string, ITexture> textures,
                        IGLBoundingBoxBuilder boundingBoxBuilder,
                        IGLColorBuilder colorBuilder, IGLTextureRenderer renderer, IGLBoundingBoxes bgBoxes,
                        IGLViewportMatrixFactory layerViewports, IGraphicsFactory graphicsFactory, IGLUtils glUtils,
                        IBitmapLoader bitmapLoader)
 {
     _graphicsFactory    = graphicsFactory;
     _textures           = textures;
     _boundingBoxBuilder = boundingBoxBuilder;
     _colorBuilder       = colorBuilder;
     _renderer           = renderer;
     _layerViewports     = layerViewports;
     BoundingBoxes       = bgBoxes;
     _glUtils            = glUtils;
     _bitmapLoader       = bitmapLoader;
     _emptyTexture       = new Lazy <ITexture>(() => initEmptyTexture());
 }
Ejemplo n.º 26
0
        public AGSBlueSkin(IGraphicsFactory factory)
        {
            var buttonBorder = factory.Borders.SolidColor(Colors.DarkBlue, 1f);

            _skin = new AGSColoredSkin(factory)
            {
                ButtonIdleAnimation              = new ButtonAnimation(buttonBorder, null, Colors.CornflowerBlue),
                ButtonHoverAnimation             = new ButtonAnimation(buttonBorder, null, Colors.Blue),
                ButtonPushedAnimation            = new ButtonAnimation(buttonBorder, null, Colors.DarkSlateBlue),
                TextBoxBackColor                 = Colors.CornflowerBlue,
                TextBoxBorderStyle               = factory.Borders.SolidColor(Colors.DarkBlue, 1f),
                CheckboxCheckedAnimation         = new ButtonAnimation(buttonBorder, null, Colors.DarkSlateBlue),
                CheckboxNotCheckedAnimation      = new ButtonAnimation(buttonBorder, null, Colors.CornflowerBlue),
                CheckboxHoverCheckedAnimation    = new ButtonAnimation(buttonBorder, null, Colors.Blue),
                CheckboxHoverNotCheckedAnimation = new ButtonAnimation(buttonBorder, null, Colors.Blue),
                DialogBoxColor  = Colors.DarkSlateBlue,
                DialogBoxBorder = factory.Borders.SolidColor(Colors.DarkBlue, 2f)
            };
        }
Ejemplo n.º 27
0
 public AGSBlueSkin(IGraphicsFactory factory, IGLUtils glUtils)
 {
     _skin = new AGSColoredSkin(factory)
     {
         ButtonIdleBackColor          = Colors.CornflowerBlue,
         ButtonHoverBackColor         = Colors.Blue,
         ButtonPushedBackColor        = Colors.DarkSlateBlue,
         ButtonBorderStyle            = AGSBorders.SolidColor(glUtils, Colors.DarkBlue, 1f),
         TextBoxBackColor             = Colors.CornflowerBlue,
         TextBoxBorderStyle           = AGSBorders.SolidColor(glUtils, Colors.DarkBlue, 1f),
         CheckboxCheckedColor         = Colors.DarkSlateBlue,
         CheckboxNotCheckedColor      = Colors.CornflowerBlue,
         CheckboxHoverCheckedColor    = Colors.Blue,
         CheckboxHoverNotCheckedColor = Colors.Blue,
         CheckboxBorderStyle          = AGSBorders.SolidColor(glUtils, Colors.DarkBlue, 1f),
         DialogBoxColor  = Colors.DarkSlateBlue,
         DialogBoxBorder = AGSBorders.SolidColor(glUtils, Colors.DarkBlue, 2f)
     };
 }
Ejemplo n.º 28
0
 public AGSGraySkin(IGraphicsFactory factory, IGLUtils glUtils)
 {
     _skin = new AGSColoredSkin(factory)
     {
         ButtonIdleBackColor          = Colors.DimGray,
         ButtonHoverBackColor         = Colors.LightGray,
         ButtonPushedBackColor        = Colors.LightYellow,
         ButtonBorderStyle            = AGSBorders.SolidColor(glUtils, Colors.Black, 1f),
         TextBoxBackColor             = Colors.DimGray,
         TextBoxBorderStyle           = AGSBorders.SolidColor(glUtils, Colors.Black, 1f),
         CheckboxCheckedColor         = Colors.SlateGray,
         CheckboxNotCheckedColor      = Colors.DimGray,
         CheckboxHoverCheckedColor    = Colors.LightGray,
         CheckboxHoverNotCheckedColor = Colors.LightGray,
         CheckboxBorderStyle          = AGSBorders.SolidColor(glUtils, Colors.Black, 1f),
         DialogBoxColor  = Colors.DarkGray,
         DialogBoxBorder = AGSBorders.SolidColor(glUtils, Colors.Black, 2f)
     };
 }
Ejemplo n.º 29
0
 public AGSBlueSkin(IGraphicsFactory factory, IGLUtils glUtils)
 {
     _skin = new AGSColoredSkin(factory)
     {
         ButtonIdleBackColor = Colors.CornflowerBlue,
         ButtonHoverBackColor = Colors.Blue,
         ButtonPushedBackColor = Colors.DarkSlateBlue,
         ButtonBorderStyle = AGSBorders.SolidColor(glUtils, Colors.DarkBlue, 1f),
         TextBoxBackColor = Colors.CornflowerBlue,                
         TextBoxBorderStyle = AGSBorders.SolidColor(glUtils, Colors.DarkBlue, 1f),
         CheckboxCheckedColor = Colors.DarkSlateBlue,
         CheckboxNotCheckedColor = Colors.CornflowerBlue,
         CheckboxHoverCheckedColor = Colors.Blue,
         CheckboxHoverNotCheckedColor = Colors.Blue,
         CheckboxBorderStyle = AGSBorders.SolidColor(glUtils, Colors.DarkBlue, 1f),
         DialogBoxColor = Colors.DarkSlateBlue,
         DialogBoxBorder = AGSBorders.SolidColor(glUtils, Colors.DarkBlue, 2f)
     };
 }
Ejemplo n.º 30
0
        public AGSGraySkin(IGraphicsFactory factory)
        {
            var buttonBorder = factory.Borders.SolidColor(Colors.Black, 1f);

            _skin = new AGSColoredSkin(factory)
            {
                ButtonIdleAnimation              = new ButtonAnimation(buttonBorder, null, Colors.DimGray),
                ButtonHoverAnimation             = new ButtonAnimation(buttonBorder, null, Colors.LightGray),
                ButtonPushedAnimation            = new ButtonAnimation(buttonBorder, null, Colors.LightYellow),
                TextBoxBackColor                 = Colors.DimGray,
                TextBoxBorderStyle               = factory.Borders.SolidColor(Colors.Black, 1f),
                CheckboxCheckedAnimation         = new ButtonAnimation(buttonBorder, null, Colors.SlateGray),
                CheckboxNotCheckedAnimation      = new ButtonAnimation(buttonBorder, null, Colors.DimGray),
                CheckboxHoverCheckedAnimation    = new ButtonAnimation(buttonBorder, null, Colors.LightGray),
                CheckboxHoverNotCheckedAnimation = new ButtonAnimation(buttonBorder, null, Colors.LightGray),
                DialogBoxColor  = Colors.DarkGray,
                DialogBoxBorder = factory.Borders.SolidColor(Colors.Black, 2f)
            };
        }
Ejemplo n.º 31
0
 public AGSGraySkin(IGraphicsFactory factory, IGLUtils glUtils)
 {
     _skin = new AGSColoredSkin(factory)
     {
         ButtonIdleBackColor = Colors.DimGray,
         ButtonHoverBackColor = Colors.LightGray,
         ButtonPushedBackColor = Colors.LightYellow,
         ButtonBorderStyle = AGSBorders.SolidColor(glUtils, Colors.Black, 1f),
         TextBoxBackColor = Colors.DimGray,
         TextBoxBorderStyle = AGSBorders.SolidColor(glUtils, Colors.Black, 1f),
         CheckboxCheckedColor = Colors.SlateGray,
         CheckboxNotCheckedColor = Colors.DimGray,
         CheckboxHoverCheckedColor = Colors.LightGray,
         CheckboxHoverNotCheckedColor = Colors.LightGray,
         CheckboxBorderStyle = AGSBorders.SolidColor(glUtils, Colors.Black, 1f),
         DialogBoxColor = Colors.DarkGray,
         DialogBoxBorder = AGSBorders.SolidColor(glUtils, Colors.Black, 2f)
     };
 }
Ejemplo n.º 32
0
        public AGSGameFactory(IGraphicsFactory graphics, IInventoryFactory inventory, IUIFactory ui,
                              IRoomFactory room, IOutfitFactory outfit, IObjectFactory obj, IDialogFactory dialog,
                              IAudioFactory sound, IFontLoader fontFactory, IResourceLoader resources, IShaderFactory shaders,
                              Resolver resolver)
        {
            Graphics  = graphics;
            Inventory = inventory;
            UI        = ui;
            Room      = room;
            Outfit    = outfit;
            Object    = obj;
            Dialog    = dialog;
            Sound     = sound;
            Fonts     = fontFactory;
            Resources = resources;
            TypedParameter gameFactoryParam = new TypedParameter(typeof(IGameFactory), this);

            Masks   = resolver.Container.Resolve <IMaskLoader>(gameFactoryParam);
            Shaders = shaders;
        }
Ejemplo n.º 33
0
        public AGSSilverSkin(IGraphicsFactory factory)
        {
            var buttonBorder       = factory.Borders.SolidColor(GameViewColors.Border, 1f);
            var pushedButtonBorder = factory.Borders.SolidColor(GameViewColors.Border, 2f);

            _skin = new AGSColoredSkin(factory)
            {
                ButtonIdleAnimation              = new ButtonAnimation(buttonBorder, null, GameViewColors.Button),
                ButtonHoverAnimation             = new ButtonAnimation(buttonBorder, null, GameViewColors.HoveredButton),
                ButtonPushedAnimation            = new ButtonAnimation(pushedButtonBorder, null, GameViewColors.PushedButton),
                TextBoxBackColor                 = GameViewColors.Textbox,
                TextBoxBorderStyle               = factory.Borders.SolidColor(Colors.WhiteSmoke, 1f),
                CheckboxCheckedAnimation         = new ButtonAnimation(buttonBorder, null, GameViewColors.Button),
                CheckboxNotCheckedAnimation      = new ButtonAnimation(buttonBorder, null, GameViewColors.Button),
                CheckboxHoverCheckedAnimation    = new ButtonAnimation(buttonBorder, null, GameViewColors.HoveredButton),
                CheckboxHoverNotCheckedAnimation = new ButtonAnimation(buttonBorder, null, GameViewColors.HoveredButton),
                DialogBoxColor  = GameViewColors.Panel,
                DialogBoxBorder = factory.Borders.SolidColor(Colors.WhiteSmoke, 2f)
            };
        }
Ejemplo n.º 34
0
        internal SpaceWar2Game()
        {
            _contentManager = new ContentManagerWrapper(Content.ServiceProvider, "Content");
            var graphicsDeviceManager = new GraphicsDeviceManager(this);
            _graphicsDevice = new GraphicsDeviceWrapper(graphicsDeviceManager);

            _universe = Universe.CreateDefault();
            _drawingManager = new DrawingManager(_universe);
            _gravitySimulator = new GravitySimulator();
            _shipComponentFactory = new ShipComponentFactory();
            _graphicsFactory = new GraphicsFactory();

            _gameObjectFactory = new GameObjectFactory(_contentManager, _graphicsFactory, _gravitySimulator, _drawingManager, _universe, _shipComponentFactory);

            _keyboardHandler = new KeyboardHandler(new KeyboardWrapper());

            var actionHandler = new ActionHandler(_keyboardHandler);

            _gameEngine = new GameEngine(_universe, _gravitySimulator, _gameObjectFactory, _keyboardHandler, actionHandler, _drawingManager);

            SetUpActions(actionHandler);
        }
Ejemplo n.º 35
0
 public AGSImageComponent(IHasImage image, IGraphicsFactory factory)
 {
     _image = image;
     _factory = factory;
 }
        public void SetUp()
        {
            _contentManager = Substitute.For<IContentManager>();
            _graphicsFactory = Substitute.For<IGraphicsFactory>();
            _gravitySimulator = Substitute.For<IGravitySimulator>();
            _drawingManager = Substitute.For<IDrawingManager>();
            _universe = Substitute.For<IUniverse>();
            _shipComponentFactory = Substitute.For<IShipComponentFactory>();

            _gameObjectFactory = new GameObjectFactory(_contentManager, _graphicsFactory, _gravitySimulator, _drawingManager, _universe, _shipComponentFactory);
        }
Ejemplo n.º 37
0
 public AGSColoredSkin(IGraphicsFactory factory)
 {
     _factory = factory;            
 }
Ejemplo n.º 38
0
        /// <summary>
        /// Creates graphics objects from the specified factory
        /// </summary>
        public static void Initialize( IGraphicsFactory factory )
        {
            s_Factory = factory;
            s_Renderer = factory.CreateRenderer( );
            s_Draw = factory.CreateDraw( );

            //	Effect data sources are created lazily, to remove the dependency
            //	on the effect assembly for applications that don't need it

            factory.Initialize( );
        }
Ejemplo n.º 39
0
		public AGSSingleFrameAnimation (IImage image, IGraphicsFactory factory) : this(getDefaultSprite(image, factory))
		{
		}
 public TransientRenderPassEntity(IGraphicsFactory graphicsFactory)
 {
     _renderPass = graphicsFactory.CreateBlurPostProcessingRenderPass();
 }
Ejemplo n.º 41
0
 public AGSOutfitFactory(IContainer resolver, IGraphicsFactory graphics)
 {
     _resolver = resolver;
     _graphics = graphics;
 }
Ejemplo n.º 42
0
 public FixedRenderPassEntity(IGraphicsFactory graphicsFactory)
 {
     _renderPass       = graphicsFactory.Create3DRenderPass();
     _someOnceOffField = true;
 }
Ejemplo n.º 43
0
		public AGSOutfitFactory(IContainer resolver, IGraphicsFactory graphics)
		{
			_resolver = resolver;
			_graphics = graphics;
		}
Ejemplo n.º 44
0
        public void SetUp()
        {
            _graphicsFactory = Substitute.For<IGraphicsFactory>();
            _graphicsDevice = Substitute.For<IGraphicsDevice>();
            _shipComponentFactory = Substitute.For<IShipComponentFactory>();

            _energyStore = Substitute.For<IEnergyStore>();
            _shield = Substitute.For<IShield>();
            _hull = Substitute.For<IHull>();
            _thrusterArray = Substitute.For<IThrusterArray>();
            _controller = Substitute.For<IShipController>();

            _shipComponentFactory.CreateEnergyStore().ReturnsForAnyArgs(_energyStore);
            _shipComponentFactory.CreateShield(Arg.Any<IShip>()).Returns(_shield);
            _shipComponentFactory.CreateHull(Arg.Any<IShip>()).Returns(_hull);
            _shipComponentFactory.CreateThrusterArray(Arg.Any<IShip>()).Returns(_thrusterArray);

            _position = new Vector2(12f, 5.5f);
            _ship = new Ship("TestShip", _position, _radius, Color.Goldenrod, _graphicsFactory, _shipComponentFactory);
            _ship.SetController(_controller);
        }
Ejemplo n.º 45
0
        private static async Task loadAIRegionsData(TrackAIData data, string assetpath, IGraphicsFactory f)
        {
            IBitmap regionMask = await f.LoadBitmapAsync(assetpath + "airegions.bmp");

            if (regionMask == null)
            {
                return;
            }

            FileIniDataParser file = new FileIniDataParser();

            file.Parser.Configuration.CommentString = "//";
            IniData inidata = file.ReadFile(assetpath + "airegions.ini");

            if (inidata == null)
            {
                return;
            }

            IniGetter ini = new IniGetter(inidata);
            Dictionary <Color, float> regionAngles = new Dictionary <Color, float>();
            int regions = ini.GetInt("ai", "regions");

            for (int i = 0; i < regions; ++i)
            {
                string secname = string.Format("region{0}", i);
                if (!inidata.Sections.ContainsSection(secname))
                {
                    continue;
                }
                Color col = Color.FromArgb(255,
                                           (byte)ini.GetInt(secname, "color_r"),
                                           (byte)ini.GetInt(secname, "color_g"),
                                           (byte)ini.GetInt(secname, "color_b"));
                regionAngles[col] = MathUtils.DegreesToRadians(ini.GetFloat(secname, "angle"));
            }

            data.AIRegionMask   = regionMask;
            data.AIRegionAngles = regionAngles;
            return;
        }
Ejemplo n.º 46
0
        private static async Task <TrackAIData> loadAIData(string assetpath, Size trackSize, IGraphicsFactory f)
        {
            TrackAIData data = new TrackAIData();

            await loadAIRegionsData(data, assetpath, f);

            loadAIPathsData(data, assetpath, trackSize);
            return(data);
        }
Ejemplo n.º 47
0
 public AGSSingleFrameAnimation(IImage image, IGraphicsFactory factory) : this(getDefaultSprite(image, factory))
 {
 }