Exemplo n.º 1
0
    public void Render()
    {
        while (running)
        {
            IDevice iDevice = IDevice.Get();
            GDevice gDevice = GDevice.Get();
            LightFireCS.MessageHandler.Get().ProcessEvents();

            if (iDevice.GetKeyState(Tao.Sdl.Sdl.SDLK_ESCAPE))
            {
                running = false;
            }

            gDevice.BeginRender();
            gDevice.SetPerspectiveView();
            camera.UpdatePOCamera();

            blockgNode.Render(camera.ViewFrustum);
            octtreeNode.Render(camera.ViewFrustum);

            //gDevice.SetOrthoView();
            //hud.Render();
            gDevice.EndRender();
        }
    }
Exemplo n.º 2
0
    public void Init()
    {
        GDevice.Get().CreateDevice(640, 480, 32, false);
        GDevice.Get().SetWindowText("Gui Controls");

        style = new StyleFactory("res/gui/default.xml");

        boxBackground = new Box(new Rect(0, 0, 640, 480), new Color(160, 196, 255));

        windowQuit = new Window(new Rect(100, 100, 380, 364), "Main Window", style, "testwindow");
        windowText = new Window(new Rect(300, 120, 640, 400), "Text Window", style);
        WindowManager.Get().RegisterWindow(windowText);
        WindowManager.Get().RegisterWindow(windowQuit);

        btnWindowQuitQuit           = new Button(windowQuit, new Rect(12, 32, 268, 64), "Quit", style);
        btnWindowQuitQuit.LeftDown += new EventHandler(OnButtonWindowQuitQuit);
        progressBar       = new ProgressBar(windowQuit, new Rect(12, 96, 268, 128), "", style);
        txtWindowTextText = new TextCtrl(windowText, new Rect(12, 32, 328, 260), "", style);

        progressBar.SetBorder(10, 50);
        progressBar.Value = 30;
        //progressBar.ShowText = false;

        StreamReader sr = new StreamReader(File.Open("res/sample.txt", FileMode.Open));

        txtWindowTextText.AppendText(sr.ReadToEnd());
        sr.Close();
    }
Exemplo n.º 3
0
 private void drawQuad(Quad quad)
 {
     GDevice.DrawUserIndexedPrimitives
     <VertexPositionNormalTexture>(
         PrimitiveType.TriangleList,
         quad.Vertices, 0, 4,
         Quad.Indexes, 0, 2);
 }
Exemplo n.º 4
0
    public Main()
    {
        GDevice gDevice = LightFireCS.Graphics.GDevice.Get();

        Console.WriteLine(gDevice);
        gDevice.CreateDevice(640, 480, 32, false);
        //gDevice.CreateDevice(1280, 1024, 32, true);
        gDevice.SetWindowText("Grid");
    }
Exemplo n.º 5
0
 public static void applyConfig()
 {
     GDevice.PreferredBackBufferWidth  = Config.Width;
     GDevice.PreferredBackBufferHeight = Config.Height;
     GDevice.ApplyChanges();
     GDevice.IsFullScreen = Config.Fullscreen;
     GDevice.ApplyChanges();
     MediaPlayer.Volume = Options.Config.MusicVolume;
 }
Exemplo n.º 6
0
    public int Render()
    {
        while (select)
        {
            LightFireCS.MessageHandler.Get().ProcessEvents();
            GDevice gDevice = GDevice.Get();

            gDevice.BeginRender();
            gDevice.SetOrthoView();
            background.Render();
            WindowManager.Get().Render();
            gDevice.EndRender();
        }

        return(selectedItem);
    }
Exemplo n.º 7
0
    public void Run()
    {
        GDevice gDevice = GDevice.Get();
        IDevice iDevice = IDevice.Get();

        iDevice.MouseMove += new EventHandler(OnMouseMove);
        gDevice.Resize    += new EventHandler(OnResizeWindow);

        while (gDevice.IsRunning)
        {
            MessageHandler.Get().ProcessEvents();

            if (iDevice.GetKeyState(Tao.Sdl.Sdl.SDLK_ESCAPE))
            {
                gDevice.Quit();
            }

            if (iDevice.GetKeyState(Tao.Sdl.Sdl.SDLK_w))
            {
                camera.Position.x -= gDevice.DeltaTime * 0.01 * Math.Sin(camera.Rotation.y * Math.PI / 180.0);
                camera.Position.z -= gDevice.DeltaTime * 0.01 * Math.Cos(camera.Rotation.y * Math.PI / 180.0);
            }

            if (iDevice.GetKeyState(Tao.Sdl.Sdl.SDLK_s))
            {
                camera.Position.x += gDevice.DeltaTime * 0.01 * Math.Sin(camera.Rotation.y * Math.PI / 180.0);
                camera.Position.z += gDevice.DeltaTime * 0.01 * Math.Cos(camera.Rotation.y * Math.PI / 180.0);
            }

            if (iDevice.GetKeyState(Tao.Sdl.Sdl.SDLK_a))
            {
                camera.Rotation.y += gDevice.DeltaTime * 0.05;
            }

            if (iDevice.GetKeyState(Tao.Sdl.Sdl.SDLK_d))
            {
                camera.Rotation.y -= gDevice.DeltaTime * 0.05;
            }

            gDevice.BeginRender();
            gDevice.SetPerspectiveView();
            camera.UpdateCamera();
            bspNode.Render(camera.ViewFrustum);
            gDevice.EndRender();
        }
    }
Exemplo n.º 8
0
    public void Run()
    {
        GDevice gDevice = GDevice.Get();

        while (gDevice.IsRunning)
        {
            MessageHandler.Get().ProcessEvents();

            if (IDevice.Get().GetKeyState(Tao.Sdl.Sdl.SDLK_ESCAPE))
            {
                gDevice.Quit();
            }

            gDevice.BeginRender();
            gDevice.SetOrthoView();
            boxBackground.Render();
            WindowManager.Get().Render();
            windowQuit.WindowFont.Render("FPS: " + gDevice.Fps, new Color(255, 255, 255), new Rect(0, 0, 60, 40));
            gDevice.EndRender();
        }
    }
Exemplo n.º 9
0
 public void OnButtonWindowQuitQuit(object o, EventArgs e)
 {
     GDevice.Get().Quit();
 }