示例#1
0
        public GraphicWindow(uint height = 800, uint width = 600, uint frameLimit = 30, bool VSync = true, uint anitialisingLvl = 4)
        {
            ContextSettings set = new ContextSettings(1, 1, anitialisingLvl);

            Window = new RenderWindow(new VideoMode(width, height), "Graphic", Styles.Default, set);
            DispatchWindowEvents(frameLimit, VSync);
        }
示例#2
0
        public void Run()
        {
            ContextSettings contextSettings = new ContextSettings(64, 64, 4);
            VideoMode       mode            = new VideoMode(800, 800);
            RenderWindow    window          = new RenderWindow(mode, "Chess", Styles.Default);

            window.SetVerticalSyncEnabled(true);
            window.SetFramerateLimit(241);

            window.KeyPressed          += Window_KeyPressed;
            window.Closed              += OnClosed;
            window.Resized             += OnResize;
            window.MouseButtonPressed  += OnMouseButtonPressed;
            window.MouseButtonReleased += OnMouseButtonReleased;
            window.MouseMoved          += OnMouseMove;
            window.KeyPressed          += OnKeyPressed;

            gameWidget = new GameWidget(new SFML.System.Vector2f(800, 800));

            while (window.IsOpen)
            {
                window.DispatchEvents();
                window.Clear(Color.Black);
                window.Draw(gameWidget);
                window.Display();
            }
        }
示例#3
0
        private void RenderLoopWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            ContextSettings contextSettings = new ContextSettings()
            {
                AntialiasingLevel = 8
            };

            RendWind = new RenderWindow((IntPtr)e.Argument, contextSettings);
            RendWind.SetFramerateLimit(60);


            Clock clock = new Clock();

            while (RendWind.IsOpen)
            {
                Time elapsed = clock.ElapsedTime;
                clock.Restart();
                RendWind.DispatchEvents();
                RendWind.Clear(new Color(BackColor.R, BackColor.G, BackColor.B));
                //RendWind.Clear(Color.Black);

                UpdateVertsPositions(elapsed);
                UpdateCamera();
                DrawStuff();

                RendWind.Display();
            }
        }
示例#4
0
        static void ShowScreensaver()
        {
            ContextSettings contextSettings = new ContextSettings()
            {
                AntialiasingLevel = 8
            };
            RenderWindow window = new RenderWindow(new VideoMode(), "Ustawienia pokazu slajdów", Styles.Fullscreen, contextSettings);

            window.SetFramerateLimit(20);
            window.SetMouseCursorVisible(false);
            window.Closed += (object sender, EventArgs e) => { window.Close(); };

            Theme.Load(PATH + "theme.ini", "light");
            HlyssApp app = new HlyssApp(window);

            app.Root.Children.Add(new SlideShow());

            while (window.IsOpen)
            {
                window.Clear();
                window.DispatchEvents();

                app.Update();
                app.Draw();

                window.Display();
            }
        }
示例#5
0
        private GraphicWindow()
        {
            ContextSettings set = new ContextSettings(1, 1, 4);

            Window = new RenderWindow(new VideoMode(800, 600), "Graphic", Styles.Default, set);
            DispatchWindowEvents(20, true);
        }
示例#6
0
        private void CreateSFMLWindow()
        {
            if (MainWindow != null)
            {
                throw new InvalidOperationException("Cannot recreate SFML window once created!");
            }
            Styles sfmlStyles = 0;

            switch (CurrentMode.Style)
            {
            case WindowStyle.Windowed:
                sfmlStyles = Styles.Titlebar | Styles.Close;
                break;

            case WindowStyle.FullScreen:
                sfmlStyles = Styles.Fullscreen;
                break;
            }

            var sfmlContext = new ContextSettings(0, 0);

            MainWindow = new SFML.Graphics.RenderWindow(
                new VideoMode(
                    (uint)CurrentMode.Width,
                    (uint)CurrentMode.Height,
                    64
                    ), Title, sfmlStyles, sfmlContext);
        }
