public override void Render(float elapsedTime)
        {
            drawer2D.BeginDrawSprite();
            drawer2D.DrawSprite(backgroundSprite);
            drawer2D.EndDrawSprite();

            GuiMessage msg = gui.Update(elapsedTime, Input);

            // proceso el msg
            switch (msg.message)
            {
            case MessageType.WM_COMMAND:
                switch (msg.id)
                {
                case ID_CLOSE:
                    show = false;
                    gui.Reset();
                    PlayerModel.ShowFatherNote = false;
                    break;
                }
                break;

            default:
                break;
            }

            if (show)
            {
                gui.Render();
            }
        }
        public override void Render(float elapsedTime)
        {
            drawer2D.BeginDrawSprite();
            drawer2D.DrawSprite(backgroundSprite);
            drawer2D.EndDrawSprite();

            GuiMessage msg = gui.Update(elapsedTime, Input);

            switch (msg.message)
            {
            case MessageType.WM_COMMAND:
                switch (msg.id)
                {
                case ID_CLOSE:
                    Application.Exit();
                    break;
                }
                break;

            default:
                break;
            }

            gui.Render();

            if (playWinSound)
            {
                playWinSound = false;
                winSound.play();
            }
        }
Пример #3
0
        public override void Render(float elapsedTime)
        {
            drawer2D.BeginDrawSprite();
            drawer2D.DrawSprite(backgroundSprite);
            drawer2D.EndDrawSprite();

            GuiMessage msg = gui.Update(elapsedTime, Input);

            switch (msg.message)
            {
            case MessageType.WM_COMMAND:
                switch (msg.id)
                {
                case ID_CLOSE:
                    ShowHistory = false;
                    break;
                }
                break;

            default:
                break;
            }

            gui.Render();
        }
Пример #4
0
        public override void Render(float elapsedTime)
        {
            GuiMessage msg = gui.Update(elapsedTime, Input);

            switch (msg.message)
            {
            case MessageType.WM_COMMAND:

                switch (msg.id)
                {
                case ID_CRAFT_SHIP_HELM:
                    CraftShipHelm();
                    break;
                }

                break;
            }

            gui.Render();
            text.render();

            if (showNoElemMsg && msgTime < 5)
            {
                msgTime += elapsedTime;
                noelementsMsg.render();
            }

            if (showCraftElemMsg && msgTime < 5)
            {
                msgTime += elapsedTime;
                craftElementMsg.render();
            }
        }
        public override void Render(float elapsedTime)
        {
            drawer2D.BeginDrawSprite();
            drawer2D.DrawSprite(backgroundSprite);
            drawer2D.EndDrawSprite();

            text.render();

            GuiMessage msg = gui.Update(elapsedTime, Input);

            // proceso el msg
            switch (msg.message)
            {
            case MessageType.WM_COMMAND:
                switch (msg.id)
                {
                case IDOK:
                    if (msg_box_app_exit)
                    {
                        Application.Exit();
                    }
                    if (msg_box_nueva_mision)
                    {
                        music.closeFile();
                        GameModel.ChangeLevel();
                    }
                    break;

                case IDCANCEL:
                    gui.EndDialog();
                    break;

                case ID_NUEVA_PARTIDA:
                    gui.MessageBox("Nueva Partida", "TGC Gui Demo");
                    msg_box_nueva_mision = true;
                    msg_box_app_exit     = false;
                    break;

                case ID_APP_EXIT:
                    gui.MessageBox("Desea Salir?", "TGC Gui Demo");
                    msg_box_app_exit     = true;
                    msg_box_nueva_mision = false;
                    break;

                case ID_CONTROLES:
                    gui.MessageBoxControles("Controles", "TGC Gui Demo");
                    break;
                }
                break;

            default:
                break;
            }

            gui.Render();
        }
Пример #6
0
        public void RenderGUI(float elapsedTime)
        {
            GuiMessage msg = gui.Update(elapsedTime, Input);

            switch (msg.message)
            {
            case MessageType.WM_COMMAND:

                switch (msg.id)
                {
                case 1:
                    active = false;
                    PlayerModel.ShowInventory  = false;
                    PlayerModel.ShowFatherNote = true;
                    break;

                case 2:
                    if (PlayerModel.CanUseShipHelm)
                    {
                        active = false;
                        PlayerModel.ShowInventory = false;
                        ShowShipHelm    = false;
                        RenderShipHelm  = true;
                        PlayerModel.Win = true;
                    }
                    else
                    {
                        showNoUseShipHelmMsg = true;
                        msgTime = 0;
                    }
                    break;
                }

                break;
            }

            gui.Render();
            text.render();

            if (showNoUseShipHelmMsg && msgTime < 3)
            {
                msgTime += elapsedTime;
                noUseShipHelmText.render();
            }
        }
Пример #7
0
        public void gui_render(float elapsedTime)
        {
            // ------------------------------------------------
            GuiMessage msg = gui.Update(elapsedTime);

            // proceso el msg
            switch (msg.message)
            {
            case MessageType.WM_COMMAND:
                switch (msg.id)
                {
                case IDOK:
                case IDCANCEL:
                    // Resultados OK, y CANCEL del ultimo messagebox
                    gui.EndDialog();

                    if (dialog_sel == 1)
                    {
                        // Estaba en el dialogo de configurar, paso al dialogo principal
                        dialog_sel = 0;
                    }
                    break;

                case ID_SCOUT:
                    // Abro un nuevo dialogo
                    Configurar();
                    break;

                default:
                    break;
                }
                break;

            default:
                break;
            }
            gui.Render();
        }
Пример #8
0
        public void gui_render(float elapsedTime)
        {
            // ------------------------------------------------
            GuiMessage msg = gui.Update(elapsedTime, Input);

            // proceso el msg
            switch (msg.message)
            {
            case MessageType.WM_COMMAND:
                switch (msg.id)
                {
                case IDOK:
                case IDCANCEL:
                    // Resultados OK, y CANCEL del ultimo messagebox
                    gui.EndDialog();
                    profiling = false;
                    if (msg_box_app_exit)
                    {
                        // Es la resupuesta a un messagebox de salir del sistema
                        if (msg.id == IDOK)
                        {
                            // Salgo del sistema
                            //GuiController.Instance.shutDown();
                            Cursor.Show();
                        }
                    }
                    msg_box_app_exit = false;
                    break;

                case ID_ABRIR_MISION:
                    ProgressBarDlg();
                    break;

                case ID_NUEVA_MISION:
                    gui.MessageBox("Nueva Misión", "TGC Gui Demo");
                    break;

                case ID_CONFIGURAR:
                    Configurar();
                    break;

                case ID_APP_EXIT:
                    gui.MessageBox("Desea Salir?", "TGC Gui Demo");
                    msg_box_app_exit = true;
                    break;

                default:
                    if (msg.id >= 0 && msg.id < cant_colores)
                    {
                        // Cambio el color
                        int color = msg.id;

                        effect.SetValue("color_global", new TGCVector4((float)lst_colores[color].R / 255.0f, (float)lst_colores[color].G / 255.0f, (float)lst_colores[color].B / 255.0f, 1));
                    }
                    break;
                }
                break;

            default:
                break;
            }
            gui.Render();
        }
