当前位置: 首页>>代码示例>>C#>>正文


C# ContentManager类代码示例

本文整理汇总了C#中ContentManager的典型用法代码示例。如果您正苦于以下问题:C# ContentManager类的具体用法?C# ContentManager怎么用?C# ContentManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ContentManager类属于命名空间,在下文中一共展示了ContentManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FrameRateCounter

 public FrameRateCounter(Microsoft.Xna.Framework.Game game)
     : base(game)
 {
     //use own content manager
     content = new ContentManager(game.Services);
     content.RootDirectory = "Content\\FrameRateCounter";
 }
开发者ID:nando29,项目名称:snaker,代码行数:7,代码来源:FrameRateCounter.cs

示例2: Intro

        public override void Intro( params object [] args )
        {
            LiqueurSystem.Window.Title = "Simple Dodge";
            LiqueurSystem.GraphicsDevice.BlendState = true;
            LiqueurSystem.GraphicsDevice.BlendOperation = BlendOperation.AlphaBlend;

            Add ( InputHelper.CreateInstance () );
            InputHelper.IsKeyboardEnabled = true;
            Add ( SceneContainer = new SceneContainer ( new MenuScene () ) );

            contentManager = new ContentManager ( FileSystemManager.GetFileSystem ( "ManifestFileSystem" ) );
            contentManager.AddDefaultContentLoader ();
            LiqueurSystem.Launcher.InvokeInMainThread ( () =>
            {
                fpsFont = contentManager.Load<TrueTypeFont> ( "Test.Game.Dodge.Resources.GameFont.ttf", 20 );
            } );

            FpsCalculator calc;
            Add ( calc = new FpsCalculator () );
            calc.DrawEvent += ( object sender, GameTimeEventArgs e ) =>
            {
                string fpsString = string.Format ( "Update FPS:{0:0.00}\nRender FPS:{1:0.00}", calc.UpdateFPS, calc.DrawFPS );
                fpsFont.DrawFont ( fpsString, Color.White,
                    LiqueurSystem.GraphicsDevice.ScreenSize - fpsFont.MeasureString ( fpsString ) - new Vector2 ( 10, 10 ) );
            };

            base.Intro ( args );
        }
开发者ID:Daramkun,项目名称:ProjectLiqueur,代码行数:28,代码来源:Container.cs

示例3: Scene0

 public Scene0()
 {
     Gm = new GraphicsDeviceManager(this);
     Gm.PreferredBackBufferWidth = 800;
     Gm.PreferredBackBufferHeight = 600;
     Cm = new ContentManager(Services);
 }
开发者ID:TowerTin,项目名称:SourceCode,代码行数:7,代码来源:Program.cs

示例4: ContentItem

 protected ContentItem(ComponentData content, SessionAwareCoreServiceClient client)
 {
     Content = content;
     Client = client;
     ReadOptions = new ReadOptions();
     ContentManager = new ContentManager(Client);
 }
开发者ID:NunoLinhares,项目名称:TridionWebData,代码行数:7,代码来源:ContentItem.cs

