Репозиторий компилятор gcc mingw, графика приметив
Добавлено: 27 мар 2024, 14:37
Если делаешь только то, что умеешь, то никогда не сможешь превзойти самого себя
https://s.hardprivate.com/
Код: Выделить всё
#include <iostream>
#include <graphics.h>
using namespace std;
void PrintText(int x, int y, int size, const char* text)
{
settexstyle(COMPLEX_FONT, HORIZ_DIR, size);
settextjustify(CENTER_TEXT, CENTER_TEXT);
setcolor(GREEN);
outtextxy(x, y, text);
}
int main()
{
initwindow(800,600, "Заголовок окна"); // размер окна 800х600
setlinestyle(SOLID_LINE, 0, 3); // линия контура
setcolor(BROWN); // коричневая линия контура
setfillstyle(SOLID_FILL, YELLOW); // заливка фигуры жёлтым
bar(100, 100, 300, 200); // Прямоугольник
fillellipse(200, 200,50, 50); // Эллипс
cout << "OK" << endl;
char key = getch(); // ожидание нажатия клавиши
delay(1000); //ojidanie 1s
closegraph();
}
Обработка управления нажатия на клавиатуреswapbuffers(); // устранит мерцание обработки объекта в цикле
Код: Выделить всё
if(kbhit)
{
char key = getch();
if(key == 'a') {}
}
Код: Выделить всё
if(ismouseclick(тип_события))
{
// действие;
clearmouseclick(тип_события)
}
Код: Выделить всё
readimage("имя файла" , x, y. x+w, y+h)
Код: Выделить всё
#include <windows.h>
#include <mmsystem.h>
void Sound(const char *filename, bool loop=false)
{
DWORD flags = SND_ASYNC;
if(loop) flags |= SND_LOOP;
PlaySound(TEXT(filename), NULL, flags)
}
Код: Выделить всё
outtextxy(int x, int y, const char* text);
Код: Выделить всё
#include <time.h>
float TimeInSec()
{
float sec=(float)clock / CLOCKS_PER_SEC;
}
int main()
{
float start_time = 0;
game_time = TimeInSec() - start_time;
}
Код: Выделить всё
#include <stdio.h>
char str[20];
sprintf(str, "%f", sec);
Код: Выделить всё
-libgcc -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
Код: Выделить всё
-lbgi
-lgdi32
-lcomdlg32
-luuid
-loleaut32
-lole32