Предыдущая Следующая
/// Проект: LoadingModel /// Класс: Gamel /// Загрузка модели /// <summary>
//=========================================================================
#region Using Statements using System;
using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; #endregion
namespace LoadingModel {
public class Gamel : Microsoft.Xna.Framework.Game
{
private enum CurentGameState
294 Загружаем в игру модель
{
SplashScreen,
MenuScreen,
HelpScreen,
AboutScreen,
GameScreen,
GameOverScreen,
VictoryScreen
}
CurentGameState gameState = CurentGameState.GameScreen;
GraphicsDeviceManager graphics;
ContentManager content;
int screenWidth, screenHeight;
Matrix view; Matrix proj; Matrix world;
static float aspectRatio;
static float FOV = MathHelper.PiOver4;
static float nearClip = 1.0f;
static float farClip = 1000.0f;
private Model model;
private Vector3 positionModel;
/// <summary> /// Конструктор /// <summary> public Game1()
{
graphics = new GraphicsDeviceManager(this); content = new ContentManager(Services); graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; screenWidth = graphics.PreferredBackBufferWidth; screenHeight = graphics.PreferredBackBufferHeight;
}
/// <summary> /// Инициализация /// <summary>
protected override void Initialize()
{
aspectRatio = (float)screenWidth / (float)screenHeight; positionModel = new Vector3(0, 0, 0);
base.Initialize();
}
/// <summary>
/// Загрузка компонентов игры /// <summary>
protected override void LoadGraphicsContent(bool loadAllContent)
{
Рисуем модель на экране телевизора 295
if (loadAllContent) {
model = content.Load<Model>(«Content\\Models\\Soccerball»);
}
}
/// <summary>
/// Освобождаем ресурсы
/// <summary>
protected override void UnloadGraphicsContent(bool unloadAllContent)
{
if (unloadAllContent == true)
{
content.Unload();
}
}
/// <summary>
/// Обновляем состояние игры /// <summary>
protected override void Update(GameTime gameTime)
{ }
/// <summary>
/// Рисуем на экране
/// <summary>
protected override void Draw(GameTime gameTime)
{
graphics.GraphicsDevice.Clear(new Color(159, 147, 207)); switch (gameState)
{
case CurentGameState.SplashScreen:
{
break;
}
case CurentGameState.MenuScreen: Предыдущая Следующая
|