• R/O
  • SSH
  • HTTPS

nlgp1: Commit


Commit MetaInfo

Revision712 (tree)
Zeit2011-02-16 00:10:50
Autorbiikame

Log Message

Nlgp1.Program.DrawStringを追加

Ändern Zusammenfassung

Diff

--- trunk/Nlgp1/Nlgp1/Program.cs (revision 711)
+++ trunk/Nlgp1/Nlgp1/Program.cs (revision 712)
@@ -45,7 +45,7 @@
4545 DX.SetDoubleStartValidFlag( true );
4646
4747 DX.DxLib_Init();
48- Program.texts = new List< Text >();
48+ Program.actions = new List< Action >();
4949 Program.font = DX.CreateFontToHandle( "メイリオ" , 24 , -1 , DX.DX_FONTTYPE.ANTIALIASING );
5050 Screen screen;
5151 if( args.Length > 1 ) {
@@ -75,9 +75,11 @@
7575 DX.ClearDrawScreen();
7676 screen.Draw();
7777
78- foreach( Text text in Program.texts ) {
79- DX.DrawStringToHandle( text.X , text.Y , text.String , text.Color , Program.font );
78+ Program.DrawString( 0 , 0 , "てんこあいしてる" , new DX.COLOR_U8( 0x00 , 0xFF , 0x00 ) );
79+ foreach( Action action in Program.actions ) {
80+ action();
8081 }
82+ Program.actions.Clear();
8183 DX.ScreenFlip();
8284
8385 screen = screen.Update( controller );
@@ -90,10 +92,12 @@
9092 }
9193
9294 public static void DrawString( int x , int y , string string_ , DX.COLOR_U8 color ) {
93- Program.texts.Add( new Text( x , y , string_ , color ) );
95+ Program.actions.Add( () => {
96+ DX.DrawStringToHandle( x , y , string_ , color , Program.font );
97+ } );
9498 }
9599
96- private static List< Text > texts;
100+ private static List< Action > actions;
97101 private static DX.Font font;
98102
99103 /// <summary>
@@ -112,20 +116,5 @@
112116 public const int ScreenWidth = 512;
113117
114118 public const int ScreenHeight = 384;
115-
116- private sealed class Text {
117-
118- public Text( int x , int y , string string_ , DX.COLOR_U8 color ) {
119- this.X = x;
120- this.Y = y;
121- this.String = string_;
122- this.Color = color;
123- }
124-
125- public readonly int X;
126- public readonly int Y;
127- public readonly string String;
128- public readonly DX.COLOR_U8 Color;
129- }
130119 }
131120 }
Show on old repository browser