Ejemplo n.º 1
0
        public MiswGame2008(bool fullscreen, int startLevel)
        {
            FileArchiverZip zip = new FileArchiverZip();

            zip.ZipExtName = ".bin";
            FileSys.AddArchiver(zip);
            window = new SDLWindow();
            window.SetCaption("DTF");
            window.BeginScreenTest();
            if (fullscreen)
            {
                window.TestVideoMode(640, 480, 32);
                window.TestVideoMode(640, 480, 16);
            }
            else
            {
                window.TestVideoMode(640, 480, 0);
            }
            window.EndScreenTest();
            graphics = new SdlGraphics(window);
            audio    = new SdlAudio();
            input    = new SdlInput(fullscreen);

            this.startLevel = startLevel;
        }
Ejemplo n.º 2
0
 internal Window(string title, int width, int height)
 {
     Helper.Init();
     Title    = title;
     Width    = width;
     Height   = height;
     window   = new SDLWindow(title, width, height);
     renderer = new SDLRenderer(window);
 }
Ejemplo n.º 3
0
        static void Initialize()
        {
            c            = new Configuration("config.dat");
            audioContext = new AudioContext(c);
            listener     = new Listener();

            w = new SDLWindow(c);
            w.Add(buttonAction);
        }
Ejemplo n.º 4
0
        public GraphicsDevice(SDLWindow window)
        {
            this.window = window;
            screen = window.Screen;

            BeginDraw();
            FillScreen(0, 0, 0, 255);
            EndDraw();

            LoadTextures();
            currentDrawMode = DrawMode.Unknown;
        }
Ejemplo n.º 5
0
        public GraphicsDevice(SDLWindow window)
        {
            this.window = window;
            screen      = window.Screen;

            BeginDraw();
            FillScreen(0, 0, 0, 255);
            EndDraw();

            LoadTextures();
            currentDrawMode = DrawMode.Unknown;
        }
Ejemplo n.º 6
0
 public SdlGraphics(SDLWindow window)
 {
     this.window = window;
     screen = window.Screen;
     width = screen.Width;
     height = screen.Height;
     Begin();
     SetColor(255, 128, 128, 128);
     Fill();
     End();
     Initialize();
 }
Ejemplo n.º 7
0
 public SdlGraphics(SDLWindow window)
 {
     this.window = window;
     screen      = window.Screen;
     width       = screen.Width;
     height      = screen.Height;
     Begin();
     SetColor(255, 128, 128, 128);
     Fill();
     End();
     Initialize();
 }
Ejemplo n.º 8
0
 public void CreateWindow(bool fullscreen)
 {
     window = new SDLWindow();
     window.SetCaption("混沌物語");
     window.BeginScreenTest();
     if (fullscreen)
     {
         window.TestVideoMode(Settings.SCREEN_WIDTH, Settings.SCREEN_HEIGHT, 32);
         window.TestVideoMode(Settings.SCREEN_WIDTH, Settings.SCREEN_HEIGHT, 16);
     }
     window.TestVideoMode(Settings.SCREEN_WIDTH, Settings.SCREEN_HEIGHT, 0);
     window.EndScreenTest();
 }
Ejemplo n.º 9
0
        public MiswGame2008(bool fullscreen, int startLevel)
        {
            FileArchiverZip zip = new FileArchiverZip();
            zip.ZipExtName = ".bin";
            FileSys.AddArchiver(zip);
            window = new SDLWindow();
            window.SetCaption("DTF");
            window.BeginScreenTest();
            if (fullscreen)
            {
                window.TestVideoMode(640, 480, 32);
                window.TestVideoMode(640, 480, 16);
            }
            else
            {
                window.TestVideoMode(640, 480, 0);
            }
            window.EndScreenTest();
            graphics = new SdlGraphics(window);
            audio = new SdlAudio();
            input = new SdlInput(fullscreen);

            this.startLevel = startLevel;
        }
Ejemplo n.º 10
0
        private static void Main()
        {
            var framebuffer = new Framebuffer <uint>(1024, 512, ColorUtils.PackColor(255, 255, 255));
            var raycaster   = new TinyRaycaster
            {
                Framebuffer = framebuffer,
                Player      = new Player
                {
                    X   = 3.456f, // player x position
                    Y   = 2.345f, // player y position
                    A   = 1.523f,
                    FOV = MathF.PI / 3.0f
                }
            };

            var sdlWindow = new SDLWindow(1024, 512, framebuffer);


            if (!sdlWindow.Init())
            {
                Console.WriteLine(sdlWindow.GetError());
                return;
            }


            var time = DateTime.Now;

            while (true)
            {
                var time2 = DateTime.Now;
                if ((time2 - time).TotalMilliseconds < 20)
                {
                    Thread.Sleep(3);
                    continue;
                }

                time = time2;

                var(type, key) = sdlWindow.GetEvent();

                if (type == EventType.Quit)
                {
                    break;
                }

                if (type == EventType.KeyUp)
                {
                    switch (key)
                    {
                    case KeyCode.A:
                    case KeyCode.D:
                        raycaster.Player.Turn = 0;
                        break;

                    case KeyCode.W:
                    case KeyCode.S:
                        raycaster.Player.Walk = 0;
                        break;
                    }
                }

                if (type == EventType.KeyDown)
                {
                    switch (key)
                    {
                    case KeyCode.A:
                        raycaster.Player.Turn = -1;
                        break;

                    case KeyCode.D:
                        raycaster.Player.Turn = 1;
                        break;

                    case KeyCode.W:
                        raycaster.Player.Walk = 1;
                        break;

                    case KeyCode.S:
                        raycaster.Player.Walk = -1;
                        break;
                    }
                }

                raycaster.Run();
                sdlWindow.Update();
            }

            sdlWindow.Destroy();
        }
Ejemplo n.º 11
0
 public void CreateWindow(bool fullscreen)
 {
     window = new SDLWindow();
     window.SetCaption("���ו���");
     window.BeginScreenTest();
     if (fullscreen)
     {
         window.TestVideoMode(Settings.SCREEN_WIDTH, Settings.SCREEN_HEIGHT, 32);
         window.TestVideoMode(Settings.SCREEN_WIDTH, Settings.SCREEN_HEIGHT, 16);
     }
     window.TestVideoMode(Settings.SCREEN_WIDTH, Settings.SCREEN_HEIGHT, 0);
     window.EndScreenTest();
 }