示例#7
0
 public GameWindow(VideoMode video, string title, Styles styles, ContextSettings settings)
     : base(video, title, styles, settings)
 {
     Closed += (s, e) => Close();
     Bus     = new Bus();
     Bus.Subscribe(this);
 }
示例#8
0
 public WindowSettingsChangedArgs(ContextSettings settings, VideoMode videomode, bool vsync, bool fullscreen)
 {
     this.settings   = settings;
     this.videomode  = videomode;
     this.vsync      = vsync;
     this.fullscreen = fullscreen;
 }
示例#9
0
        //public CrossWindow(string id) : base(id)
        public CrossWindow(string id, bool createWindow = true) : base(id)
        {
            _Manager.InitializeAllManagers();

            var settings = new ContextSettings {
                AntialiasingLevel = 4
            };

            Clock = new Clock();

            if (createWindow)
            {
                RenderWindow = new RenderWindow(new VideoMode(800, 600), id, Styles.Default, settings);
                RenderWindow.SetFramerateLimit(60);

                RenderWindow.Closed  += RenderWindowOnClosed;
                RenderWindow.Resized += (sender, args) =>
                {
                    RenderWindow.SetView(new View(new FloatRect(0, 0, args.Width, args.Height)));
                    ForceUpdate();
                };
                RenderWindow.MouseMoved         += RenderWindowOnMouseMoved;
                RenderWindow.MouseButtonPressed += RenderWindowOnMouseButtonPressed;
            }

            FPSText = new Text("00", FontManager.CurrentFont)
            {
                FillColor = new Color(255, 0, 0), CharacterSize = 24, DisplayedString = "00"
            };
        }
示例#10
0
        /// <summary>
        /// Initialises a new instance of the <see cref="Program"/> class,
        /// </summary>
        static Program()
        {
            ReadConfigFile();

            bodies       = BodyGenerator.GenerateBodies(configuration.BodyCount, true);
            bodyShapeMap = BodyGenerator.GenerateShapes(bodies, BodyGenerator.DefaultRadiusDelegate, BodyGenerator.RainbowColourDelegate);

            UpdateDelegate bodyPositionUpdater = BodyUpdater.UpdateBodiesBarnesHut;

            ContextSettings customContextSettings = new ContextSettings {
                AntialiasingLevel = 8, DepthBits = 24, StencilBits = 8
            };

            RenderWindow simulationWindow =
                new RenderWindow(VideoMode.DesktopMode, "N-Body Simulation: FPS ", Styles.Default, customContextSettings);

            PrintContextSettings(customContextSettings);

            IInputHandler simulationInputHandler = new SimulationInputHandler(ref bodies);

            simulationScreen = new SimulationScreen(simulationWindow, simulationInputHandler, ref bodies, ref bodyShapeMap, bodyPositionUpdater)
            {
                Configuration = configuration,
            };
        }
示例#11
0
        /// <summary>
        /// Create a new graphics window with the specified dimensions and title
        /// </summary>
        /// <param name="title">The title of the window</param>
        /// <param name="width">The width of the window</param>
        /// <param name="height">The height of the window</param>
        /// <param name="fullScreen">Whether the window should be in fullscreen (ignore width/height)</param>
        /// <param name="antialiasingLevel">The antialiasing level of the window</param>
        public static void Create(string title = "Window", int width = 640, int height = 480, bool fullScreen = false, uint antialiasingLevel = 0)
        {
            ContextSettings contextSettings = new ContextSettings();

            contextSettings.AntialiasingLevel = antialiasingLevel;

            _window = new RenderWindow(
                mode: fullScreen ? VideoMode.DesktopMode : new VideoMode((uint)width, (uint)height),
                title: title,
                style: fullScreen ? Styles.Fullscreen : Styles.Default,
                settings: contextSettings
                );

            if (!fullScreen)
            {
                _window.Position = new Vector2i(
                    (int)VideoMode.DesktopMode.Width / 2 - width / 2,
                    (int)VideoMode.DesktopMode.Height / 2 - height / 2
                    );
            }

            _window.Closed             += new EventHandler(OnClose);
            _window.KeyPressed         += new EventHandler <KeyEventArgs>(OnKeyPress);
            _window.KeyReleased        += new EventHandler <KeyEventArgs>(OnKeyRelease);
            _window.MouseButtonPressed += new EventHandler <MouseButtonEventArgs>(OnMouseButtonPress);
            _window.MouseWheelScrolled += new EventHandler <MouseWheelScrollEventArgs>(OnMouseWheelScroll);
            _window.MouseMoved         += new EventHandler <MouseMoveEventArgs>(OnMouseMove);

            _window.Clear(_backgroundColor);
            _window.Display();
        }
示例#12
0
        static void ShowSettings()
        {
            ContextSettings contextSettings = new ContextSettings()
            {
                AntialiasingLevel = 8
            };
            RenderWindow window = new RenderWindow(new VideoMode(400, 230), "Ustawienia pokazu slajdów", Styles.Close, contextSettings);

            window.SetFramerateLimit(60);
            window.Closed += (object sender, EventArgs e) => { window.Close(); };

            Theme.Load(PATH + "theme.ini", "light");
            HlyssApp app = new HlyssApp(window);

            app.Root.Children.Add(new SettingsComponent());

            while (window.IsOpen)
            {
                window.Clear(Theme.GetColor("primary"));
                window.DispatchEvents();

                app.Update();
                app.Draw();

                window.Display();
            }
        }
示例#13
0
        public SFMLWindow(string name)
        {
            var contextSettings = new ContextSettings
            {
                DepthBits = 24
            };

            _window = new RenderWindow(new VideoMode(_windowWidth, _windowHeight), name, Styles.Default, contextSettings);
            _window.SetActive();

            _window.SetVisible(true);
            _window.SetVerticalSyncEnabled(true);

            _window.Closed              += OnClosed;
            _window.KeyPressed          += OnKeyPressed;
            _window.TextEntered         += OnTextEntered;
            _window.Resized             += OnResized;
            _window.MouseButtonPressed  += OnMouseButtonPressed;
            _window.MouseButtonReleased += OnMouseButtonReleased;
            _window.MouseMoved          += OnMouseMoved;
            _window.MouseWheelMoved     += OnMouseWheelMoved;

            _window.SetFramerateLimit(60);

            OnResized(null, new SizeEventArgs(new SizeEvent {
                Width = _windowWidth, Height = _windowHeight
            }));
        }
示例#14
0
        static void Main(string[] args)
        {
            Boundary b1 = new Boundary(0, 100, 100, 0);

            ContextSettings settings = new ContextSettings()
            {
                DepthBits         = 24,
                StencilBits       = 8,
                AntialiasingLevel = 4,
                MajorVersion      = 3,
                MinorVersion      = 0
            };

            VideoMode    screenSize = new VideoMode(Width, Height, 24);
            RenderWindow window     = new RenderWindow(screenSize, "SimpleRayCasting", Styles.Resize | Styles.Close, settings);

            window.SetFramerateLimit(60);
            window.SetVerticalSyncEnabled(true);
            window.SetActive(false);
            window.RequestFocus();

            while (window.IsOpen)
            {
                window.DispatchEvents();
                window.Clear();
                b1.DrawBoundary(ref window);
                window.Display();
            }
        }
示例#15
0
        static void Main(string[] _)
        {
            var settings = new ContextSettings()
            {
                AntialiasingLevel = 8,
            };

            var configuration = new ScreenConfiguration();

            configuration.Width  = 1920;
            configuration.Height = 1080;

            var window = new RenderWindow(
                new VideoMode(configuration.Width, configuration.Height),
                "Dashboard",
                Styles.Default,
                settings);

            Image im = new Image("..\\..\\..\\Icon.png");

            window.SetIcon(64, 64, im.Pixels);
            window.SetVerticalSyncEnabled(true);

            var application = new Application(window, configuration);

            application.Start();
        }
