Exemple #1
0
        protected Game(
            ILogger logger,
            GameSettings gameSettings,
            IShaderFactory shaderFactory)
        {
            _shaderFactory = shaderFactory;
            Logger         = logger.ForContext <Game>();

            var gameWindowSettings = GameWindowSettings.Default;

            Window              = new GameWindow(gameWindowSettings, gameSettings._nativeWindowSettings);
            Window.Load        += Load;
            Window.Unload      += Unload;
            Window.UpdateFrame += Update;
            Window.RenderFrame += Render;
            Window.VSync        = VSyncMode.Off;

            var monitorHandle = Window.FindMonitor();

            if (Monitors.TryGetMonitorInfo(monitorHandle, out var monitorInfo))
            {
                var windowSize     = monitorInfo.ClientArea.Size * 90 / 100;
                var windowLocation = monitorInfo.ClientArea.HalfSize - windowSize / 2;

                Window.Location = windowLocation;
                Window.Size     = windowSize;
            }

            Camera = new Camera(CameraMode.Orthogonal, new Vector3(0, 0, 256), Window.Size.X / (float)Window.Size.Y);
        }
Exemple #2
0
        public ImGuiController(IShaderFactory shaderFactory,
                               int width,
                               int height)
        {
            _shaderFactory = shaderFactory;
            _windowWidth   = width;
            _windowHeight  = height;

            var context = ImGui.CreateContext();

            ImGui.SetCurrentContext(context);
            var io = ImGui.GetIO();

            io.Fonts.AddFontDefault();

            io.BackendFlags |= ImGuiBackendFlags.RendererHasVtxOffset;

            CreateDeviceResources();
            SetKeyMappings();

            SetPerFrameImGuiData(1f / 60f);

            ImGui.NewFrame();
            _frameBegun = true;
        }
 public ResourceManager(IMaterialFactory materialFactory, IShaderFactory shaderFactory, ITextureFactory textureFactory)
 {
   if (materialFactory == null) throw new ArgumentNullException("materialFactory");
   if (shaderFactory == null) throw new ArgumentNullException("shaderFactory");
   if (textureFactory == null) throw new ArgumentNullException("textureFactory");
   _materialFactory = new MaterialFactory();
   _shaderFactory = shaderFactory;
   _textureFactory = textureFactory;
 }
Exemple #4
0
 public ResourceManager(IMaterialFactory materialFactory, IShaderFactory shaderFactory, ITextureFactory textureFactory)
 {
     if (materialFactory == null)
     {
         throw new ArgumentNullException("materialFactory");
     }
     if (shaderFactory == null)
     {
         throw new ArgumentNullException("shaderFactory");
     }
     if (textureFactory == null)
     {
         throw new ArgumentNullException("textureFactory");
     }
     _materialFactory = new MaterialFactory();
     _shaderFactory   = shaderFactory;
     _textureFactory  = textureFactory;
 }
Exemple #5
0
        public ClientGame(
            ILogger logger,
            GameSettings gameSettings,
            IShaderFactory shaderFactory,
            IChunkProvider chunkProvider)
            : base(logger, gameSettings, shaderFactory)
        {
            _shaderFactory = shaderFactory;
            _chunkProvider = chunkProvider;
            Window.Title   = "Ashoka";

            _clearColor = new Color4(0.1f, 0.1f, 0.1f, 1.0f);

            _inputLayoutFactory = new InputLayoutFactory();
            _textureAtlas       = new TextureAtlas(32, "Content/Textures/LandAtlas.png");
            _chunkMeshFactory   = new ChunkMeshFactory(_textureAtlas);
            _meshFactory        = new MeshFactory();
        }
Exemple #6
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;
        }
Exemple #7
0
 public ShaderProgramFactory(IShaderFactory shaderFactory)
 {
     _shaderFactory = shaderFactory;
 }
Exemple #8
0
 public SaturationEffectComponent(IShaderFactory factory, IGameEvents events)
 {
     _factory = factory;
     _events  = events;
 }