How to draw a character in a random place on the screen - C ++

Sorry for the dumb question, but is there a way to draw a character in a random place on the screen without using any “heavy” graphics libraries?

Thank you Li

+3
source share
4 answers

Try recording directly to video memory at B800: 0000 (see Bios memory card ).

+4
source
HDC hdc = GetDC(NULL);
RECT rc;
rc.left = 0;
rc.right = 100;
rc.top = 0;
rc.bottom = 100;
DrawText(hdc, L"Bla", 3, &rc, 0);

Am I helping a programmer for viruses here?

+3
source

, :

#include "windows.h"

void gotoxy(int x, int y) 
{ 
COORD coord; 
coord.X = x; coord.Y = y; 
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_H ANDLE), coord); 
}

void PaintcharOnRandomLocation(const char c)
{
srand(0);
int x = rand(79);
int y = rand(24);
gotoxy(x,y);
putch(c);
}
+1

, 1 2

0

Source: https://habr.com/ru/post/1761303/


All Articles