示例5: SpriteBatch

        public SpriteBatch(Device d, ContentManager c)
        {
            Device = d;

            cubeVert = new VertexBuffer(Device, 4 * 28, Usage.WriteOnly, VertexFormat.None, Pool.Managed);
            cubeVert.Lock(0, 0, LockFlags.None).WriteRange(new[]
            {
                new VertexPositionTextureColor() { Color = Color.White.ToArgb(), Position = new Vector4f(0, 0, 0.0f, 1.0f), TexCoord = new Vector2f(0.0f, 1.0f) },
                new VertexPositionTextureColor() { Color = Color.White.ToArgb(), Position = new Vector4f(0, 1, 0.0f, 1.0f), TexCoord = new Vector2f(0.0f, 0.0f) },
                new VertexPositionTextureColor() { Color = Color.White.ToArgb(), Position = new Vector4f(1, 0, 0.0f, 1.0f), TexCoord = new Vector2f(1.0f, 1.0f) },
                new VertexPositionTextureColor() { Color = Color.White.ToArgb(), Position = new Vector4f(1, 1, 0.0f, 1.0f), TexCoord = new Vector2f(1.0f, 0.0f) }
            });
            cubeVert.Unlock();

            var cubeElems = new[]
            {
                new VertexElement(0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Position, 0),
                new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
                new VertexElement(0, 24, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
                VertexElement.VertexDeclarationEnd
            };

            cubeDecl = new VertexDeclaration(Device, cubeElems);

            renderEffect = c.LoadString<Content.Effect>("float4 c;Texture b;sampler s=sampler_state{texture=<b>;magfilter=LINEAR;minfilter=LINEAR;mipfilter=LINEAR;AddressU=wrap;AddressV=wrap;};float4 f(float2 t:TEXCOORD0):COLOR{return tex2D(s, t) * c;}technique t{pass p{PixelShader = compile ps_2_0 f();}}");
        }
开发者ID:Naronco,项目名称:Rekd-Sharp,代码行数:26,代码来源:SpriteBatch.cs

示例6: Options

        public Options(ContentManager Content)
            : base()
        {
            bBackground = new GUIItems.Background(Content);

            sPixel = new AnimatedSprite(Content, "pixel");
            sPixel.Colour = new Color(Color.Black, 1.0f);
            sPixel.FrameHeight = 544;
            sPixel.FrameWidth = 960;
            sPixel.Alpha = 0.7f;

            XOffset = 32;
            YOffset = Dimensions.Height / 10;

            #if DESKTOP
            bMusic = new GUIItems.Button(Content, new Vector2(XOffset, YOffset * 3), "Music");
            #endif
            //  Buttons
            tbMinRooms  = new Neuroleptic.Editor.GUI.Textbox(Content, new Vector2(XOffset, YOffset * 5),"Min Rooms");
            tbMaxRooms  = new Neuroleptic.Editor.GUI.Textbox(Content, new Vector2(XOffset, YOffset * 6),"Max Rooms");
            tbMinRooms.CurrentString = Option.RoomsMin.ToString();
            tbMaxRooms.CurrentString = Option.RoomsMax.ToString();

            bControls   = new GUIItems.Button(Content , new Vector2(XOffset, YOffset * 7), "Controls");
            bBack       = new GUIItems.Button(Content , new Vector2(XOffset, YOffset * 8), "Back");
        }
开发者ID:ChocMaltHoney,项目名称:Neuroleptic,代码行数:26,代码来源:Options.cs

示例7: SceneRenderer

        public SceneRenderer(GameSettingsAsset gameSettings)
        {
            if (gameSettings == null) throw new ArgumentNullException(nameof(gameSettings));

            // Initialize services
            Services = new ServiceRegistry();
            ContentManager = new ContentManager(Services);

            var renderingSettings = gameSettings.Get<RenderingSettings>();
            GraphicsDevice = GraphicsDevice.New(DeviceCreationFlags.None, new[] { renderingSettings.DefaultGraphicsProfile });

            var graphicsDeviceService = new GraphicsDeviceServiceLocal(Services, GraphicsDevice);
            EffectSystem = new EffectSystem(Services);
            GraphicsContext = new GraphicsContext(GraphicsDevice);
            Services.AddService(typeof(GraphicsContext), GraphicsContext);

            SceneSystem = new SceneSystem(Services);

            // Create game systems
            GameSystems = new GameSystemCollection(Services);
            GameSystems.Add(new GameFontSystem(Services));
            GameSystems.Add(new UISystem(Services));
            GameSystems.Add(EffectSystem);
            GameSystems.Add(SceneSystem);
            GameSystems.Initialize();

            // Fake presenter
            // TODO GRAPHICS REFACTOR: This is needed be for render stage setup
            GraphicsDevice.Presenter = new RenderTargetGraphicsPresenter(GraphicsDevice,
                Texture.New2D(GraphicsDevice, renderingSettings.DefaultBackBufferWidth, renderingSettings.DefaultBackBufferHeight,
                    renderingSettings.ColorSpace == ColorSpace.Linear ? PixelFormat.R8G8B8A8_UNorm_SRgb : PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget),
                PixelFormat.D24_UNorm_S8_UInt);

            SceneSystem.MainRenderFrame = RenderFrame.FromTexture(GraphicsDevice.Presenter.BackBuffer, GraphicsDevice.Presenter.DepthStencilBuffer);
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:35,代码来源:SceneRenderer.cs

示例8: DemoGame

        public DemoGame()
            : base()
        {
            this.Window.Title = "Snowball Demo Game";

            this.graphicsDevice = new GraphicsDevice(this.Window);
            this.Services.AddService(typeof(IGraphicsDevice), this.graphicsDevice);

            this.keyboard = new Keyboard();
            this.Services.AddService(typeof(IKeyboard), this.keyboard);

            this.mouse = new Mouse(this.Window);
            this.Services.AddService(typeof(IMouse), this.mouse);

            this.gamePad = new GamePad(GamePadIndex.One);

            this.soundDevice = new SoundDevice();
            this.Services.AddService(typeof(ISoundDevice), this.soundDevice);

            this.starfield = new Starfield(this.graphicsDevice);

            this.ship = new Ship(this.graphicsDevice, this.keyboard, this.gamePad);

            this.console = new GameConsole(this.Window, this.graphicsDevice);
            this.console.InputEnabled = true;
            this.console.InputColor = Color.Blue;
            this.console.InputReceived += (s, e) => { this.console.WriteLine(e.Text); };
            this.console.IsVisibleChanged += (s, e) => { this.console.WriteLine("Console toggled."); };

            this.contentManager = new ContentManager<DemoGameContent>(this.Services);

            this.RegisterContent();
        }
开发者ID:smack0007,项目名称:Snowball_v1,代码行数:33,代码来源:DemoGame.cs

示例9: ParticleSystem

        public ParticleSystem(GraphicsDevice device, ContentManager content)
        {
            this.device = device;

            // Create vertex buffer used to spawn new particles
            this.particleStart = Buffer.Vertex.New<ParticleVertex>(device, MAX_NEW);

            // Create vertex buffers to use for updating and drawing the particles alternatively
            var vbFlags = BufferFlags.VertexBuffer | BufferFlags.StreamOutput;
            this.particleDrawFrom = Buffer.New<ParticleVertex>(device, MAX_PARTICLES, vbFlags);
            this.particleStreamTo = Buffer.New<ParticleVertex>(device, MAX_PARTICLES, vbFlags);

            this.layout = VertexInputLayout.FromBuffer(0, this.particleStreamTo);
            this.effect = content.Load<Effect>("ParticleEffect");
            this.texture = content.Load<Texture2D>("Dot");

            this.viewParameter = effect.Parameters["_view"];
            this.projParameter = effect.Parameters["_proj"];
            this.lookAtMatrixParameter = effect.Parameters["_lookAtMatrix"];
            this.elapsedSecondsParameter = effect.Parameters["_elapsedSeconds"];
            this.camDirParameter = effect.Parameters["_camDir"];
            this.gravityParameter = effect.Parameters["_gravity"];
            this.textureParameter = effect.Parameters["_texture"];
            this.samplerParameter = effect.Parameters["_sampler"];
            this.updatePass = effect.Techniques["UpdateTeq"].Passes[0];
            this.renderPass = effect.Techniques["RenderTeq"].Passes[0];
        }
开发者ID:Kammikazy,项目名称:SharpDX-Samples,代码行数:27,代码来源:ParticleSystem.cs

示例10: GameWorld

    public GameWorld(int width, int height, ContentManager Content)
    {
        screenWidth = width;
        screenHeight = height;
        random = new Random();
        gameState = GameState.Menu;
        inputHelper = new InputHelper();
        block = Content.Load<Texture2D>("block");
        reset = Content.Load<Texture2D>("reset");
        font = Content.Load<SpriteFont>("SpelFont");
        font2 = Content.Load<SpriteFont>("SpriteFont1");
        font3 = Content.Load<SpriteFont>("SpriteFont2");
        playButton = Content.Load<Texture2D>("Play");
        optionsButton = Content.Load<Texture2D>("Options");
        backButton = Content.Load<Texture2D>("Back");
        polytris = Content.Load<Texture2D>("Polytris");
        grid = new TetrisGrid(block);
        level = 1;
        levelspeed = 1;
        score = 0;
        i = (int)random.Next(7) + 1;
        i2 = (int)random.Next(7) + 1;
        blockcounter = 1;

        blocks = new BlockList(block, Content);          //Voegen de verschillende blockobjecten toe aan de lijst
        block1 = new Block1(block, Content);
        blocks.Add(block1, 1);
        block2 = new Block2(block, Content);
        blocks.Add(block2, 2);
        block3 = new Block3(block, Content);
        blocks.Add(block3, 3);
        block4 = new Block4(block, Content);
        blocks.Add(block4, 4);
        block5 = new Block5(block, Content);
        blocks.Add(block5, 5);
        block6 = new Block6(block, Content);
        blocks.Add(block6, 6);
        block7 = new Block7(block, Content);
        blocks.Add(block7, 7);

        //Voegen de verschillende blockobjecten toe aan een tweede lijst voor het tekenen van het volgende blokje
        block1res = new Block1(block, Content);
        blocks.AddToReserve(block1res, 1);
        block2res = new Block2(block, Content);
        blocks.AddToReserve(block2res, 2);
        block3res = new Block3(block, Content);
        blocks.AddToReserve(block3res, 3);
        block4res = new Block4(block, Content);
        blocks.AddToReserve(block4res, 4);
        block5res = new Block5(block, Content);
        blocks.AddToReserve(block5res, 5);
        block6res = new Block6(block, Content);
        blocks.AddToReserve(block6res, 6);
        block7res = new Block7(block, Content);
        blocks.AddToReserve(block7res, 7);

        options = new Options(block, reset, backButton, width, height, font, blocks);
        menu = new Menu(playButton, optionsButton, polytris, width, height);
        gameOver = new GameOver(backButton, width, height);
    }
开发者ID:Supercarlijn,项目名称:Tetris,代码行数:60,代码来源:GameWorld.cs

示例11: LoadAnimation

 protected override Dictionary<string, AnimationClip> LoadAnimation(ICommandContext commandContext, ContentManager contentManager, out TimeSpan duration)
 {
     var meshConverter = this.CreateMeshConverter(commandContext);
     var sceneData = meshConverter.ConvertAnimation(SourcePath, Location);
     duration = sceneData.Duration;
     return sceneData.AnimationClips;
 }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:7,代码来源:ImportAssimpCommand.cs

示例12: BallerburgGame

        /// <summary>
        /// Initializes a new instance of the BallerburgGame class
        /// </summary>
        public BallerburgGame()
        {
            Instance = this;
              gameSettings = new GameSettings();
              playerSettings = new PlayerSettings[4];

              applicationSettings = new ApplicationSettings();

              graphics = new GraphicsDeviceManager(this)
                     {
                       PreferredBackBufferWidth = 640,
                       PreferredBackBufferHeight = 480
                     };

              graphicsManager = new BallerburgGraphicsManager();
              contentManager = new ContentManager();
              shaderManager = new ShaderManager();
              audioManager = new AudioManager(applicationSettings, contentManager);
              gameObjectManager = new GameObjectManager(contentManager, this.audioManager, this.graphicsManager);

              MousePointer = new MousePointer(this)
                         {
                           DrawOrder = 1000,
                           RestrictZone = new Rectangle(0, 0, 640, 480)
                         };
              Components.Add(MousePointer);

              // Create the screen manager component.
              screenManager = new ScreenManager(graphicsManager, contentManager, gameObjectManager, applicationSettings, gameSettings, shaderManager, audioManager, playerSettings)
                          {
                            GameMousePointer = MousePointer
                          };
        }
开发者ID:urmuelle,项目名称:MonoGameBallerburg,代码行数:36,代码来源:BallerburgGame.cs

示例13: GameConsole

        public GameConsole(ContentManager content)
        {
            // Magic number, this really just depends on the font...
            _consoleTextLines = new string[100];

            _consoleFont = content.Load<SpriteFont>("DebugFont");
        }
开发者ID:Fireborn,项目名称:Gamedev,代码行数:7,代码来源:GameConsole.cs

示例14: LoadContent

        public static void LoadContent(ContentManager content)
        {
            // Textures.
            tileSet1 = content.Load<Texture2D>("Textures/TileSets/tileSet1");
            tileSetInterieur = content.Load<Texture2D>("Textures/TileSets/tileSetInterieur");
            tileSetFloorInt = content.Load<Texture2D>("Textures/TileSets/tileSetFloorInt");
            tileSetInterieurDetails = content.Load<Texture2D>("Textures/TileSets/tileSetInterieurDetails");

            // Divers.
            cursor = content.Load<Texture2D>("Textures/TileSets/cursorTileSet2");
            SelectionTest = content.Load<Texture2D>("Textures/Selection");

            // Fonts.
            font1 = content.Load<SpriteFont>("Fonts/MedievalFont1");

            // TextureData.
            cursorData1 = content.Load<Texture2D>("Textures/TextureData/Cursor/cursorTextureData1");
            cursorData2 = content.Load<Texture2D>("Textures/TextureData/Cursor/cursorTextureData2");

            // HUD.
            textureHUD = content.Load<Texture2D>("Textures/TextureData/HUD/textureHUD");
            buttonHUD = content.Load<Texture2D>("Textures/TextureData/HUD/boutonHUD");
            boutonPlanHUD = content.Load<Texture2D>("Textures/TextureData/HUD/boutonPlanHUD");
            flecheDroiteHUD = content.Load<Texture2D>("Textures/TextureData/HUD/flecheDroiteHUD");
            flecheGaucheHUD = content.Load<Texture2D>("Textures/TextureData/HUD/flecheGaucheHUD");
        }
开发者ID:jbrotabe,项目名称:KeeperHand,代码行数:26,代码来源:Ressources.cs

示例15: LoadContent

    public void LoadContent(ContentManager theContentManager, string theAssetName, int x, int y)
    {
        AssetName = theAssetName;
        mSpriteTexture = theContentManager.Load<Texture2D>(theAssetName);

        Size = new Rectangle(0, 0, (int)(mSpriteTexture.Width * Scale), (int)(mSpriteTexture.Height * Scale));
    }
开发者ID:olliwer,项目名称:angry_nerds,代码行数:7,代码来源:Sprite.cs


注:本文中的ContentManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。