Fix compile error under VS2017
This commit is contained in:
parent
3188ce2fab
commit
ba3b18d726
@ -1,7 +1,7 @@
|
|||||||
#include "ColorUI.h"
|
#include "ColorUI.h"
|
||||||
|
#include <Windows.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <windows.h>
|
#include <conio.h> // getch
|
||||||
#include <conio.h>
|
|
||||||
|
|
||||||
namespace _cns
|
namespace _cns
|
||||||
{
|
{
|
||||||
@ -175,12 +175,12 @@ int GetAction(int& cid,int MinVal,int MaxVal,int EscapeVal)
|
|||||||
{
|
{
|
||||||
case KEY::UP:
|
case KEY::UP:
|
||||||
{
|
{
|
||||||
cid=std::max(std::min(cid-1,MaxVal),MinVal);
|
cid=max(min(cid-1,MaxVal),MinVal);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case KEY::DOWN:
|
case KEY::DOWN:
|
||||||
{
|
{
|
||||||
cid=std::max(std::min(cid+1,MaxVal),MinVal);
|
cid=max(min(cid+1,MaxVal),MinVal);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case KEY::ESC:
|
case KEY::ESC:
|
||||||
@ -205,6 +205,11 @@ int GetAction(int& cid,int MinVal,int MaxVal,int EscapeVal)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ClearInputBuffer()
|
||||||
|
{
|
||||||
|
scanf("%*[^\n]%*c");
|
||||||
|
}
|
||||||
|
|
||||||
}/// End of namespace _cns
|
}/// End of namespace _cns
|
||||||
|
|
||||||
ColorSelection::ColorSelection()
|
ColorSelection::ColorSelection()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "ConsoleUI/ColorUI.h"
|
#include "ConsoleUI/ColorUI.h"
|
||||||
|
#include <cstdio>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class ReturnButton : public ColorSelection
|
class ReturnButton : public ColorSelection
|
||||||
@ -88,11 +89,12 @@ public:
|
|||||||
while(scanf("%d%*c",&input)!=1)
|
while(scanf("%d%*c",&input)!=1)
|
||||||
{
|
{
|
||||||
printf("Invalid Input.\n");
|
printf("Invalid Input.\n");
|
||||||
|
scanf("%*[^\n]%*c");
|
||||||
}
|
}
|
||||||
printf("Well Done! You inputed: %d\n",input);
|
printf("Well Done! You inputed: %d\n",input);
|
||||||
printf("You may have understand it. Now Press ENTER To Continue.\n");
|
printf("You may have understand it. Now Press ENTER To Continue.\n");
|
||||||
char buff[1024];
|
char buff[1024];
|
||||||
gets(buff);
|
fgets(buff, 1024, stdin);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user