示例#16
0
        public void Run()
        {
            r = new Random();
            Clock c = new Clock();

            GenerateImage();
            int dur = c.ElapsedTime.AsMilliseconds();

            duration.DisplayedString = Convert.ToString(dur);
            ContextSettings cs = new ContextSettings();

            cs.AntialiasingLevel = 4;
            VideoMode    mode   = new VideoMode(800, 600, 32);
            RenderWindow window = new RenderWindow(mode, "Space Scene Window", Styles.Close | Styles.Titlebar, cs);

            window.Closed     += (object sender, EventArgs e) => window.Close();
            window.KeyPressed += KeyPress;
            while (window.IsOpen)
            {
                window.DispatchEvents();
                window.Clear();
                window.Draw(s);
                window.Draw(duration);
                window.Display();
            }
        }
示例#17
0
        private void ReinitializeWindow()
        {
            if (_renderSetup == null)
            {
                return;
            }

            _renderSetup.Resize((int)XGrid.ActualWidth, (int)XGrid.ActualHeight);
            _D3DImageContainer.SetBackBufferSharpDX(_renderSetup.SharedTexture);

            var contextSettings = new ContextSettings();

            contextSettings.DisplayMode = new SharpDX.Direct3D9.DisplayMode()
            {
                Width       = _renderSetup.WindowWidth,
                Height      = _renderSetup.WindowHeight,
                RefreshRate = 60,
                Format      = D3DImageSharpDX.TranslateFormat(_renderSetup.SharedTexture)
            };
            contextSettings.AspectRatio = contextSettings.DisplayMode.AspectRatio;

            _defaultContext = OperatorPartContext.createDefault(contextSettings);

            if (_operator != null && _operator.Outputs.Count > 0)
            {
                var invalidator = new OperatorPart.InvalidateVariableAccessors("AspectRatio");
                _operator.Outputs[0].TraverseWithFunction(null, invalidator);
            }

            RenderContent();
        }
示例#18
0
        public void RunPreview()
        {
            var context = new ContextSettings {
                DepthBits = 24, AntialiasingLevel = 16
            };

            this._renderWindow = new RenderWindow(this.Handle, context);
            this._renderWindow.SetActive(true);

            this._timer = new DispatcherTimer {
                Interval = new TimeSpan(0, 0, 0, 0, 1000 / 60)
            };
            this._timer.Tick += MainLoop;
            this._timer.Start();

            this._tankColor    = Color.Green;
            this._colorChanged = false;
            // NOTE MACIEK: Zmiana wielkości czołgu w konstruktorze, a jego przemieszczanie w position
            this._tank = new Tank(20f)
            {
                FillColor   = _tankColor,
                Position    = new Vector2f(65f, 50f),
                TurretAngle = 90
            };
        }
示例#19
0
        public void ChangeWindowSettings(uint width, uint height, uint anitialisingLvl, uint fpsLimit, bool isVsync, int maxItemCount)
        {
            ContextSettings set = new ContextSettings(1, 1, anitialisingLvl);

            Window = new RenderWindow(new VideoMode(width, height), "Graphic", Styles.Default, set);
            DispatchWindowEvents(fpsLimit, isVsync);
            SetRectangleLimit((uint)maxItemCount);
        }
示例#20
0
        public VideoSettings()
        {
            WindowStyle    = Styles.Default; // Titlebar + Resize + Close
            WindowSettings = VideoMode.DesktopMode;

            OpenGLSettings = new ContextSettings();
            RefreshRate    = 30;
        }
示例#21
0
        public VideoSettings()
        {
            _windowStyle = Styles.Default; // Titlebar + Resize + Close
            _videoMode   = VideoMode.DesktopMode;

            _glContextSettings = new ContextSettings();
            _refreshRate       = 30;
        }
示例#22
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Create the render-texture with the given dimensions and
 /// a ContextSettings.
 /// </summary>
 /// <param name="width">Width of the render-texture</param>
 /// <param name="height">Height of the render-texture</param>
 /// <param name="settings">A ContextSettings struct representing settings for the RenderTexture</param>
 ////////////////////////////////////////////////////////////
 public RenderTexture(uint width, uint height, ContextSettings contextSettings) :
     base(sfRenderTexture_createWithSettings(width, height, contextSettings))
 {
     myDefaultView = new View(sfRenderTexture_getDefaultView(CPointer));
     myTexture     = new Texture(sfRenderTexture_getTexture(CPointer));
     GC.SuppressFinalize(myDefaultView);
     GC.SuppressFinalize(myTexture);
 }
示例#23
0
        public SfmlVisualizer()
        {
            // init sprites
            background = Sprites.Background_Union();

            // init fonts
            var courierFontFileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "cour.ttf");

            if (!File.Exists(courierFontFileName))
            {
                courierFontFileName = Path.Combine(Settings.Default.ResourcesDir, "cour.ttf");
                if (!File.Exists(courierFontFileName))
                {
                    MessageBox.Show($"cour.ttf could not be found, please copy it into the folder '{Settings.Default.ResourcesDir}'");
                }
            }
            courier = new Font(courierFontFileName);

            // init window
            var contextSettings = new ContextSettings();

            WindowSizeW = Settings.Default.WindowSizeW;
            WindowSizeH = Settings.Default.WindowSizeH;
            window      = new RenderWindow(new VideoMode(WindowSizeW, WindowSizeH), "AI Cup 2016 Visualizer", Styles.Resize | Styles.Close, contextSettings);
            window.SetVerticalSyncEnabled(false);
            window.Closed += OnClose;
            // window.Resized += OnResized;
            window.MouseWheelScrolled  += WindowOnMouseWheelScrolled;
            window.KeyPressed          += WindowOnKeyPressed;
            window.MouseButtonReleased += WindowOnMouseButtonReleased;
            window.MouseMoved          += WindowOnMouseMoved;

            // generate background random tiles
            tmpTexture = new RenderTexture((uint)mapSize.X, (uint)mapSize.Y);
            tmpTexture.Draw(background);
            DrawGroundRandomTiles(tmpTexture);
            tmpTexture.Display();
            background = new Sprite(tmpTexture.Texture);
            // background.Texture.CopyToImage().SaveToFile(Path.Combine(Settings.Default.ResourcesDir, "1.bmp"));

            // init views
            defaultView        = window.DefaultView;
            worldView          = new View(new FloatRect(0, 0, mapSize.X, mapSize.Y));
            worldTexture       = new RenderTexture((uint)mapSize.X, (uint)mapSize.Y);
            visibleAreaTexture = new RenderTexture((uint)mapSize.X, (uint)mapSize.Y);
            minimapTexture     = new RenderTexture((uint)mapSize.X, (uint)mapSize.Y);
            minimapView        = new View(new FloatRect(0, 0, mapSize.X, mapSize.Y));

            // init other stuff
            clock               = new Clock();
            observeTarget       = Settings.Default.ObserveTarget;
            showDebugInfo       = false;
            showHealth          = false;
            showMinimap         = Settings.Default.ShowMinimap;
            ForceSmooth         = false;
            showWayPoints       = false;
            Audios.EnabledAudio = Settings.Default.EnableAudio;
        }
        private void OnLoadedHandler(object sender, RoutedEventArgs e)
        {
            App.Current.UpdateAfterUserInteractionEvent   += App_UpdateAfterUserInteractionHandler;
            App.Current.UpdateRequiredAfterUserInteraction = true;

            var contextSettings = new ContextSettings();

            _defaultContext = OperatorPartContext.createDefault(contextSettings);
        }
示例#25
0
 /// <summary>
 /// Prints details about the given <see cref="ContextSettings"/> instance.
 /// </summary>
 /// <param name="settings">The settings to print.</param>
 private static void PrintContextSettings(ContextSettings settings)
 {
     Console.WriteLine($"AA Level: {settings.AntialiasingLevel}, " +
                       $"Depth Bits: {settings.DepthBits}, " +
                       $"Stencil Bits: {settings.StencilBits}, " +
                       $"SRGB Capable: {settings.SRgbCapable}, " +
                       $"Attributes: {settings.AttributeFlags}, " +
                       $"Version: {settings.MajorVersion}.{settings.MinorVersion}");
 }
示例#26
0
        static void Main(string[] args)
        {
            ContextSettings contextSettings = new ContextSettings()
            {
                DepthBits         = 32,
                AntialiasingLevel = 8
            };

            Window = new RenderWindow(new VideoMode(700, 500), "Client", Styles.Default, contextSettings);
            Window.SetFramerateLimit(61);
            Window.SetActive();
            Window.Closed  += Window_Closed;
            Window.Resized += Window_Resized;

            sL = new GUI.ScanLines();
            Program.CConsole = new GUI.Console();
            TestMenu         = new TestMenu();

            Map = new GUI.Map();

            /*
             * PlayerName = LoadName();
             * CNetwork = new Network();
             * CConsole = new GUI.Console();
             * DebugView dv = new DebugView();*/
            PreShakeView = Window.GetView();
            Random random = new Random(DateTime.Now.Millisecond);

            while (Window.IsOpen())
            {
                Window.DispatchEvents();
                Window.Clear(new Color(50, 50, 50));
                if (OnUpdate != null)
                {
                    OnUpdate.Invoke();
                }

                if (Shake)
                {
                    View view = Window.GetView();
                    view.Move(new Vector2f(random.Next(-2, 3), random.Next(-2, 2)));
                    Window.SetView(view);
                }
                else
                {
                    View newView = new View(new FloatRect(0, 0, Window.Size.X, Window.Size.Y));
                    Window.SetView(newView);
                }

                ElapsedGameTime++;
                if (OnDraw != null)
                {
                    OnDraw.Invoke();
                }
                Window.Display();
            }
        }
示例#27
0
文件: App.cs 项目: Koneke/Eien
        public App()
        {
            Random   = new Random();
            settings = new ContextSettings();

            // Defaults.
            ClearColor = Color.Cyan;
            videoMode  = new VideoMode(1280, 720);
        }
示例#28
0
        public void Init()
        {
            ContextSettings settings = new ContextSettings();

            settings.DepthBits    = 24;
            settings.MajorVersion = 3;
            settings.MinorVersion = 3;

            _window = new RenderWindow(new VideoMode((uint)Globals.windowSize.X, (uint)Globals.windowSize.Y), "Space Invader");
            _window.SetFramerateLimit(60);
        }
示例#29
0
        public Game(VideoMode vMode, string title, Styles styles, ContextSettings ctxSettings)
            : base(vMode, title, styles, ctxSettings)
        {
            _videoMode   = vMode;
            _title       = title;
            _styles      = styles;
            _ctxSettings = ctxSettings;
            _hasScene    = false;

            // base.SetFramerateLimit(60);
        }
