teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

編集

2019/11/14 20:58

投稿

R-ogiura
R-ogiura

スコア60

title CHANGED
File without changes
body CHANGED
@@ -100,4 +100,92 @@
100
100
  fclose(fp);
101
101
  DrawFormatString(200, 300, Green, "strtalk = %d", strtalk);
102
102
 
103
+ ```
104
+
105
+ 編集1
106
+ ```
107
+ #include "DxLib.h"
108
+ #include "stdio.h"
109
+ #pragma warning(disable: 4996)
110
+
111
+
112
+ int i = 0;
113
+ int countchar = 0;
114
+ int loop = 1;
115
+ int Green = GetColor(0, 255, 0);
116
+ int x = 0, y = 0;
117
+ int a,b,c;
118
+ int mark = 0;
119
+
120
+ int strtalk = 0;
121
+ char str[7] = "あいう";
122
+
123
+ void mozi(void) {
124
+ if (countchar >= 0) { ++countchar; }
125
+ if (countchar == 50) {
126
+ countchar = 0;
127
+ ++i;
128
+
129
+
130
+ //ループを止めるためのプログラム。
131
+ if (i == 6) {
132
+ countchar = 11;
133
+ }
134
+
135
+
136
+ }
137
+ if (i == 1) { a = i; }
138
+ //printf("str[%d]は%c", i,str[i-1]);
139
+ if (a == 1) {
140
+ DrawFormatString(100+10, 500, Green, "%c%c", str[0], str[1]);
141
+ }
142
+ if (i == 2) { b = i; }
143
+ //printf("str[%d]は%c", i,str[i-1]);
144
+ if (b == 2) {
145
+ DrawFormatString(100 + 30, 500, Green, "%c%c", str[2], str[3]);
146
+ }
147
+ if (i == 3) { c = i; }
148
+ //printf("str[%d]は%c", i,str[i-1]);
149
+ if (c == 3) {
150
+ DrawFormatString(100 + 50, 500, Green, "%c%c", str[4], str[5]);
151
+ }
152
+
153
+ }
154
+ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) {
155
+
156
+ SetFontSize(25); //サイズを64に変更
157
+ SetFontThickness(10); //太さを8に変更
158
+ ChangeFont("MS 明朝"); //種類をMS明朝に変更
159
+ ChangeFontType(DX_FONTTYPE_ANTIALIASING); //アンチエイリアスフォントに変更
160
+
161
+ SetGraphMode(780, 680, 32); // ウィンドウの大きさを指定
162
+ ChangeWindowMode(TRUE); // 全画面ではなくウインドウを使用
163
+ if (DxLib_Init() == -1) return -1; // DXライブラリ初期化処理
164
+ SetDrawScreen(DX_SCREEN_BACK); // 裏画面を使用する設定
165
+
166
+ // ウインドウのサイズを手動ではできず、且つウインドウのサイズに合わせて拡大もしないようにする
167
+ SetWindowSizeChangeEnableFlag(FALSE, FALSE);
168
+
169
+ // 画面サイズは最大の780*680にしておく
170
+ SetGraphMode(780, 680, 32);
171
+
172
+
173
+ // 最初は 640x480 にしておく
174
+
175
+ SetWindowSize(780, 680);
176
+
177
+
178
+ // while(裏画面を表画面に反映, メッセージ処理, 画面クリア)
179
+ while (ScreenFlip() == 0 && ProcessMessage() == 0 && ClearDrawScreen() == 0) {
180
+
181
+
182
+
183
+ DrawFormatString(300, 400, Green, "countcharは%d", countchar, Font00); // 文字を描画する
184
+
185
+ mozi();//関数を置くことでiを含んだ描画の関数が働くようになる。
186
+ }
187
+
188
+ DxLib_End(); // DXライブラリ終了処理
189
+ return 0;
190
+ }
103
191
  ```