예제 #1
0
        public static bool CreateDefault([MaybeNullWhen(false)] out Sdl2ControllerTracker?sct)
        {
            int jsCount = SDL_NumJoysticks();

            for (int i = 0; i < jsCount; i++)
            {
                if (SDL_IsGameController(i))
                {
                    sct = new Sdl2ControllerTracker(i);
                    return(true);
                }
            }

            sct = null;
            return(false);
        }
예제 #2
0
        public Lanegam() : base(preferredBackend: GraphicsBackend.Direct3D11)
        {
            Sdl2Native.SDL_Init(SDLInitFlags.GameController);
            Sdl2ControllerTracker.CreateDefault(out _controllerTracker);

            GraphicsDevice.SyncToVerticalBlank = true;

            _imGuiRenderable = new ImGuiRenderable(Window.Width, Window.Height);
            _resizeHandled  += (w, h) => _imGuiRenderable.WindowResized(w, h);

            _scene = new Scene(GraphicsDevice, Window);
            _scene.Camera.Controller = _controllerTracker;
            _sc.SetCurrentScene(_scene);

            _scene.AddRenderable(_imGuiRenderable);

            _sc.Camera.Position = new Vector3(-6, 24f, -0.43f);
            _sc.Camera.Yaw      = MathF.PI * 1.25f;
            _sc.Camera.Pitch    = 0;

            ScreenDuplicator duplicator = new ScreenDuplicator();

            _scene.AddRenderable(duplicator);

            _fsq = new FullScreenQuad();
            _scene.AddRenderable(_fsq);

            particlePlane = new ParticlePlane(_scene.Camera);
            //_scene.AddRenderable(particlePlane);

            spriteRenderable = new SpriteRenderable();
            _scene.AddRenderable(spriteRenderable);
            _scene.AddUpdateable(spriteRenderable);

            CreateGraphicsDeviceObjects();

            ImGui.StyleColorsClassic();
        }