示例#30
0
    public Game()
    {
        this.clock            = new Clock();
        this.deltaTime        = 0.0f;
        this.deltaTimeCounter = 0.0f;

        this.width  = 1500;
        this.height = 750;

        this.bird            = new SoundBuffer("C:\\Users\\Alfred\\RiderProjects\\VoxelSpace\\VoxelSpace\\bird.wav");
        this.ambience        = new Sound(this.bird);
        this.ambience.Loop   = true;
        this.ambience.Volume = 40f;

        this.music     = new SoundBuffer("C:\\Users\\Alfred\\RiderProjects\\VoxelSpace\\VoxelSpace\\song.wav");
        this.song      = new Sound(this.music);
        this.song.Loop = true;

        this.copyBuffer = this.music.Samples;

        this.view2D          = new View(new FloatRect(0f, 0f, this.width / 2f, this.height));
        this.view2D.Viewport = new FloatRect(0f, 0f, 0.5f, 1f);
        this.view3D          = new View(new FloatRect(0f, 0f, this.width / 2f, this.height));
        this.view3D.Viewport = new FloatRect(0.5f, 0f, 1f, 1f);

        ContextSettings contextSettings = new ContextSettings();

        //contextSettings.AntialiasingLevel = 8;

        this.window = new RenderWindow(new VideoMode(this.width, this.height), "Voxel Space", Styles.Default, contextSettings);
        //this.window.SetIcon();
        //this.window.SetFramerateLimit(5000);
        this.window.SetVerticalSyncEnabled(true);
        this.window.SetKeyRepeatEnabled(false);

        this.window.Closed              += this.OnClose;
        this.window.Resized             += this.OnResize;
        this.window.KeyPressed          += this.OnKeyPressed;
        this.window.KeyReleased         += this.OnKeyReleased;
        this.window.MouseMoved          += this.OnMouseMoved;
        this.window.MouseButtonPressed  += this.OnMousePressed;
        this.window.MouseButtonReleased += this.OnMouseReleased;
        this.window.MouseWheelScrolled  += this.OnMouseScrolled;

        this.shipPos            = new Vector2f(this.width / 4f, this.height / 2f);
        this.shipVec            = new Vector2f(0f, -1f);
        this.shipVel            = 0f;
        this.shipShape          = new CircleShape(16);
        this.shipShape.Position = this.shipPos;
        this.shipShape.Origin   = new Vector2f(16, 16);

        this.turnLeft  = false;
        this.turnRight = false;
    }
示例#31
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Create the window
 /// </summary>
 /// <param name="mode">Video mode to use</param>
 /// <param name="title">Title of the window</param>
 /// <param name="style">Window style (Resize | Close by default)</param>
 /// <param name="settings">Creation parameters</param>
 ////////////////////////////////////////////////////////////
 public Window(VideoMode mode, string title, Styles style, ContextSettings settings)
     : base(sfWindow_Create(mode, title, style, ref settings))
 {
 }
示例#32
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Create the window from an existing control
 /// </summary>
 /// <param name="Handle">Platform-specific handle of the control</param>
 /// <param name="settings">Creation parameters</param>
 ////////////////////////////////////////////////////////////
 public Window(IntPtr Handle, ContextSettings settings)
     : base(sfWindow_CreateFromHandle(Handle, ref settings))
 {
 }
示例#33
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Create the window
 /// </summary>
 /// <param name="mode">Video mode to use</param>
 /// <param name="title">Title of the window</param>
 /// <param name="style">Window style (Resize | Close by default)</param>
 /// <param name="settings">Creation parameters</param>
 ////////////////////////////////////////////////////////////
 public Window(VideoMode mode, string title, Styles style, ContextSettings settings)
     : base(sfWindow_Create(mode, title, style, ref settings))
 {
     myInput = new Input(sfWindow_GetInput(This));
 }
