保留状態だったデモを追加。
@@ -0,0 +1,19 @@ | ||
1 | +using System; | |
2 | + | |
3 | +namespace MikuMikuDanceXNADemo | |
4 | +{ | |
5 | + static class Program | |
6 | + { | |
7 | + /// <summary> | |
8 | + /// The main entry point for the application. | |
9 | + /// </summary> | |
10 | + static void Main(string[] args) | |
11 | + { | |
12 | + using (Game1 game = new Game1()) | |
13 | + { | |
14 | + game.Run(); | |
15 | + } | |
16 | + } | |
17 | + } | |
18 | +} | |
19 | + |
@@ -0,0 +1,33 @@ | ||
1 | +using System.Reflection; | |
2 | +using System.Runtime.CompilerServices; | |
3 | +using System.Runtime.InteropServices; | |
4 | + | |
5 | +// General Information about an assembly is controlled through the following | |
6 | +// set of attributes. Change these attribute values to modify the information | |
7 | +// associated with an assembly. | |
8 | +[assembly: AssemblyTitle("MikuMikuDanceXNADemo")] | |
9 | +[assembly: AssemblyProduct("MikuMikuDanceXNADemo")] | |
10 | +[assembly: AssemblyDescription("")] | |
11 | +[assembly: AssemblyCompany("")] | |
12 | + | |
13 | +[assembly: AssemblyCopyright("Copyright © 2010")] | |
14 | +[assembly: AssemblyTrademark("")] | |
15 | +[assembly: AssemblyCulture("")] | |
16 | + | |
17 | +// Setting ComVisible to false makes the types in this assembly not visible | |
18 | +// to COM components. If you need to access a type in this assembly from | |
19 | +// COM, set the ComVisible attribute to true on that type. | |
20 | +[assembly: ComVisible(false)] | |
21 | + | |
22 | +// The following GUID is for the ID of the typelib if this project is exposed to COM | |
23 | +[assembly: Guid("adb5a70b-707d-436d-9569-ee76cff6cc90")] | |
24 | + | |
25 | + | |
26 | +// Version information for an assembly consists of the following four values: | |
27 | +// | |
28 | +// Major Version | |
29 | +// Minor Version | |
30 | +// Build Number | |
31 | +// Revision | |
32 | +// | |
33 | +[assembly: AssemblyVersion("1.0.0.0")] |
@@ -0,0 +1,105 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using Microsoft.Xna.Framework; | |
5 | +using Microsoft.Xna.Framework.Audio; | |
6 | +using Microsoft.Xna.Framework.Content; | |
7 | +using Microsoft.Xna.Framework.GamerServices; | |
8 | +using Microsoft.Xna.Framework.Graphics; | |
9 | +using Microsoft.Xna.Framework.Input; | |
10 | +using Microsoft.Xna.Framework.Media; | |
11 | +using Microsoft.Xna.Framework.Net; | |
12 | +using Microsoft.Xna.Framework.Storage; | |
13 | +using MikuMikuDance.XNA.Model; | |
14 | +using MikuMikuDance.XNA; | |
15 | +using MikuMikuDance.XNA.Motion; | |
16 | + | |
17 | +namespace MikuMikuDanceXNADemo | |
18 | +{ | |
19 | + /// <summary> | |
20 | + /// MikuMikuDance for XNAのデモ | |
21 | + /// </summary> | |
22 | + public class Game1 : Microsoft.Xna.Framework.Game | |
23 | + { | |
24 | + GraphicsDeviceManager graphics; | |
25 | + //MikuMikuDance for XNA | |
26 | + MikuMikuDanceXNA mmd; | |
27 | + //MMDモデルデータ | |
28 | + MMDModel model; | |
29 | + //MMDモーションデータ | |
30 | + MMDMotion motion; | |
31 | + | |
32 | + public Game1() | |
33 | + { | |
34 | + graphics = new GraphicsDeviceManager(this); | |
35 | + Content.RootDirectory = "Content"; | |
36 | + mmd = new MikuMikuDanceXNA(this); | |
37 | + } | |
38 | + | |
39 | + protected override void Initialize() | |
40 | + { | |
41 | + base.Initialize(); | |
42 | + } | |
43 | + | |
44 | + /// <summary> | |
45 | + /// LoadContent | |
46 | + /// </summary> | |
47 | + protected override void LoadContent() | |
48 | + { | |
49 | + //モデルのロード(大人の事情により、モデルとモーションファイルは入れてません。必要な方はMMDより) | |
50 | + model = mmd.LoadModel("Miku", this, Matrix.Identity); | |
51 | + //モーションのロード | |
52 | + motion = mmd.LoadMotion("TrueMyHeart"); | |
53 | + model.Player.SetMotion(motion, true); | |
54 | + } | |
55 | + | |
56 | + /// <summary> | |
57 | + /// UnloadContent | |
58 | + /// </summary> | |
59 | + protected override void UnloadContent() | |
60 | + { | |
61 | + } | |
62 | + | |
63 | + bool EnterFlag = true; | |
64 | + /// <summary> | |
65 | + /// アップデート | |
66 | + /// </summary> | |
67 | + /// <param name="gameTime">Provides a snapshot of timing values.</param> | |
68 | + protected override void Update(GameTime gameTime) | |
69 | + { | |
70 | + if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) | |
71 | + this.Exit(); | |
72 | + if (Keyboard.GetState().IsKeyDown(Keys.Escape)) | |
73 | + this.Exit(); | |
74 | + if (Keyboard.GetState().IsKeyDown(Keys.Enter) || GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed) | |
75 | + { | |
76 | + if (EnterFlag) | |
77 | + { | |
78 | + //ダンスの再生 | |
79 | + model.Player.Start(0, gameTime, false); | |
80 | + EnterFlag = false; | |
81 | + } | |
82 | + } | |
83 | + else | |
84 | + { | |
85 | + if (!EnterFlag) | |
86 | + EnterFlag = true; | |
87 | + } | |
88 | + | |
89 | + | |
90 | + base.Update(gameTime); | |
91 | + } | |
92 | + | |
93 | + /// <summary> | |
94 | + /// This is called when the game should draw itself. | |
95 | + /// </summary> | |
96 | + /// <param name="gameTime">Provides a snapshot of timing values.</param> | |
97 | + protected override void Draw(GameTime gameTime) | |
98 | + { | |
99 | + GraphicsDevice.Clear(Color.CornflowerBlue); | |
100 | + | |
101 | + | |
102 | + base.Draw(gameTime); | |
103 | + } | |
104 | + } | |
105 | +} |