public override void Init()
        {
            drawer2D = new Drawer2D();

            //Crear Sprite
            backgroundSprite        = new CustomSprite();
            backgroundSprite.Bitmap = new CustomBitmap(MediaDir + "\\Bitmaps\\main3.jpg", D3DDevice.Instance.Device);

            text          = new TgcText2D();
            text.Text     = "CARIBBEAN´S DEATH";
            text.Color    = Color.Red;
            text.Align    = TgcText2D.TextAlign.RIGHT;
            text.Position = new Point(D3DDevice.Instance.Width - 500, 100);
            text.Size     = new Size(300, 100);
            text.changeFont(new Font("TimesNewRoman", 25, FontStyle.Bold | FontStyle.Italic));

            //Ubicarlo centrado en la pantalla
            var textureSize = backgroundSprite.Bitmap.Size;

            backgroundSprite.Position = new TGCVector2(0, 0);
            backgroundSprite.Scaling  = new TGCVector2(0.75f, 0.35f);

            gui.Create(MediaDir);

            // menu principal
            gui.InitDialog(false, false);
            int W   = D3DDevice.Instance.Width;
            int H   = D3DDevice.Instance.Height;
            int x0  = W - 200;
            int y0  = H - 300;
            int dy  = 80;
            int dy2 = dy;
            int dx  = 200;

            gui.InsertMenuItem(ID_NUEVA_PARTIDA, "  Jugar", "play.png", x0, y0, MediaDir, dx, dy);
            gui.InsertMenuItem(ID_CONTROLES, "  Controles", "navegar.png", x0, y0 += dy2, MediaDir, dx, dy);
            gui.InsertMenuItem(ID_APP_EXIT, "  Salir", "salir.png", x0, y0        += dy2, MediaDir, dx, dy);

            music          = new TgcMp3Player();
            music.FileName = MediaDir + "\\Sounds\\mainMenuMusic.mp3";
            music.play(true);
        }
Exemplo n.º 2
0
        public override void Init()
        {
            Cursor.Hide();

            Device d3dDevice = D3DDevice.Instance.Device;

            //Cargar Shader personalizado
            string compilationErrors;

            effect = Effect.FromFile(d3dDevice, ShadersDir + "TgcViewer\\TgcSkeletalMeshShader.fx", null, null, ShaderFlags.PreferFlowControl, null, out compilationErrors);
            if (effect == null)
            {
                throw new Exception("Error al cargar shader. Errores: " + compilationErrors);
            }
            //Configurar Technique dentro del shader
            effect.Technique = "DIFFUSE_MAP";

            //Camara en primera persona
            Camara.SetCamera(new TGCVector3(0, 60, 200), new TGCVector3(0, 0, 0));

            //Cargar personaje con animaciones
            TgcSkeletalLoader skeletalLoader = new TgcSkeletalLoader();

            mesh = skeletalLoader.loadMeshAndAnimationsFromFile(MediaDir + "SkeletalAnimations\\BasicHuman\\" + "CombineSoldier-TgcSkeletalMesh.xml", MediaDir + "SkeletalAnimations\\BasicHuman\\", new string[] { MediaDir + "SkeletalAnimations\\BasicHuman\\Animations\\" + "StandBy-TgcSkeletalAnim.xml", MediaDir + "SkeletalAnimations\\BasicHuman\\Animations\\" + "Run-TgcSkeletalAnim.xml", });
            mesh.AutoTransform = true;

            //Configurar animacion inicial
            mesh.playAnimation("StandBy", true);
            mesh.Position  = new TGCVector3(0, -50, 0);
            mesh.Scale     = new TGCVector3(2f, 2f, 2f);
            mesh.Effect    = effect;
            mesh.Technique = "DIFFUSE_MAP";

            // levanto el GUI
            gui.Create(MediaDir);

            // menu principal
            gui.InitDialog(true);
            int W   = D3DDevice.Instance.Width;
            int H   = D3DDevice.Instance.Height;
            int x0  = 70;
            int y0  = 10;
            int dy  = 120;
            int dy2 = dy;
            int dx  = 400;

            gui.InsertMenuItem(ID_ABRIR_MISION, "Abrir Mision", "open.png", x0, y0, MediaDir, dx, dy);
            gui.InsertMenuItem(ID_NUEVA_MISION, "Play", "Play.png", x0, y0        += dy2, MediaDir, dx, dy);
            gui.InsertMenuItem(ID_CONFIGURAR, "Configurar", "navegar.png", x0, y0 += dy2, MediaDir, dx, dy);
            gui.InsertMenuItem(ID_APP_EXIT, "Salir", "salir.png", x0, y0          += dy2, MediaDir, dx, dy);

            // lista de colores
            lst_colores[0]  = Color.FromArgb(100, 220, 255);
            lst_colores[1]  = Color.FromArgb(100, 255, 220);
            lst_colores[2]  = Color.FromArgb(220, 100, 255);
            lst_colores[3]  = Color.FromArgb(220, 255, 100);
            lst_colores[4]  = Color.FromArgb(255, 100, 220);
            lst_colores[5]  = Color.FromArgb(255, 220, 100);
            lst_colores[6]  = Color.FromArgb(128, 128, 128);
            lst_colores[7]  = Color.FromArgb(64, 255, 64);
            lst_colores[8]  = Color.FromArgb(64, 64, 255);
            lst_colores[9]  = Color.FromArgb(255, 0, 255);
            lst_colores[10] = Color.FromArgb(255, 255, 0);
            lst_colores[11] = Color.FromArgb(0, 255, 255);
        }