Exemple #1
0
        public virtual void UpdateScreen()
        {
            re.BeginFrame(0F);
            switch (currentState)

            {
            case 0:
                re.DrawStretchPic(0, 0, viddef.GetWidth(), viddef.GetHeight(), "conback");
                re.DrawPic(viddef.GetWidth() / 2 - 50, viddef.GetHeight() / 2, "loading");
                currentState = 1;
                break;

            case 1:
                re.SetSky("space1", 0, new float { 0, 0, 0 });
                re.BeginRegistration("ColorTest");
                re.EndRegistration();
                currentState = 2;

            default:
                if (framecount % 500 == 0)
                {
                    long time = System.CurrentTimeMillis();
                    fps   = 500000F / (time - start);
                    start = time;
                }

                string text = fps + " fps";
                TestMap();
                DrawString(10, viddef.GetHeight() - 16, text);
            }

            re.EndFrame();
            framecount++;
        }
Exemple #2
0
        public virtual void Init()
        {
            Globals.dedicated = Cvar.Get("dedicated", "0", Qcommon.CVAR_NOSET);
            Program.Q2Dialog  = new Q2DataDialog();
            Locale.SetDefault(Locale.US);
            Program.Q2Dialog.SetVisible(true);
            string DRIVER = "lwjgl";

            Qcommon.Init(new string { "DancingQueens", "+set", "gl_mode", "4", "+set", "vid_fullscreen", "0", "+set", "vid_ref", DRIVER });
            VID.Shutdown();
            String[] names = Renderer.GetDriverNames();
            System.Diagnostics.Debug.WriteLine("Registered Drivers: " + Arrays.AsList(names));
            this.re    = Renderer.GetDriver(DRIVER);
            Globals.re = this.re;
            System.Diagnostics.Debug.WriteLine("Use driver: " + re);
            System.out_renamed.Flush();
            re.Init(0, 0);
            kbd = re.GetKeyboardHandler();
            kbd.Init();
            Cbuf.AddText("unbind t");
            Cbuf.Execute();
            Cmd.AddCommand("togglemouse", togglemouse);
            Cbuf.AddText("bind t togglemouse");
            Cbuf.Execute();
            Globals.cls.key_dest = Defines.key_game;
            Globals.cls.state    = Defines.ca_active;
            viddef = Globals.viddef;
            fov_y  = Math3D.CalcFov(fov_x, viddef.GetWidth(), viddef.GetHeight());
        }
Exemple #3
0
        public virtual void UpdateScreen()
        {
            re.BeginFrame(0F);
            viddef = Globals.viddef;
            re.DrawStretchPic(0, 0, viddef.GetWidth(), viddef.GetHeight(), "conback");
            if (framecount % 500 == 0)
            {
                long time = System.CurrentTimeMillis();
                fps   = 500000F / (time - start);
                start = time;
            }

            string text = ((int)(fps + 0.5F)) + " fps";

            for (int i = 0; i < text.Length; i++)
            {
                re.DrawChar(10 + 8 * i, viddef.GetHeight() / 2, (int)text[i]);
            }

            re.DrawGetPicSize(out var wal, "/textures/e1u1/basemap.wal");
            re.DrawPic(0, viddef.GetHeight() - wal.Height, "/textures/e1u1/basemap.wal");
            switch (testnr)

            {
            case 0:
                TestParticles();
                break;

            case 1:
                TestModel();
                break;

            case 2:
                TestSprites();
                break;

            case 3:
                TestBeam();
                break;
            }

            re.EndFrame();
            framecount++;
        }
Exemple #4
0
        private void TestModel()
        {
            refdef_t refdef = new refdef_t();

            refdef.x      = viddef.GetWidth() / 2;
            refdef.y      = viddef.GetHeight() / 2 - 72;
            refdef.width  = 144 * 2;
            refdef.height = 168 * 2;
            refdef.fov_x  = 40;
            refdef.fov_y  = Math3D.CalcFov(refdef.fov_x, refdef.width, refdef.height);
            refdef.time   = 1F * 0.001F;
            entity_t entity      = new entity_t();
            string   modelName   = "players/female/tris.md2";
            string   modelSkin   = "players/female/athena.pcx";
            string   modelImage  = "/players/female/athena_i.pcx";
            string   modelImage1 = "/players/female/brianna_i.pcx";
            string   modelImage2 = "/players/female/cobalt_i.pcx";
            string   modelImage3 = "/players/female/lotus_i.pcx";

            entity.model = re.RegisterModel(modelName);
            DrawString(refdef.x, refdef.y - 20, (entity.model != null) ? modelName : "DEBUG: NullModel");
            entity.skin      = re.RegisterSkin(modelSkin);
            entity.flags     = Defines.RF_FULLBRIGHT;
            entity.origin[0] = 80;
            entity.origin[1] = 0;
            entity.origin[2] = 0;
            Math3D.VectorCopy(entity.origin, entity.oldorigin);
            entity.frame    = (framecount / 3) % ((qfiles.dmdl_t)entity.model.extradata).num_frames;
            entity.oldframe = 0;
            entity.backlerp = 0F;
            yaw            += KBD.mx;
            KBD.mx          = 0;
            if (yaw > 360)
            {
                yaw -= 360;
            }
            if (yaw < 0)
            {
                yaw += 360;
            }
            entity.angles[1]    = yaw;
            refdef.areabits     = null;
            refdef.num_entities = 1;
            refdef.entities     = new entity_t[] { entity };
            refdef.lightstyles  = null;
            refdef.rdflags      = Defines.RDF_NOWORLDMODEL;
            M_DrawTextBox((int)((refdef.x) * (320F / viddef.GetWidth()) - 8), (int)((viddef.GetHeight() / 2) * (240F / viddef.GetHeight()) - 77), refdef.width / 8, refdef.height / 8);
            refdef.height += 4;
            re.RenderFrame(refdef);
            re.DrawPic(refdef.x - 80, refdef.y, modelImage);
            re.DrawPic(refdef.x - 80, refdef.y + 47, modelImage1);
            re.DrawPic(refdef.x - 80, refdef.y + 94, modelImage2);
            re.DrawPic(refdef.x - 80, refdef.y + 141, modelImage3);
        }