示例#34
0
	// Use this for initialization
	void Start () {
		#if COHERENT_UI_EVALUATION_UNITY3D
			StartActivator();
		#endif

		if (SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 11")
				|| SystemInfo.operatingSystem.Contains("Mac"))
		{
			DeviceSupportsSharedTextures = true;
		}

		if (m_UISystem == null)
		{
			m_SystemListener = (SystemListenerFactoryFunc != null)? SystemListenerFactoryFunc(this.OnSystemReady) : new SystemListener(this.OnSystemReady);
			if (FileHandlerFactoryFunc != null)
			{
				m_FileHandler = FileHandlerFactoryFunc();
			}
			#if !UNITY_ANDROID || UNITY_EDITOR

			if (m_FileHandler == null)
			{
				Debug.LogWarning("Unable to create file handler using factory function! Falling back to default handler.");
				m_FileHandler = new UnityFileHandler();
			}
			#endif

			#if UNITY_EDITOR || COHERENT_UNITY_STANDALONE || COHERENT_UNITY_UNSUPPORTED_PLATFORM
			ContextSettings settings = new ContextSettings()
			{
				EnableProxy = this.EnableProxy,
				AllowCookies = this.AllowCookies,
				CookiesResource = "file:///" + Application.persistentDataPath + '/' + this.CookiesResource,
				CachePath = Path.Combine(Application.temporaryCachePath, this.CachePath),
				HTML5LocalStoragePath = Path.Combine(Application.temporaryCachePath, this.HTML5LocalStoragePath),
				ForceDisablePluginFullscreen = this.ForceDisablePluginFullscreen,
				DisableWebSecurity = this.DisableWebSecurity,
				DebuggerPort = this.DebuggerPort,
			};
			#elif UNITY_IPHONE || UNITY_ANDROID
			ContextSettings settings = new ContextSettings() {
				iOS_UseURLCache = m_UseURLCache,
				iOS_URLMemoryCacheSize = (uint)m_MemoryCacheSize,
				iOS_URLDiskCacheSize = (uint)m_DiskCacheSize,
			};
			int sdkVersion = Coherent.UI.Mobile.Versioning.SDKVersion;
			#endif

			if (string.IsNullOrEmpty(Coherent.UI.License.COHERENT_KEY))
			{
				throw new System.ApplicationException("You must supply a license key to start Coherent UI! Follow the instructions in the manual for editing the License.cs file.");
			}

			m_UISystem = CoherentUILibrary.CreateViewContext(
				settings, m_SystemListener, m_FileHandler);
			if (m_UISystem == null)
			{
				throw new System.ApplicationException("Creating a ViewContext"
					+ " failed!");
			}
			Debug.Log ("Coherent UI system initialized..");
			#if UNITY_EDITOR || COHERENT_UNITY_STANDALONE
			CoherentUIViewRenderer.WakeRenderer(
				(byte)m_UISystem.GetContextId());
			#endif
		}
		m_StartTime = Time.realtimeSinceStartup;

		DontDestroyOnLoad(this.gameObject);
	}
示例#35
0
		/// <summary>
		/// Creates a new ViewContext
		/// </summary>
		/// <param name="ctxSettings">Settings for the context</param>
		/// <param name="listener">Listener for events for the context</param>
		/// <param name="fileHandler">File handler for the context</param>
		/// <returns>the newly created ViewContext</returns>
		public static ViewContext CreateViewContext(ContextSettings ctxSettings,
													ContextListener listener,
													FileHandler fileHandler)
		{
			var context = Instance.ContextFactory.CreateViewContext(
				ctxSettings, listener, fileHandler);
			Instance.m_Contexts.Add(context);

			return context;
		}
示例#36
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Create the window from an existing control
 /// </summary>
 /// <param name="handle">Platform-specific handle of the control</param>
 /// <param name="settings">Creation parameters</param>
 ////////////////////////////////////////////////////////////
 public RenderWindow(IntPtr handle, ContextSettings settings)
     : base(sfRenderWindow_CreateFromHandle(handle, ref settings), 0)
 {
     Initialize();
 }
示例#37
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Create the window
 /// </summary>
 /// <param name="mode">Video mode to use</param>
 /// <param name="title">Title of the window</param>
 /// <param name="style">Window style (Resize | Close by default)</param>
 /// <param name="settings">Creation parameters</param>
 ////////////////////////////////////////////////////////////
 public RenderWindow(VideoMode mode, string title, Styles style, ContextSettings settings)
     : base(sfRenderWindow_Create(mode, title, style, ref settings), 0)
 {
     Initialize();
 }
示例#38
0
 static extern IntPtr sfRenderWindow_CreateFromHandle(IntPtr Handle, ref ContextSettings Params);
示例#39
0
 static extern IntPtr sfRenderWindow_Create(VideoMode Mode, string Title, Styles Style, ref ContextSettings Params);
示例#40
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Create the window from an existing control
 /// </summary>
 /// <param name="Handle">Platform-specific handle of the control</param>
 /// <param name="settings">Creation parameters</param>
 ////////////////////////////////////////////////////////////
 public Window(IntPtr Handle, ContextSettings settings)
     : base(sfWindow_CreateFromHandle(Handle, ref settings))
 {
     myInput = new Input(sfWindow_GetInput(This));
 }