Пример #9
0
        public void renderHUD()
        {
            Device d3dDevice = D3DDevice.Instance.Device;

            d3dDevice.RenderState.ZBufferEnable = false;
            int W = D3DDevice.Instance.Width;
            int H = D3DDevice.Instance.Height;

            // Elapsed time
            int   an    = (int)(time * 10) % 360;
            float hasta = an / 180.0f * (float)Math.PI;

            gui.DrawArc(new TGCVector2(40, H - 100), 25, 0, hasta, 8, Color.Yellow);
            gui.TextOut(20, H - 140, "Elapsed Time:" + Math.Round(time), Color.LightSteelBlue);

            // dibujo los enemigos
            TGCVector3 pos_personaje = Camera.Position;
            TGCVector3 dir_view      = Camera.LookAt - pos_personaje;
            TGCVector2 dir_v         = new TGCVector2(dir_view.X, dir_view.Z);

            dir_v.Normalize();
            TGCVector2 dir_w = new TGCVector2(dir_v.Y, -dir_v.X);

            int   dx = 1000;
            int   dy = 1000;
            int   dW = 200;
            int   dH = 200;
            float ex = dW / (float)dx;
            float ey = dH / (float)dy;
            int   ox = 10 + dW / 2;
            int   oy = 10 + dH / 2;

            for (int t = 0; t < cant_enemigos; ++t)
            {
                TGCVector3 pos = enemigos[t].Position - pos_personaje;
                TGCVector2 p   = new TGCVector2(pos.X, pos.Z);
                float      x   = TGCVector2.Dot(dir_w, p);
                float      y   = TGCVector2.Dot(dir_v, p);
                int        xm  = (int)(ox + x * ex);
                int        ym  = (int)(oy + y * ey);

                if (Math.Abs(xm - ox) < dW / 2 - 10 && Math.Abs(ym - oy) < dH / 2 - 10)
                {
                    gui.DrawRect(xm - 2, ym - 2, xm + 2, ym + 2, 1, Color.WhiteSmoke);
                }
            }

            TGCVector2[] P = new TGCVector2[20];
            P[0] = new TGCVector2(ox - 5, oy + 5);
            P[1] = new TGCVector2(ox + 5, oy + 5);
            P[2] = new TGCVector2(ox, oy - 10);
            P[3] = P[0];
            gui.DrawSolidPoly(P, 4, Color.Tomato, false);
            gui.DrawCircle(new TGCVector2(ox, oy), 14, 3, Color.Yellow);

            foreach (TgcBoundingAxisAlignBox room in rooms)
            {
                TGCVector2[] Q  = new TGCVector2[4];
                TGCVector2[] Qp = new TGCVector2[5];

                float xm = 0;
                float ym = 0;
                Q[0] = new TGCVector2(room.PMin.X - pos_personaje.X, room.PMin.Z - pos_personaje.Z);
                Q[1] = new TGCVector2(room.PMin.X - pos_personaje.X, room.PMax.Z - pos_personaje.Z);
                Q[2] = new TGCVector2(room.PMax.X - pos_personaje.X, room.PMax.Z - pos_personaje.Z);
                Q[3] = new TGCVector2(room.PMax.X - pos_personaje.X, room.PMin.Z - pos_personaje.Z);
                for (int t = 0; t < 4; ++t)
                {
                    float x = TGCVector2.Dot(dir_w, Q[t]);
                    float y = TGCVector2.Dot(dir_v, Q[t]);
                    Qp[t] = new TGCVector2(ox + x * ex, oy + y * ey);
                    xm   += x * ex;
                    ym   += y * ey;
                }
                Qp[4] = Qp[0];
                xm   /= 4;
                ym   /= 4;

                if (Math.Abs(xm) < dW / 2 - 10 && Math.Abs(ym) < dH / 2 - 10)
                {
                    gui.DrawPoly(Qp, 5, 1, Color.Tomato);
                }
            }

            // posicion X,Z
            float kx = pos_personaje.X * ex;

            P[0] = new TGCVector2(10, H - 10);
            P[1] = new TGCVector2(15, H - 30);
            P[2] = new TGCVector2(5 + kx, H - 30);
            P[3] = new TGCVector2(25 + kx, H - 10);
            P[4] = P[0];
            gui.DrawSolidPoly(P, 5, Color.Tomato);
            gui.DrawPoly(P, 5, 2, Color.HotPink);

            float kz = pos_personaje.Z * ey;

            P[0] = new TGCVector2(10, H - 40);
            P[1] = new TGCVector2(15, H - 60);
            P[2] = new TGCVector2(5 + kz, H - 60);
            P[3] = new TGCVector2(25 + kz, H - 40);
            P[4] = P[0];
            gui.DrawSolidPoly(P, 5, Color.Green);
            gui.DrawPoly(P, 5, 2, Color.YellowGreen);

            d3dDevice.RenderState.ZBufferEnable = true;
            gui.Render();
        }