示例#1
0
        public static void Main()
        {
            BasicGameHost host = Host.GetSuitableHost();

            host.Load(new SampleGame());
            host.Run();
        }
示例#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;
        }
示例#3
0
        public static void Main()
        {
            BasicGameHost host = Host.GetSuitableHost();

            host.Load(new VisualTestGame());
            host.Run();
        }
示例#4
0
        public BeatmapImporter(BasicGameHost host, BeatmapDatabase beatmaps = null)
        {
            this.beatmaps = beatmaps;

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

            channel = new IpcChannel<BeatmapImportMessage>(host);
            channel.MessageReceived += messageReceived;
        }
示例#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);
        }
示例#7
0
文件: Program.cs 项目: UgiNyaa/osu
        public static void Main(string[] args)
        {
            BasicGameHost host = Host.GetSuitableHost(@"osu-visual-tests");

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

            form.FormClosing += OnFormClosing;
            form.DragEnter   += dragEnter;
            form.DragDrop    += dragDrop;
        }
        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;
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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;
            }
        }
示例#18
0
文件: Program.cs 项目: fystir/osu
        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();
            }
        }
示例#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;
        }
示例#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);
            }
        }
示例#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;
            }
        }
示例#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);
        }
示例#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}"")";
            }
        }
示例#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();
        }
示例#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);
        }
示例#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();
            }
        }
示例#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>();
            }
        }
示例#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();
                };
            }
        }
示例#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;
        }
示例#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();
            }
        }
示例#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();
                }
            }
        }
示例#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;
        }
示例#33
0
文件: OsuGameBase.cs 项目: yheno/osu
 public override void SetHost(BasicGameHost host)
 {
     if (Config == null)
         Config = new OsuConfigManager(host.Storage);
     base.SetHost(host);
 }
示例#34
0
文件: OsuGame.cs 项目: 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));
        }
示例#35
0
文件: Player.cs 项目: yheno/osu
 public PlayerInputManager(BasicGameHost host)
     : base(host)
 {
 }