OS : Windows
コンパイラ名 : C++
ライブラリ:Dxライブラリ
#include "DxLib.h"
#include "Load_Window.h"
#include "Naming.h"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
Load_Window();
Naming();
DxLib_End();
return 0;
}
#pragma once
#include "DxLib.h"
int WINAPI Load_Window()
{
LPCSTR font_path = "LoveLetter.ttf";
AddFontResource(font_path);
if (AddFontResource(font_path) > 0)
{
PostMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);
}
else
{
MessageBox(NULL, "フォント読込失敗", "", MB_OK);
}
SetWindowStyleMode(2);
ChangeWindowMode(TRUE);
SetBackgroundColor(255, 255, 255);
SetGraphMode(400, 200, 32);
if (DxLib_Init() != 0) return 0;
int x = 0;
int starttime = GetNowCount();
while (ProcessMessage() == 0)
{
x = GetNowCount() - starttime;
SetFontSize(16);
ChangeFont("Love Letter Typewriter");
DrawString(10, 10, "タイトル", GetColor(0, 0, 0));
DrawBox(0, 175, x / 5, 190, GetColor(200, 200, 200), TRUE);
if (x == 2500)
{
break;
}
}
DxLib_End();
return 0;
}
#pragma once
#include "DxLib.h"
#pragma warning(disable:4996)
int WINAPI Naming()
{
ChangeWindowMode(TRUE);
SetBackgroundColor(100, 100, 100);
if (DxLib_Init() != 0) return 0;
while (ProcessMessage() == 0)
{
char Name[31];
DrawString(20, 170, "本名(名のみ)を入力してください。", GetColor(0, 0, 0));
KeyInputString(40, 190, 20, Name, FALSE);
FILE *fp = fopen("Name.dat", "wb");
fwrite(&Name, sizeof(int), 1, fp);
fclose(fp);
ClearDrawScreen();
while (ProcessMessage() == 0)
{
DrawString(20, 170, Name, GetColor(0, 0, 0));
DrawString(20, 190, "でよろしいですか?", GetColor(0, 0, 0));
DrawString(50, 250, "決定 入力しなおす", GetColor(0, 0, 0));
int MouseX, MouseY;
GetMousePoint(&MouseX, &MouseY);
if (MouseX < 90 && MouseX > 50 && MouseY < 270 && MouseY > 250)
{
DrawString(50, 250, "決定", GetColor(50, 50, 50));
if (GetMouseInput()& MOUSE_INPUT_LEFT)
{
return 0;
}
}
if (MouseX < 220 && MouseX > 110 && MouseY < 270 && MouseY > 250)
{
DrawString(50, 250, " 入力しなおす", GetColor(50, 50, 50));
if (GetMouseInput()& MOUSE_INPUT_LEFT)
{
ClearDrawScreen();
break;
}
}
}
}
DxLib_End();
return 0;