Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. int ekranayar(lua_State *ls){
  2. ekranx = lua_tonumber(ls,1);
  3. ekrany = lua_tonumber(ls,2);
  4. ekranstr = lua_tonumber(ls,3);
  5.  
  6. if(ekranx < 1)ekranx = 1;
  7. else if(ekranx > 79)ekranx = 79;
  8.  
  9. if(ekrany < 1)ekrany = 1;
  10. else if(ekrany > 83)ekrany = 83;
  11.  
  12. //windowSize = {0, 0, ekranx, ekrany};
  13. // SetConsoleWindowInfo(console, 1, &windowSize);
  14. //SetConsoleWindowInfo(buffer, 1, &windowSize);
  15.  
  16.  
  17. //cursor.bVisible = false;
  18. //SetConsoleCursorInfo(hConsole,&cursor);
  19.  
  20. for(int y=0;y<ekrany;y++){
  21. for(int x=0;x<ekranx;x++){
  22. ekranR[x][y]=256;
  23. }
  24. }
  25.  
  26. SetConsoleActiveScreenBuffer(buffer);
  27.  
  28. HWND console = GetConsoleWindow();
  29. RECT r;
  30. GetWindowRect(console, &r); //stores the console's current dimensions
  31.  
  32. MoveWindow(console, r.left, r.top,300, 300, TRUE); // 800 width, 100 height
  33.  
  34. return 1;
  35. }
  36.  
  37. int ekranbas(lua_State *ls){
  38.  
  39. SetConsoleCursorPosition(hConsole,{0,0});
  40. for(int y=0;y<ekrany;y++){
  41. for(int x=0;x<ekranx;x++){
  42. if(ekranR[x][y]==256)SetConsoleTextAttribute(hConsole,ekranstr);
  43. else SetConsoleTextAttribute(hConsole,ekranR[x][y]);
  44. //printf("%c",ekran[x][y]);
  45. WriteConsole(hConsole,L" ",1,&writen,NULL);
  46.  
  47. }
  48. //printf("\n");
  49. WriteConsole(hConsole,L"\n",1,&writen,NULL);
  50. }
  51. SetConsoleTextAttribute(hConsole,7);
  52. SetConsoleActiveScreenBuffer(hConsole);
  53. swap(hConsole,buffer);
  54. SetConsoleTextAttribute(buffer,7);
  55.  
  56.  
  57. return 1;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement