Увидели сообщение с непонятной ссылкой, спам, непристойность или оскорбление?Воспользуйтесь ссылкой «Сообщить модератору» рядом с сообщением!
0 Пользователей и 1 Гость просматривают эту тему.
#region Using Statementsusing System;using Microsoft.Xna.Framework;using Microsoft.Xna.Framework.Graphics;using Microsoft.Xna.Framework.Storage;using Microsoft.Xna.Framework.Input;using Microsoft.Xna.Framework.Content;#endregionnamespace main{ /// <summary> /// This is the main type for your game /// </summary> public class Game1 :Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; SpriteFont spriteFont;//текст Vector2 vector;//координеты текста string str="text"; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; //graphics.IsFullScreen = true; //полноэкранный режим vector = new Vector2 (10,10); } /// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { this.Window.Title="test"; // TODO: Add your initialization logic here base.Initialize(); } /// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); //TODO: use this.Content to load your game content here spriteFont=Content.Load<SpriteFont>("EmptyTextFile.txt");//Загрузка шрифта для текста } /// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // For Mobile devices, this logic will close the Game when the Back button is pressed if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } // TODO: Add your update logic here base.Update(gameTime); } /// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { graphics.GraphicsDevice.Clear(Color.CornflowerBlue); //TODO: Add your drawing code here spriteBatch.Begin(); spriteBatch.DrawString(spriteFont,str,vector,Color.Black); spriteBatch.End (); base.Draw(gameTime); } }}
#region Using Statementsusing System;using System.Collections.Generic;using System.Linq;#endregionnamespace main{ static class Program { private static Game1 game; /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { game = new Game1(); game.Run(); } }}
<?xml version="1.0" encoding="UTF-8" ?><XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics"><Asset Type="Graphics:FrontDecription"><FontName>Segoe UI Mono</FontName><Size>14</Size><Spacing>0</Spacing><UseKerning>true</UseKerning><style>Regular</style><CharacterRegion><CharacterRegion><Start> </Start><End>~</End></CharacterRegion></CharacterRegion></Asset></XnaContent>
Microsoft.Xna.Framework.Content.ContentLoadException: Could not load SpriteFon1 asset! at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[SpriteFont] (System.String assetName, System.Action`1 recordDisposableObject) [0x00000] in <filename unknown>:0 at Microsoft.Xna.Framework.Content.ContentManager.Load[SpriteFont] (System.String assetName) [0x00000] in <filename unknown>:0 at main.Game1.LoadContent () [0x0001e] in /home/user/Документы/main/main/Game1.cs:57 at Microsoft.Xna.Framework.Game.Initialize () [0x00000] in <filename unknown>:0 at main.Game1.Initialize () [0x00012] in /home/user/Документы/main/main/Game1.cs:43 at Microsoft.Xna.Framework.Game.Run (GameRunBehavior runBehavior) [0x00000] in <filename unknown>:0 at Microsoft.Xna.Framework.Game.Run () [0x00000] in <filename unknown>:0 at main.Program.Main () [0x00010] in /home/user/Документы/main/main/Program.cs:20
spriteFont = Content.Load<SpriteFont>("EmptyTextFile.txt");
spriteFont = Content.Load<SpriteFont>("Segoe UI Mono");
Страница сгенерирована за 0.016 секунд. Запросов: 22.