Hi guys. First i want to thank all of you that have hellped me so far.
I realy need to know how to hide the cursor in c++. Its realy important.
Printable View
Hi guys. First i want to thank all of you that have hellped me so far.
I realy need to know how to hide the cursor in c++. Its realy important.
got this from adrianxw's tutorialCode:HANDLE hOut;
CONSOLE_CURSOR_INFO ConCurInf;
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
ConCurInf.dwSize = 10;
ConCurInf.bVisible = FALSE;
SetConsoleCursorInfo(hOut, &ConCurInf);
» You also need to understand that the above code requires <windows.h> and will only run on the Windows operating system. There is no standard way.
why does this reek of bad intent?Quote:
Originally Posted by Smoki
I realy need to know how to send trojans to people in c++. Its realy important.
Where should i put it. I did it in int main() but it doest work. Mostly the programme is with functions.
This is a part of my code. I made the cursor as a function and this is a part of another function. I tryed to put it in the INT MAIN but it doesnt seem to work.
P.S. I use colors is that a problem?
Code:
if (b=='m' || b=='w' || b=='d' || b=='s' || b=='a')
{
cursor();
gotoxy(x,y);
cursor();
cout<<con::fg_green<<a<<con::fg_black;
b='m';
gotoxy(holdx,holdy);
cursor();
cout<<z;
}
What compiler are you using?
Dev C++
Well then it should work.
Code:#include <windows.h>
#include <iostream>
int main(void) {
HANDLE hOut;
CONSOLE_CURSOR_INFO ConCurInf;
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
ConCurInf.dwSize = 10;
ConCurInf.bVisible = FALSE;
SetConsoleCursorInfo(hOut, &ConCurInf);
std::cout << "The cursor should be gone.\n";
std::cin.get();
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
ConCurInf.dwSize = 10;
ConCurInf.bVisible = TRUE;
SetConsoleCursorInfo(hOut, &ConCurInf);
return 0;
}
I tryed that. But no result. I tyed it on a simple code it worked. But on this one not. If you want i can send u the whole code (its a small game im makin thats why i need to get rid of the cursor).
You should never need to get rid of the cursor. It would be very annoying if you did so. Windws XP probably doesn't allow it.Quote:
(its a small game im makin thats why i need to get rid of the cursor)
If you really hate the cursor, press ALT-ENTER.
[edit]
Wait, I'm assuming you mean the mouse cursor. But now I see you mean the text cursor.
[/edit]
So my above program worked, and yours didn't? That's strange.Quote:
I tryed that. But no result. I tyed it on a simple code it worked. But on this one not. If you want i can send u the whole code
If you want to you can post your code here.
Why do you want to hide the cursor?
Now i tryed it with TRUE and gave value 50 it gets bigger. But with FALSE it doesnt work. Now i call this trange. HERE U HAVE THE CODE. Sorry its not commented and some things are written in albanian language. So if u might know where the problem is i would be realy thankfull.
Code:#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <console.h>
#include "conio.h"
namespace con = JadedHoboConsole;
using namespace std;
void gotoxy(int x, int y) // ky funksion sherben per me shkru ne kordinaten e caktume
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
void fullscreen()
{
keybd_event(VK_MENU,0x38,0,0);
keybd_event(VK_RETURN,0x1c,0,0);
keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);
}
void graphic()
{
SetConsoleCursorInfo(hOut, &ConCurInf);
cout<<con::fg_yellow<<endl<<endl<<endl
<<" ΙΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ»\n"
<<" Ί Ί\n"
<<" Ί Ί\n"
<<" Ί Ί\n"
<<" Ί Ί\n"
<<" Ί Ί\n"
<<" Ί Ί\n"
<<" Ί Ί\n"
<<" Ί Ί\n"
<<" Ί Ί\n"
<<" Ί Ί\n"
<<" Ί Ί\n"
<<" Ί Ί\n"
<<" Ί Ί\n"
<<" Ί Ί\n"
<<" Ί Ί\n"
<<" Ί Ί\n"
<<" ΘΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΌ\n"<<con::fg_black;
}
void level1()
{
gotoxy(36, 1);
cout<<con::fg_green<<"NIVELI 1";
gotoxy(45, 7);
cout<<con::fg_cyan<<"°";
gotoxy(35, 8);
cout<<"°";
gotoxy(25, 4);
cout<<con::fg_red<<"°";
gotoxy(32, 7);
cout<<con::fg_red<<"°";
gotoxy(47, 10);
cout<<con::fg_red<<"°";
gotoxy(19, 19);
cout<<con::fg_red<<"°";
gotoxy(41, 11);
cout<<con::fg_cyan<<"°";
gotoxy(60, 5);
cout<<"°";
gotoxy(45, 8);
cout<<"°";
gotoxy(31, 10);
cout<<"°";
gotoxy(35, 15);
cout<<"°";
gotoxy(21, 14);
cout<<"°";
gotoxy(17, 13);
cout<<"°";
gotoxy(16, 16);
cout<<"°";
gotoxy(45, 10);
cout<<"°";
gotoxy(49, 18);
cout<<"°";
gotoxy(39, 12);
cout<<"°";
gotoxy(63, 12);
cout<<"°"<<con::fg_black;
}
void level2()
{
gotoxy(36, 1);
cout<<con::fg_green<<"NIVELI 2";
gotoxy(60, 5);
cout<<con::fg_cyan<<"°";
gotoxy(51, 7);
cout<<"°";
gotoxy(52, 7);
cout<<"°";
gotoxy(43, 14);
cout<<"°";
gotoxy(45, 7);
cout<<"°";
gotoxy(21, 11);
cout<<"°";
gotoxy(18, 7);
cout<<"°";
gotoxy(19, 8);
cout<<"°";
gotoxy(56, 4);
cout<<con::fg_red<<"°";
gotoxy(26, 7);
cout<<con::fg_red<<"°";
gotoxy(28, 10);
cout<<con::fg_red<<"°";
gotoxy(17, 19);
cout<<con::fg_red<<"°";
gotoxy(63, 11);
cout<<con::fg_cyan<<"°";
gotoxy(49, 5);
cout<<"°";
gotoxy(37, 7);
cout<<"°";
gotoxy(52, 10);
cout<<"°";
gotoxy(35, 15);
cout<<"°";
gotoxy(21, 14);
cout<<"°";
gotoxy(17, 13);
cout<<"°";
gotoxy(16, 14);
cout<<"°";
gotoxy(45, 10);
cout<<"°";
gotoxy(49, 14);
cout<<"°";
gotoxy(39, 12);
cout<<"°";
gotoxy(63, 12);
cout<<"°"<<con::fg_black;
}
void level3()
{
gotoxy(36, 1);
cout<<con::fg_green<<"NIVELI 3";
gotoxy(60, 5);
cout<<con::fg_cyan<<"°";
gotoxy(51, 7);
cout<<"°";
gotoxy(52, 7);
cout<<"°";
gotoxy(43, 14);
cout<<"°";
gotoxy(45, 7);
cout<<"°";
gotoxy(19, 7);
cout<<"°";
gotoxy(36, 6);
cout<<"°";
gotoxy(41, 8);
cout<<"°";
gotoxy(24, 16);
cout<<con::fg_red<<"°";
gotoxy(31, 18);
cout<<con::fg_red<<"°";
gotoxy(39, 5);
cout<<con::fg_red<<"°";
gotoxy(17, 8);
cout<<con::fg_red<<"°";
gotoxy(49, 5);
cout<<con::fg_cyan<<"°";
gotoxy(20, 9);
cout<<"°";
gotoxy(52, 10);
cout<<"°";
gotoxy(39, 7);
cout<<"°";
gotoxy(39, 6);
cout<<"°";
gotoxy(39, 4);
cout<<"°";
gotoxy(39, 8);
cout<<"°";
gotoxy(18, 8);
cout<<"°";
gotoxy(16, 8);
cout<<"°";
gotoxy(19, 8);
cout<<"°";
gotoxy(63, 12);
cout<<"°"<<con::fg_black;
}
void level4()
{
gotoxy(36, 1);
cout<<con::fg_green<<"NIVELI 4";
gotoxy(45, 8);
cout<<con::fg_cyan<<"°";
gotoxy(39, 10);
cout<<"°";
gotoxy(52, 7);
cout<<"°";
gotoxy(43, 14);
cout<<"°";
gotoxy(45, 8);
cout<<"°";
gotoxy(19, 11);
cout<<"°";
gotoxy(21, 8);
cout<<"°";
gotoxy(41, 8);
cout<<"°";
gotoxy(41, 5);
cout<<con::fg_red<<"°";
gotoxy(35, 13);
cout<<con::fg_red<<"°";
gotoxy(39, 8);
cout<<con::fg_red<<"°";
gotoxy(54, 14);
cout<<con::fg_red<<"°";
gotoxy(45, 14);
cout<<con::fg_cyan<<"°";
gotoxy(32, 13);
cout<<"°";
gotoxy(35, 4);
cout<<"°";
gotoxy(35, 5);
cout<<"°";
gotoxy(35, 6);
cout<<"°";
gotoxy(35, 7);
cout<<"°";
gotoxy(35, 8);
cout<<"°";
gotoxy(35, 9);
cout<<"°";
gotoxy(36, 9);
cout<<"°";
gotoxy(37, 9);
cout<<"°";
gotoxy(38, 9);
cout<<"°";
gotoxy(35, 10);
cout<<"°";
gotoxy(35, 11);
cout<<"°";
gotoxy(35, 12);
cout<<"°";
gotoxy(35, 14);
cout<<"°";
gotoxy(35, 15);
cout<<"°";
gotoxy(35, 16);
cout<<"°";
gotoxy(35, 17);
cout<<"°";
gotoxy(35, 18);
cout<<"°";
gotoxy(35, 19);
cout<<"°";
gotoxy(54, 6);
cout<<"°";
gotoxy(52, 12);
cout<<"°";
gotoxy(51, 13);
cout<<"°";
gotoxy(54, 9);
cout<<"°";
gotoxy(54, 8);
cout<<"°"<<con::fg_black;
}
void intro()
{
gotoxy(0, 5);
cout<<con::fg_green
<<" HH HH \n"
<<" HH HH uu uu nn nnn gggggg rr rr yy yy \n"
<<" HHHHHHH uu uu nnn nn gg gg rrr r yy yy \n"
<<" HH HH uu uu nn nn ggggggg rr yyyyyy \n"
<<" HH HH uuuu u nn nn gg rr yy \n"
<<" ggggg yyyyy \n"
<<" FFFFFFF \n"
<<" FF rr rr oooo gggggg \n"
<<" FFFF rrr r oo oo gg gg \n"
<<" FF rr oo oo ggggggg \n"
<<" FF rr oooo gg \n"
<<" ggggg \n"<<con::fg_black;
}
void gameover ()
{
gotoxy(0, 30);
cout<<con::fg_white
<<" GGGGG AAA MM MM EEEEEEE OOOOO VV VV EEEEEEE RRRRRR \n"
<<" GG AAAAA MMM MMM EE OO OO VV VV EE RR RR \n"
<<" GG GGG AA AA MM MM MM EEEEE OO OO VV VV EEEEE RRRRRR \n"
<<" GG GG AAAAAAA MM MM EE OO OO VV VV EE RR RR \n"
<<" GGGGGG AA AA MM MM EEEEEEE OOOO0 VVV EEEEEEE RR RR \n"<<con::fg_black;
}
void level1done()
{
gotoxy(0, 30);
cout<<con::fg_white
<<" LL EEEEEEE VV VV EEEEEEE LL 1 \n"
<<" LL EE VV VV EE LL 111 \n"
<<" LL EEEEE VV VV EEEEE LL 11 \n"
<<" LL EE VV VV EE LL 11\n"
<<" LLLLLLL EEEEEEE VVV EEEEEEE LLLLLLL 111\n"
<<" \n"
<<" DDDDD OOOOO NN NN EEEEEEE !!!\n"
<<" DD DD OO OO NNN NN EE !!!\n"
<<" DD DD OO OO NN N NN EEEEE !!! \n"
<<" DD DD OO OO NN NNN EE \n"
<<" DDDDDD OOOO0 NN NN EEEEEEE !!!\n"<<con::fg_black;
}
void level2done()
{
gotoxy(0, 30);
cout<<con::fg_white
<<" LL EEEEEEE VV VV EEEEEEE LL 2222 \n"
<<" LL EE VV VV EE LL 22 22 \n"
<<" LL EEEEE VV VV EEEEE LL 22 \n"
<<" LL EE VV VV EE LL 2222 \n"
<<" LLLLLLL EEEEEEE VVV EEEEEEE LLLLLLL 2222222 \n"
<<" \n"
<<" DDDDD OOOOO NN NN EEEEEEE !!!\n"
<<" DD DD OO OO NNN NN EE !!!\n"
<<" DD DD OO OO NN N NN EEEEE !!! \n"
<<" DD DD OO OO NN NNN EE \n"
<<" DDDDDD OOOO0 NN NN EEEEEEE !!!\n";
}
void level3done()
{
gotoxy(0, 30);
cout<<con::fg_white
<<" LL EEEEEEE VV VV EEEEEEE LL 333333 \n"
<<" LL EE VV VV EE LL 3333 \n"
<<" LL EEEEE VV VV EEEEE LL 3333 \n"
<<" LL EE VV VV EE LL 333 \n"
<<" LLLLLLL EEEEEEE VVV EEEEEEE LLLLLLL 333333 \n"
<<" \n"
<<" DDDDD OOOOO NN NN EEEEEEE !!!\n"
<<" DD DD OO OO NNN NN EE !!!\n"
<<" DD DD OO OO NN N NN EEEEE !!! \n"
<<" DD DD OO OO NN NNN EE \n"
<<" DDDDDD OOOO0 NN NN EEEEEEE !!!\n"<<con::fg_black;
}
void level4done()
{
gotoxy(0, 30);
cout<<con::fg_white
<<" LL EEEEEEE VV VV EEEEEEE LL 44 \n"
<<" LL EE VV VV EE LL 444 \n"
<<" LL EEEEE VV VV EEEEE LL 444 4 \n"
<<" LL EE VV VV EE LL 44444444 \n"
<<" LLLLLLL EEEEEEE VVV EEEEEEE LLLLLLL 444 \n"
<<" \n"
<<" DDDDD OOOOO NN NN EEEEEEE !!!\n"
<<" DD DD OO OO NNN NN EE !!!\n"
<<" DD DD OO OO NN N NN EEEEE !!! \n"
<<" DD DD OO OO NN NNN EE \n"
<<" DDDDDD OOOO0 NN NN EEEEEEE !!!\n"<<con::fg_black;
}
void move(int *score, int *k, char *v)
{
char a='κ', z=' ';
int x=18, y=17;
char b;
int token=1,holdx,holdy;
int d=0, s=0, g=0, c=0;
while (b!='p')
{
if (kbhit())
b=getch();
holdx=x;
holdy=y;
if (y==20 || y==3 || x==15 || x==64)
{
gameover:
gameover();
cout<<endl<<" ";
system ("pause");
b=='p';
goto end;
}
if (b=='w')
{
y--;
token=1;
}
else if ( b=='s')
{
y++;
token=2;
}
else if ( b=='a')
{
x--;
token=3;
}
else if ( b=='d')
{
x++;
token=4;
}
else if (b=='m')
{
if (token==1)
y--;
else if (token==2)
y++;
else if (token==3)
x--;
else if (token==4)
x++;
}
if (b=='m' || b=='w' || b=='d' || b=='s' || b=='a')
{
gotoxy(x,y);
cout<<con::fg_green<<a<<con::fg_black;
b='m';
gotoxy(holdx,holdy);
cout<<z;
}
if (*v=='1')
{
if (x==45 && y==7 || x==35 && y==8 || x==41 && y==11 || x==60 && y==5 || x==45 && y==8 || x==31 && y==10 || x==35 && y==15 || x==21 && y==14 || x==17 && y==13 || x==16 && y==16 || x==45 && y==10 || x==49 && y==18 || x==39 && y==12 || x==63 && y==12)
goto gameover;
if (x==25 && y==4)
{
d=*k;
}
if (x==32 && y==7)
{
s=*k;
}
if (x==47 && y==10)
{
g=*k;
}
if (x==19 && y==19)
{
c=*k;
}
Sleep(100);
}
if (*v=='2')
{
if (x==51 && y==7 || x==60 && y==5 || x==52 && y==7 || x==43 && y==14 || x==45 && y==7 || x==21 && y==11 || x==18 && y==7 || x==13 && y==8 || x==63 && y==11 || x==49 && y==5 || x==37 && y==7 || x==52 && y==10 || x==35 && y==15 || x==21 && y==14 || x==17 && y==13 || x==16 && y==14 || x==45 && y==10 || x==49 && y==14 || x==39 && y==12 || x==63 && y==12)
goto gameover;
if (x==56 && y==4)
{
d=*k;
}
if (x==26 && y==7)
{
s=*k;
}
if (x==28 && y==10)
{
g=*k;
}
if (x==17 && y==19)
{
c=*k;
}
Sleep(80);
}
if (*v=='3')
{
if (x==60 && y==5 || x==51 && y==7 || x==52 && y==7 || x==43 && y==14 || x==45 && y==7 || x==19 && y==7 || x==36 && y==6 || x==41 && y==8 || x==49 && y==5 || x==20 && y==9 || x==52 && y==10 || x==39 && y==7 || x==39 && y==6 || x==39 && y==4 || x==39 && y==8 || x==18 && y==8 || x==16 && y==8 || x==19 && y==8 || x==63 && y==12)
goto gameover;
if (x==24 && y==16)
{
d=*k;
}
if (x==31 && y==18)
{
s=*k;
}
if (x==39 && y==5)
{
g=*k;
}
if (x==17 && y==8)
{
c=*k;
}
Sleep(75);
}
if (*v=='4')
{
if (x==45 && y==8 || x==39 && y==10 || x==52 && y==7 || x==43 && y==14 || x==45 && y==8 || x==19 && y==11 || x==21 && y==8 || x==41 && y==8 || x==45 && y==14 || x==32 && y==13 || x==35 && y==4 || x==35 && y==5 || x==35 && y==6 || x==35 && y==7 || x==35 && y==8 || x==35 && y==9 || x==36 && y==9 || x==37 && y==9 || x==38 && y==9 || x==35 && y==10 || x==35 && y==11 || x==35 && y==12 || x==35 && y==14 || x==35 && y==15 || x==35 && y==16 || x==35 && y==17|| x==35 && y==18 || x==35 && y==19 || x==54 && y==6 || x==52 && y==12 || x==51 && y==13 || x==54 && y==9 || x==54 && y==8 )
goto gameover;
if (x==41 && y==5)
{
d=*k;
}
if (x==35 && y==13)
{
s=*k;
}
if (x==39 && y==8)
{
g=*k;
}
if (x==54 && y==14)
{
c=*k;
}
Sleep(70);
}
*score=d+s+g+c;
if (*score==4)
{
level1done();
cout<<endl<<" ";
system ("pause");
b=='p';
goto end;
}
if (*score==12)
{
level2done();
cout<<endl<<" ";
system ("pause");
b=='p';
goto end;
}
if (*score==20)
{
level3done();
cout<<endl<<" ";
system ("pause");
b=='p';
goto end;
}
if (*score==28)
{
level4done();
cout<<endl<<" ";
system ("pause");
b=='p';
goto end;
}
}
end:;
}
void loading();
//////////////////////////////////////////////////////
///////////////////////////////////////////////////// INT MAIN
////////////////////////////////////////////////////
int main()
{
int sentinel;
int score=0;
int k=1;
char v;
fullscreen();
Sleep(1500);
loading();
system ("cls");
for (int loop=0;loop>-1;)
{
system ("cls");
intro();
cout<<con::fg_green<<"\n\n\n\n\n\n\n\n ΙΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ»\n"
<<" Ί1. STARTO LOJEN Ί\n"
<<" ΘΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΌ\n";
cout<<con::fg_yellow<<"\n\n\n\n ΙΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ»\n"
<<" Ί2. INSTRUKCIONE Ί\n"
<<" ΘΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΌ\n";
cout<<con::fg_red<<"\n\n\n\n ΙΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ»\n"
<<" Ί3. EXIT Ί\n"
<<" ΘΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΌ\n"<<con::fg_white;
cin>>sentinel;
if (sentinel==3)
goto exit;
if (sentinel==2)
////////////////////
cout<<"INSTRUCTIONS";
system("pause");
if (sentinel==1)
{
score=0;
k=1;
system ("cls");
v='1';
graphic();
level1();
move(&score, &k, &v);
system ("cls");
if (score==4)
{
v='2';
k=3;
graphic();
level2();
move(&score, &k, &v);
}
if (score==12)
{
system ("cls");
v='3';
k=5;
graphic();
level3();
move(&score, &k, &v);
}
if (score==20)
{
system ("cls");
v='4';
k=7;
graphic();
level4();
move(&score, &k, &v);
}
}
else
cout<<"WRONG KEY";
Sleep(100);
}
exit:
cout<<score;
system ("pause");
return 0;
}
void loading()
{
gotoxy(0,20);
cout<<" LOADING \n";
cout<<" ΙΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ»\n";
cout<<" Ί";
cout<<" Ί\n";
cout<<" ΘΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΌ\n";
int m=2;
for (int x=17; x<66; x++)
{
gotoxy(x,22); // permes gotoxy eshte mundesuar shkruarja ne katror
cout<<con::fg_yellow<<"ώ"<<con::fg_gray;
m+=2;
gotoxy(39,22);
cout<<con::fg_white<<m<<"%";
Sleep (20);
}
}