Advertisement
NgJaBach

Game Default Template

Jan 23rd, 2020
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. /*
  2. *Author:Nguyen Gia Bach (Ng.JaBach).
  3. *This is an open source code.
  4. */
  5. #include<bits/stdc++.h>
  6. #include<windows.h>
  7. using namespace std;
  8. #define color(a) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a)
  9.  
  10. void gotoxy(int tranxuanbach, int vuminhduc){
  11.   COORD coord;
  12.   coord.X = tranxuanbach;
  13.   coord.Y = vuminhduc;
  14.   SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
  15. }
  16. void SetWindow(int Width, int Height){
  17.     _COORD coord;
  18.     coord.X = Width;
  19.     coord.Y = Height;
  20.     _SMALL_RECT Rect;
  21.     Rect.Top = 0;
  22.     Rect.Left = 0;
  23.     Rect.Bottom = Height - 1;
  24.     Rect.Right = Width - 1;
  25.     HANDLE Handle = GetStdHandle(STD_OUTPUT_HANDLE);      // Get Handle
  26.     SetConsoleScreenBufferSize(Handle, coord);            // Set Buffer Size
  27.     SetConsoleWindowInfo(Handle, TRUE, &Rect);            // Set Window Size
  28. }
  29. int main(){
  30.     ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
  31.     SetWindow(100,100);
  32.     for(int i=0;i<=255;i++){
  33.         gotoxy(10,10+i);
  34.         color(i); cout<<i<<" gay"<<endl;
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement