Visualizzazione dei risultati da 1 a 10 su 10

Visualizzazione discussione

  1. #6
    Utente di HTML.it L'avatar di escocat
    Registrato dal
    Feb 2012
    Messaggi
    308
    Scusate non so nemmeno inserire il codice per bene..

    My.cs:

    codice:
    namespace Progetto_Albireo  // NUOVO
    {
        public class My : Microsoft.Xna.Framework.Game
        {
            //Generals          
            public static GraphicsDeviceManager Graphicsdevicemanager;
    #if WIDE
            public static int RisX, RisY;
    #else
            public static int RisX = 1350;
            public static int RisY = 650;
    #endif
            RenderTarget2D renderTarget;
            Texture2D shadowMap;
            MemoryStream stream = new MemoryStream();
            ..........
            //Discovery
            public static Discovery Discovery =
                new Discovery(new Vector3(0f, 0f, 30000f),  //Position
                -Vector3.UnitZ,                               //Go
                10f,                                       //Speed
                -Vector3.UnitZ,                               //To
                Vector3.Up);                                  //Up
            ..........
            public static bool PhotoMode = false;
            public static KeyboardState KeyState;
            public static KeyboardState OldState = Keyboard.GetState();
            ..........
            public void KeyControl()
            {
                KeyState = Keyboard.GetState();
                if ((KeyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape)) & (OldState != KeyState))
                    this.Exit();
                if (OldState != KeyState)
                    Discovery.Ctrls(KeyState);
                OldState = KeyState;
            }
            public My()
            {
                Graphicsdevicemanager = new GraphicsDeviceManager(this);
                Content.RootDirectory = "Content";
            }
    
            protected override void Initialize()
            {
                ..........
                shadowMap = new Texture2D(GraphicsDevice, RisX, RisY);
                PresentationParameters pp = GraphicsDevice.PresentationParameters;
                renderTarget = new RenderTarget2D(GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight,
                           false, GraphicsDevice.DisplayMode.Format, DepthFormat.Depth24);
                
                base.Initialize();
            }
            protected override void LoadContent()
            {
                ..........
            }
            protected override void Update(GameTime gametime)
            {
                ..........
                KeyControl();
                //DISCOVERY
                Discovery.Move();
            }
    
            protected override void Draw(GameTime gametime)
            {
                if (PhotoMode)
                    GraphicsDevice.SetRenderTarget(renderTarget);
                ..........
                if (PhotoMode)
                {
                    GraphicsDevice.SetRenderTarget(null);
                    shadowMap = (Texture2D)renderTarget;
                    shadowMap.SaveAsJpeg(stream, RisX, RisY);//o SaveAsPng()
                    System.Drawing.Bitmap b = new System.Drawing.Bitmap(stream);
                    b.Save(@"C:\frame.bmp");
                    PhotoMode = false;
                }
     
            }
    
        }
    }
    Discovery.cs:

    codice:
    namespace Progetto_Albireo
    {
        public struct Discovery
        {
            //principali
            public Vector3 Position;
            public Vector3 Go;
            public float Speed;
            public Vector3 To;
            public Vector3 Up;
            ..........
            public Discovery(Vector3 P, Vector3 G, float S, Vector3 T, Vector3 U)
            {
               ..........
            }
    
            ..........
            public void Ctrls(KeyboardState KeyState)
            {
                ..........
                if (KeyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Space))
                {
                    if (My.PhotoMode)
                        My.PhotoMode = false;
                    else
                        My.PhotoMode = true;
                    
                }
                ..........
            }
            ..........
    
        }
    }
    Ultima modifica di escocat; 07-11-2013 a 15:55

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.