Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <DxLib.h>
- class Str {
- const char *str;
- int frame;
- int pos;
- int count;
- public:
- Str(const char *str, int frame)
- : str(str), frame(frame), pos(0), count(0) {}
- void drawString(int x, int y, int color) {
- if (count == 0 && str[pos]) pos += 1 + IsDBCSLeadByte(str[pos]);
- if (++count == frame) count = 0;
- DrawFormatString(x, y, color, "%.*s", pos, str);
- }
- void reset() { pos = count = 0; }
- };
- int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
- {
- SetFontSize(25); //サイズを64に変更 ???
- SetFontThickness(10); //太さを8に変更 ???
- ChangeFont("MS 明朝"); //種類をMS明朝に変更
- ChangeFontType(DX_FONTTYPE_ANTIALIASING); //アンチエイリアスフォント
- SetGraphMode(780, 680, 32); // ウィンドウの大きさを指定
- ChangeWindowMode(TRUE); // 全画面ではなくウインドウを使用
- if (DxLib_Init() == -1) return -1; // DXライブラリ初期化処理
- SetDrawScreen(DX_SCREEN_BACK); // 裏画面を使用する設定
- SetWindowSizeChangeEnableFlag(FALSE, FALSE);
- SetGraphMode(780, 680, 32); // 画面サイズは最大の780*680にしておく
- SetWindowSize(780, 680); // 最初は 640x480 にしておく ???
- int Green = GetColor(0, 255, 0);
- Str str1("あいうabc", 50); // 6文字を 50フレームごとに 1文字追加
- // 全部で 300フレーム(5秒)
- int t = 0;
- while (!ScreenFlip() && !ProcessMessage() && !ClearDrawScreen()) {
- str1.drawString(100, 500, Green);
- if (++t == 60 * 6) { t = 0; str1.reset(); } // 6秒ごとにリセット
- }
- DxLib_End(); // DXライブラリ終了処理
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement