Bonsoir à tous,
Quelqu'un pourrait-il me dire pourquoi mon image ne s'affiche pas ?
je l'ai bien rajouter dans le répertoire mais j'ai un écran bleu
Merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97 #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 WindowsGame { public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager _graphics; ContentManager content; SpriteBatch _spriteBatch; Texture2D _texture2D; public Game1() { _graphics = new GraphicsDeviceManager(this); content = new ContentManager(Services); } protected override void Initialize() { base.Initialize(); _spriteBatch = new SpriteBatch(_graphics.GraphicsDevice); //properties of the game window _graphics.PreferredBackBufferWidth = 800; _graphics.PreferredBackBufferHeight = 600; _graphics.IsFullScreen = false; _graphics.ApplyChanges(); Window.Title = "Microsoft XNA - Boonaert Nicolas"; } protected override void LoadGraphicsContent(bool loadAllContent) { if (loadAllContent) { try { _texture2D = content.Load<Texture2D>(@"textures/vs2008"); } catch (Exception e) { Console.WriteLine(e.Message); } } } protected override void UnloadGraphicsContent(bool unloadAllContent) { if (unloadAllContent) { content.Unload(); } } protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); base.Update(gameTime); } protected override void Draw(GameTime gameTime) { try { _graphics.GraphicsDevice.Clear(Color.CornflowerBlue); _spriteBatch.Begin(SpriteBlendMode.AlphaBlend); _spriteBatch.Draw(_texture2D, new Rectangle(10, 10, 565, 210), Color.White); _spriteBatch.End(); } catch (Exception ex) { Console.WriteLine( ex.Message ); } base.Draw(gameTime); } } }
Partager