Esempio n. 1
0
        static void Main()
        {
            var settings = new ApplicationSettings()
            {
                WindowCaption = String.Format("{0} {1}", NAME, VERSION),
                FramerateLimit = 200,
                VideoMode = new VideoMode(1024, 600),
                Fullscreen = false,
                VerticalSyncEnabled = true,
                MouseCursorVisible = true,
                EnableLights = true,
            };

            var app = new Application(settings, new Init());
            app.Run();
        }
Esempio n. 2
0
        public Game(GameSettings settings, Scene scene, Application app)
        {
            App = app;

            Settings = settings;
            TickInterval = settings.TickInterval;

            Scene = scene;
            Scene.Camera.LockOffset = Settings.CameraLockOffset;
            Scene.PhysicsQuality = Settings.PhysicsQuality;
            Scene.Camera.ReactionSpeed = Settings.CameraSpeed;
            Scene.Gravity = Settings.Gravity;
            if (Settings.PhysicsStaticResistance != 0)
                Scene.Physics.StaticResistance = Settings.PhysicsStaticResistance;

            View = new GameView();
            if (!String.IsNullOrEmpty(Settings.Background))
            {
                var bgTexture = ResourceManager.GetTexture(Settings.Background);
                bgTexture.Repeated = true;
                View.Background = bgTexture;
            }

            View.SpriteSet = Settings.Textures
                .ToDictionary(kv => kv.Key, kv => new Sprite(ResourceManager.GetTexture(kv.Value)));
            View.SpriteSet[0] = new Sprite();

            logicLock = new Mutex();
            KeysPressed = new HashSet<Keyboard.Key>();

            timer = new System.Timers.Timer(TickInterval);
            timer.Elapsed += Act;
            timer.AutoReset = true;

            Listener.GlobalVolume = 100;
            Listener.Direction = new Vector3f(1, 0, 0);

            render = new Render(App.Window, App.Settings.EnableLights);
        }