本文整理汇总了C#中ContentManager类的典型用法代码示例。如果您正苦于以下问题:C# ContentManager类的具体用法?C# ContentManager怎么用?C# ContentManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContentManager类属于命名空间,在下文中一共展示了ContentManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: TextureAtlasDefinition
/// <summary>
/// Initializes a new instance of the <see cref="TextureAtlasDefinition"/> class.
/// </summary>
/// <param name="xml">The XML document that defines the texture atlas.</param>
/// <param name="content">The content manager that is loading the texture atlas.</param>
/// <param name="assetPath">The asset path of the texture atlas that is being loaded.</param>
public TextureAtlasDefinition(XDocument xml, ContentManager content, String assetPath)
{
var metadata = xml.Root.Element("Metadata");
if (metadata != null)
{
rootDirectory = metadata.ElementValueString("RootDirectory") ?? rootDirectory;
requirePowerOfTwo = metadata.ElementValueBoolean("RequirePowerOfTwo") ?? requirePowerOfTwo;
requireSquare = metadata.ElementValueBoolean("RequireSquare") ?? requireSquare;
maximumWidth = metadata.ElementValueInt32("MaximumWidth") ?? maximumWidth;
maximumHeight = metadata.ElementValueInt32("MaximumHeight") ?? maximumHeight;
padding = metadata.ElementValueInt32("Padding") ?? padding;
}
var assetDirectory = Path.GetDirectoryName(assetPath);
rootDirectory = ContentManager.NormalizeAssetPath(
Path.Combine(assetDirectory, rootDirectory ?? String.Empty));
var images = xml.Root.Element("Images");
if (!LoadImages(content, images))
{
throw new InvalidOperationException(UltravioletStrings.TextureAtlasContainsNoImages);
}
SortImagesBySize();
}
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:31,代码来源:TextureAtlasDefinition.cs
示例17: DialogScreen
/// <summary>
/// Initializes a new instance of the <see cref="DialogScreen"/> class.
/// </summary>
/// <param name="dialog">The dialog that owns this screen.</param>
/// <param name="globalContent">The screen's global content manager.</param>
public DialogScreen(EscMenuDialog dialog, ContentManager globalContent)
: base("Content/UI/Dialogs/EscMenuDialog", "EscMenuDialog", globalContent)
{
Contract.Require(dialog, "dialog");
View.SetViewModel(new DialogScreenVM(dialog));
}
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:12,代码来源:EscMenuDialog.DialogScreen.cs
示例18: Startup
// Startup
public override void Startup( ContentManager content )
{
_UI.Startup( _G.Game, _G.GameInput );
// load textures
int bundleIndex = _UI.Texture.CreateBundle();
_UI.Texture.Add( bundleIndex, "Textures\\UI_Box", "box" );
// load fonts
_UI.Font.Add( "Fonts\\", "SegoeUI" );
// setup common font styles
UI.FontStyle fontStyle = new UI.FontStyle( "SegoeUI" );
fontStyle.AddRenderPass( new UI.FontStyleRenderPass() );
_UI.Store_FontStyle.Add( "Default", fontStyle );
UI.FontStyle fontStyleDS = new UI.FontStyle( "SegoeUI" );
UI.FontStyleRenderPass renderPassDS = new UI.FontStyleRenderPass();
renderPassDS.ColorOverride = Color.Black;
renderPassDS.AlphaMult = 0.5f;
renderPassDS.Offset = new Vector3( 0.05f, -0.05f, 0.0f );
renderPassDS.OffsetProportional = true;
fontStyleDS.AddRenderPass( renderPassDS );
fontStyleDS.AddRenderPass( new UI.FontStyleRenderPass() );
_UI.Store_FontStyle.Add( "Default3dDS", fontStyleDS );
// setup font icons
_UI.Store_FontIcon.Add( "A", new UI.FontIcon( _UI.Texture.Get( "null" ), 0.0f, 0.0f, 1.0f, 1.0f ) );
_UI.Store_FontIcon.Add( "B", new UI.FontIcon( _UI.Texture.Get( "null" ), 0.0f, 0.0f, 1.0f, 1.0f ) );
// add initial screens
_UI.Screen.AddScreen( new UI.Screen_Background() );
_UI.Screen.AddScreen( new UI.Screen_Start() );
}
开发者ID:jtavandenheuvel,项目名称:pcg-decoration-new,代码行数:36,代码来源:Layer.cs
示例19: LoadContent
public override void LoadContent(ContentManager content)
{
var text = ResourceManager.GetResource<TextFile>("HowToPlay");
_labelRules = new Label(_game, text.Text, "DefaultFont", Color.White)
{
Visible = true,
Enabled = true,
Position = new Vector2(25, 25),
Size = new Rectangle(0, 0, 1, 1)
};
_backButton = new Button(_game, "ButtonExit", "ButtonExitHovered", "ButtonFont")
{
Text = "Return to main menu",
Enabled = true,
Position = new Vector2(25, 700),
Size = new Rectangle(0, 0, 275, 50)
};
_registeredControls.Add(_labelRules);
_registeredControls.Add(_backButton);
_backButton.OnClick += ReturnToMainMenu;
}
开发者ID:KaskadekingDE,项目名称:ChainReact,代码行数:25,代码来源:HowToPlayComponent.cs
示例20: MessageBox
public MessageBox(ContentManager contentManager, SpriteRenderer spriteRenderer)
{
this.contentManager = contentManager;
this.spriteRenderer = spriteRenderer;
registerSprites();
}
开发者ID:nagyistoce,项目名称:tmotmo,代码行数:7,代码来源:MessageBox.cs
注:本文中的ContentManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论