This repository has been archived by the owner on Apr 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
158 additions
and
16 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,46 @@ | ||
#include "DxLib.h" | ||
#include "coutDx.hpp" | ||
|
||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) | ||
{ | ||
ChangeWindowMode(TRUE); | ||
// DXライブラリ初期化処理 | ||
if (DxLib_Init() == -1) | ||
{ | ||
return -1; // エラーが起きたら直ちに終了 | ||
} | ||
if (DxLib_Init() == -1) return -1; | ||
|
||
LoadGraph("a.jpg", TRUE); | ||
const char char_ = 'a'; | ||
const unsigned char uchar_ = 'a'; | ||
const signed char schar_ = 'a'; | ||
const unsigned short ushort_ = 1; | ||
const short short_ = -1; | ||
const unsigned int uint_ = 1; | ||
const int int_ = -1; | ||
const unsigned long ulong_ = 1; | ||
const long long_ = -1; | ||
const unsigned long long ulonglong_ = 1; | ||
const long long longlong_ = -1; | ||
const float float_ = 1.0f; | ||
const double double_ = 1.0; | ||
const long double longdouble_ = 1.0; | ||
const char* const char_ptr_ = "Hello World!"; | ||
const std::string string_ = "Hello World!"; | ||
|
||
while (CheckHitKeyAll() == 0) | ||
{ | ||
// メッセージループに代わる処理をする | ||
if (ProcessMessage() == -1) | ||
{ | ||
break; // エラーが起きたらループを抜ける | ||
} | ||
} | ||
coutDx << char_ << endlDx; | ||
coutDx << uchar_ << endlDx; | ||
coutDx << schar_ << endlDx; | ||
coutDx << ushort_ << endlDx; | ||
coutDx << short_ << endlDx; | ||
coutDx << uint_ << endlDx; | ||
coutDx << int_ << endlDx; | ||
coutDx << ulong_ << endlDx; | ||
coutDx << long_ << endlDx; | ||
coutDx << ulonglong_ << endlDx; | ||
coutDx << longlong_ << endlDx; | ||
coutDx << float_ << endlDx; | ||
coutDx << double_ << endlDx; | ||
coutDx << longdouble_ << endlDx; | ||
coutDx << char_ptr_ << endlDx; | ||
coutDx << string_ << endlDx; | ||
|
||
WaitKey(); | ||
DxLib_End(); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
#pragma once | ||
#include <string> | ||
|
||
#ifdef __DXLIB | ||
#ifndef DX_NON_NAMESPACE | ||
namespace DxLib | ||
{ | ||
#endif // DX_NON_NAMESPACE | ||
|
||
struct EndlDx { | ||
EndlDx() = default; | ||
~EndlDx() = default; | ||
}; | ||
constexpr EndlDx endlDx; | ||
|
||
struct ClearDx { | ||
ClearDx() = default; | ||
~ClearDx() = default; | ||
}; | ||
constexpr ClearDx clearDx; | ||
|
||
class CoutDx { | ||
public: | ||
|
||
const CoutDx& operator<<(const char var_) const { | ||
printfDx("%c", var_); | ||
return *this; | ||
} | ||
const CoutDx& operator<<(const signed char var_) const { | ||
printfDx("%c", (char)var_); | ||
return *this; | ||
} | ||
const CoutDx& operator<<(const unsigned char var_) const { | ||
printfDx("%c", (char)var_); | ||
return *this; | ||
} | ||
const CoutDx& operator<<(const short var_) const { | ||
printfDx("%d", var_); | ||
return *this; | ||
} | ||
const CoutDx& operator<<(const unsigned short var_) const { | ||
printfDx("%u", var_); | ||
return *this; | ||
} | ||
const CoutDx& operator<<(const int var_) const { | ||
printfDx("%d", var_); | ||
return *this; | ||
} | ||
const CoutDx& operator<<(const unsigned int var_) const { | ||
printfDx("%u", var_); | ||
return *this; | ||
} | ||
const CoutDx& operator<<(const long var_) const { | ||
printfDx("%ld", var_); | ||
return *this; | ||
} | ||
const CoutDx& operator<<(const unsigned long var_) const { | ||
printfDx("%lu", var_); | ||
return *this; | ||
} | ||
const CoutDx& operator<<(const long long var_) const { | ||
printfDx("%lld", var_); | ||
return *this; | ||
} | ||
const CoutDx& operator<<(const unsigned long long var_) const { | ||
printfDx("%llu", var_); | ||
return *this; | ||
} | ||
|
||
const CoutDx& operator<<(const float var_) const { | ||
printfDx("%f", var_); | ||
return *this; | ||
} | ||
const CoutDx& operator<<(const double var_) const { | ||
printfDx("%f", var_); | ||
return *this; | ||
} | ||
const CoutDx& operator<<(const long double var_) const { | ||
printfDx("%lf", var_); | ||
return *this; | ||
} | ||
|
||
const CoutDx& operator<<(const char* const var_) const { | ||
printfDx("%s", var_); | ||
return *this; | ||
} | ||
const CoutDx& operator<<(const std::string& var_) const { | ||
printfDx("%s", var_.c_str()); | ||
return *this; | ||
} | ||
|
||
const CoutDx& operator<<(const EndlDx& var_) const { | ||
printfDx("\n"); | ||
return *this; | ||
} | ||
const CoutDx& operator<<(const ClearDx& var_) const { | ||
clsDx(); | ||
return *this; | ||
} | ||
const CoutDx& endl() const { | ||
printfDx("\n"); | ||
return *this; | ||
} | ||
const CoutDx& clear() const { | ||
clsDx(); | ||
return *this; | ||
} | ||
}; | ||
constexpr CoutDx coutDx; | ||
|
||
#ifndef DX_NON_NAMESPACE | ||
} | ||
#endif // DX_NON_NAMESPACE | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters