Ejemplo n.º 1
0
        public static void Main()
        {
            BasicGameHost host = Host.GetSuitableHost();

            host.Load(new SampleGame());
            host.Run();
        }
Ejemplo n.º 2
0
        internal static void Initialize(BasicGameHost host)
        {
            if (IsInitialized)
            {
                return;
            }

            GLWrapper.host = host;
            resetScheduler.SetCurrentThread();

            MaxTextureSize = Math.Min(2048, GL.GetInteger(GetPName.MaxTextureSize));

            // Create a global vertex array
            int vertexArray;

            GL.CreateVertexArrays(1, out vertexArray);
            GL.BindVertexArray(vertexArray);

            GL.Disable(EnableCap.DepthTest);
            GL.Disable(EnableCap.StencilTest);
            GL.Enable(EnableCap.Blend);
            GL.Enable(EnableCap.ScissorTest);

            IsInitialized = true;
        }
Ejemplo n.º 3
0
        public static void Main()
        {
            BasicGameHost host = Host.GetSuitableHost();

            host.Load(new VisualTestGame());
            host.Run();
        }
Ejemplo n.º 4
0
        public BeatmapImporter(BasicGameHost host, BeatmapDatabase beatmaps = null)
        {
            this.beatmaps = beatmaps;

            channel = new IpcChannel <BeatmapImportMessage>(host);
            channel.MessageReceived += messageReceived;
        }
Ejemplo n.º 5
0
        public BeatmapImporter(BasicGameHost host,  BeatmapDatabase beatmaps = null)
        {
            this.beatmaps = beatmaps;

            channel = new IpcChannel<BeatmapImportMessage>(host);
            channel.MessageReceived += messageReceived;
        }
Ejemplo n.º 6
0
        public override bool Initialize(BasicGameHost host)
        {
            host.InputScheduler.Add(new ScheduledDelegate(delegate
            {
                OpenTK.Input.MouseState state = OpenTK.Input.Mouse.GetCursorState();
                Point point = host.Window.PointToClient(new Point(state.X, state.Y));

                //todo: reimplement if necessary
                //Vector2 pos = Vector2.Multiply(point, Vector2.Divide(host.DrawSize, this.Size));

                Vector2 pos = new Vector2(point.X, point.Y);

                var tkState = new TkMouseState(state, pos);
                if (!host.IsActive)
                {
                    tkState.ButtonStates.ForEach(s => s.State = false);
                    tkState.Wheel = tkState.LastState?.Wheel ?? 0;
                }

                PendingStates.Enqueue(new InputState {
                    Mouse = tkState
                });
            }, 0, 0));

            return(true);
        }
Ejemplo n.º 7
0
        public static void Main(string[] args)
        {
            BasicGameHost host = Host.GetSuitableHost(@"osu-visual-tests");

            host.Add(new VisualTestGame());
            host.Run();
        }
Ejemplo n.º 8
0
 public override void SetHost(BasicGameHost host)
 {
     if (LocalConfig == null)
     {
         LocalConfig = new OsuConfigManager(host.Storage);
     }
     base.SetHost(host);
 }
Ejemplo n.º 9
0
 public static void Main()
 {
     using (BaseGame game = new SampleGame())
         using (BasicGameHost host = Host.GetSuitableHost(@"sample-game"))
         {
             host.Add(game);
             host.Run();
         }
 }
Ejemplo n.º 10
0
 public static void Main()
 {
     using (Game game = new SampleGame())
         using (BasicGameHost host = Host.GetSuitableHost())
         {
             host.Load(game);
             host.Run();
         }
 }
Ejemplo n.º 11
0
        public void SetHost(BasicGameHost host)
        {
            this.host           = host;
            host.ExitRequested += OnExiting;

            form.FormClosing += OnFormClosing;
            form.DragEnter   += dragEnter;
            form.DragDrop    += dragDrop;
        }
Ejemplo n.º 12
0
        private void load(BasicGameHost host)
        {
            atlas = new TextureAtlas(GLWrapper.MaxTextureSize, GLWrapper.MaxTextureSize, true, All.Nearest);

            Add(new FrameStatisticsDisplay(@"Input", host.InputMonitor, atlas));
            Add(new FrameStatisticsDisplay(@"Update", host.UpdateMonitor, atlas));
            Add(new FrameStatisticsDisplay(@"Draw", host.DrawMonitor, atlas));

            Direction = FlowDirection.VerticalOnly;
        }
Ejemplo n.º 13
0
        private OsuGameBase loadOsu(BasicGameHost host)
        {
            var osu = new OsuGameBase();

            host.Add(osu);

            //reset beatmap database (sqlite and storage backing)
            osu.Beatmaps.Reset();

            return(osu);
        }
        public override bool Initialize(BasicGameHost host)
        {
            PressedKeys = new List <Key>();

            host.InputScheduler.Add(new ScheduledDelegate(delegate
            {
                state = host.IsActive ? OpenTK.Input.Keyboard.GetState() : new KeyboardState();
            }, 0, 0));

            return(true);
        }
Ejemplo n.º 15
0
        public override bool Initialize(BasicGameHost host)
        {
            this.host = host;

            host.InputScheduler.Add(new ScheduledDelegate(delegate
            {
                state          = OpenTK.Input.Mouse.GetCursorState();
                nativePosition = host.Window.PointToClient(new Point(state.X, state.Y));
            }, 0, 0));

            return(true);
        }
Ejemplo n.º 16
0
        public override bool Initialize(BasicGameHost host)
        {
            host.InputThread.Scheduler.Add(new ScheduledDelegate(delegate
            {
                PendingStates.Enqueue(new InputState
                {
                    Keyboard = new TkKeyboardState(host.IsActive ? OpenTK.Input.Keyboard.GetState() : new OpenTK.Input.KeyboardState())
                });
            }, 0, 0));

            return(true);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// As Load is run post host creation, you can override this method to alter properties of the host before it makes itself visible to the user.
        /// </summary>
        /// <param name="host"></param>
        public virtual void SetHost(BasicGameHost host)
        {
            this.host     = host;
            host.Exiting += OnExiting;

            if (form != null)
            {
                form.FormClosing += OnFormClosing;
                form.DragEnter   += dragEnter;
                form.DragDrop    += dragDrop;
            }
        }
Ejemplo n.º 18
0
        public static void Main(string[] args)
        {
            using (BasicGameHost host = Host.GetSuitableHost(@"osu-visual-tests"))
            {
                Ruleset.Register(new OsuRuleset());
                Ruleset.Register(new TaikoRuleset());
                Ruleset.Register(new ManiaRuleset());
                Ruleset.Register(new CatchRuleset());

                host.Add(new VisualTestGame());
                host.Run();
            }
        }
Ejemplo n.º 19
0
        public void SetHost(BasicGameHost host)
        {
            MainThread = Thread.CurrentThread;

            this.host     = host;
            host.Exiting += (sender, args) => { OnExiting(this, args); };

            Window = new Window(host);

            form.FormClosing += OnFormClosing;
            form.DragEnter   += dragEnter;
            form.DragDrop    += dragDrop;
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Registers statistics counters to the PerformanceMonitors of the _first_ host
        /// to call this function.
        /// </summary>
        /// <param name="target">The host that wants to register for statistics counters.</param>
        internal static void RegisterCounters(BasicGameHost target)
        {
            if (FrameStatistics.target != null)
            {
                return;
            }

            FrameStatistics.target = target;

            for (StatisticsCounterType i = 0; i < StatisticsCounterType.AmountTypes; ++i)
            {
                getMonitor(i).RegisterCounter(i);
            }
        }
Ejemplo n.º 21
0
        public override void SetHost(BasicGameHost host)
        {
            base.SetHost(host);
            var desktopWindow = host.Window as DesktopGameWindow;

            if (desktopWindow != null)
            {
                desktopWindow.Icon  = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
                desktopWindow.Title = @"osu!lazer";

                desktopWindow.DragEnter += dragEnter;
                desktopWindow.DragDrop  += dragDrop;
            }
        }
Ejemplo n.º 22
0
        private OsuGameBase loadOsu(BasicGameHost host)
        {
            var osu = new OsuGameBase();

            host.Add(osu);

            while (!osu.IsLoaded)
            {
                Thread.Sleep(1);
            }

            //reset beatmap database (sqlite and storage backing)
            osu.Beatmaps.Reset();

            return(osu);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// As Load is run post host creation, you can override this method to alter properties of the host before it makes itself visible to the user.
        /// </summary>
        /// <param name="host"></param>
        public virtual void SetHost(BasicGameHost host)
        {
            if (Config == null)
            {
                Config = new FrameworkConfigManager(host.Storage);
            }

            this.host     = host;
            host.Size     = new Vector2(Config.Get <int>(FrameworkConfig.Width), Config.Get <int>(FrameworkConfig.Height));
            host.Exiting += OnExiting;

            if (Window != null)
            {
                Window.Title = $@"osu.Framework (running ""{Name}"")";
            }
        }
Ejemplo n.º 24
0
        public static void Main(string[] args)
        {
            bool benchmark = args.Length > 0 && args[0] == @"-benchmark";

            BasicGameHost host = Host.GetSuitableHost();

            if (benchmark)
            {
                host.Load(new Benchmark());
            }
            else
            {
                host.Load(new VisualTestGame());
            }
            host.Run();
        }
Ejemplo n.º 25
0
        public static BasicGameHost GetSuitableHost()
        {
            BasicGameHost host = null;

            GraphicsContextFlags flags = GraphicsContextFlags.Default;

            if (RuntimeInfo.IsUnix)
            {
                host = new LinuxGameHost(flags);
            }
            else
            {
                host = new WindowsGameHost(flags);
            }

            return(host);
        }
Ejemplo n.º 26
0
        public static void Main(string[] args)
        {
            bool benchmark = args.Length > 0 && args[0] == @"-benchmark";

            using (BasicGameHost host = Host.GetSuitableHost(@"visual-tests"))
            {
                if (benchmark)
                {
                    host.Add(new Benchmark());
                }
                else
                {
                    host.Add(new VisualTestGame());
                }
                host.Run();
            }
        }
Ejemplo n.º 27
0
        public BeatmapDatabase(BasicStorage storage, BasicGameHost importHost = null)
        {
            this.storage = storage;

            if (importHost != null)
            {
                ipc = new BeatmapImporter(importHost, this);
            }

            if (connection == null)
            {
                connection = storage.GetDatabase(@"beatmaps");
                connection.CreateTable <BeatmapMetadata>();
                connection.CreateTable <BaseDifficulty>();
                connection.CreateTable <BeatmapSetInfo>();
                connection.CreateTable <BeatmapInfo>();
            }
        }
Ejemplo n.º 28
0
        private void load(BasicGameHost host, AudioManager audio)
        {
            this.audio = audio;

            textInput = host.GetTextInput();
            if (textInput != null)
            {
                textInput.OnNewImeComposition += delegate(string s)
                {
                    textUpdateScheduler.Add(() => onImeComposition(s));
                    cursorAndLayout.Invalidate();
                };
                textInput.OnNewImeResult += delegate(string s)
                {
                    textUpdateScheduler.Add(() => onImeResult(s));
                    cursorAndLayout.Invalidate();
                };
            }
        }
Ejemplo n.º 29
0
        internal static void Initialize(BasicGameHost host)
        {
            if (IsInitialized)
            {
                return;
            }

            GLWrapper.host = host;
            resetScheduler.SetCurrentThread();

            MaxTextureSize = Math.Min(2048, GL.GetInteger(GetPName.MaxTextureSize));

            GL.Disable(EnableCap.DepthTest);
            GL.Disable(EnableCap.StencilTest);
            GL.Enable(EnableCap.Blend);
            GL.Enable(EnableCap.ScissorTest);

            IsInitialized = true;
        }
Ejemplo n.º 30
0
        public static void Main(string[] args)
        {
            bool benchmark = args.Length > 0 && args[0] == @"-benchmark";

            using (BasicGameHost host = Host.GetSuitableHost(@"osu"))
            {
                Ruleset.Register(new OsuRuleset());
                Ruleset.Register(new TaikoRuleset());
                Ruleset.Register(new ManiaRuleset());
                Ruleset.Register(new CatchRuleset());

                if (benchmark)
                {
                    host.Add(new Benchmark());
                }
                else
                {
                    host.Add(new VisualTestGame());
                }
                host.Run();
            }
        }
Ejemplo n.º 31
0
        public BeatmapDatabase(BasicStorage storage, BasicGameHost importHost = null)
        {
            this.storage = storage;

            if (importHost != null)
            {
                ipc = new BeatmapImporter(importHost, this);
            }

            if (connection == null)
            {
                try
                {
                    connection = prepareConnection();
                }
                catch
                {
                    Console.WriteLine(@"Failed to initialise the beatmap database! Trying again with a clean database...");
                    storage.DeleteDatabase(@"beatmaps");
                    connection = prepareConnection();
                }
            }
        }
Ejemplo n.º 32
0
        private OsuGameBase loadOsu(BasicGameHost host)
        {
            var osu = new OsuGameBase();
            host.Add(osu);

            while (!osu.IsLoaded)
                Thread.Sleep(1);

            //reset beatmap database (sqlite and storage backing)
            osu.Dependencies.Get<BeatmapDatabase>().Reset();

            return osu;
        }
Ejemplo n.º 33
0
 public override void SetHost(BasicGameHost host)
 {
     if (Config == null)
         Config = new OsuConfigManager(host.Storage);
     base.SetHost(host);
 }
Ejemplo n.º 34
0
Archivo: OsuGame.cs Proyecto: yheno/osu
        public override void SetHost(BasicGameHost host)
        {
            base.SetHost(host);

            host.Size = new Vector2(Config.Get<int>(OsuConfig.Width), Config.Get<int>(OsuConfig.Height));
        }
Ejemplo n.º 35
0
Archivo: Player.cs Proyecto: yheno/osu
 public PlayerInputManager(BasicGameHost host)
     : base(host)
 {
 }