Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Graph_OUT //-------------------------------------------------------------------------------------------
- {
- int x, x2, // Коородината для TextOut
- y, y2, // Коородината для TextOut
- L, // Кол-во символом
- status;
- char *addr;
- static char *Last_addr;
- static int Last_Slovo;
- static int i;
- static char base[2048];
- static RECT rect;
- static int Chek(int, int, int);
- int add(char *buf) //----------------------------------------------- int X, int Y,const char *bufik, int F
- {
- L = strlen(buf);
- addr = Last_addr;
- Last_addr += L;
- memcpy(addr, buf, L);
- status = 1; // 1 - выводить на экран
- GetTextExtentPoint32(hdc, buf, lstrlen(buf), &sz); // ----------------- ---- Отобразить строку на экране
- x2 = x + sz.cx;
- y2 = y + sz.cy;
- Chek(x, y, x2);
- SetRect( &rect, x,
- y,
- x2, // ширина надписи в пикселях
- y2); // Высота строки
- InvalidateRect(hWnd, &rect, 1); //---------------------------------------------------------------------------
- Last_Slovo++;
- return 0;
- }
- } Slovo[150]; //-------------------------------------------------------------------------------------------
- int _Print(int x, int y,const char *bufik, int F)
- {
- char buf[170],
- bug[11];
- itoa(F, bug, 10);
- strcpy(buf, bufik);
- strcat(buf, bug); // ___________________________________________ Склеили всё в одну мтроку: "buf"
- int i = Graph_OUT::Last_Slovo;
- Slovo[i].x = x;
- Slovo[i].y = y;
- Slovo[i].add(buf);
- return 0;
- }
- //---------------------------------------------------------------------
- // Если новая строка перекрывает старую, то старую строку стираем
- //---------------------------------------------------------------------
- int Graph_OUT::Chek(int x, int y, int x2)
- {
- L_x1: int _L = 0; // в этой переменной будет накапливаться смещение адреса начала слов
- for(i = 0; i < Last_Slovo; i++)
- {
- if(Slovo[i].status == 1)
- {
- Slovo[i].addr -= _L;
- if(!_L)
- {
- if(abs(y - Slovo[i].y) < 13)
- {
- if(x >= Slovo[i].x && x <= Slovo[i].x2) goto L_01;
- if(x2 >= Slovo[i].x && x2 <= Slovo[i].x2)
- {
- L_01: Slovo[i].status = 5; // 5 - (ожидание) стереть надпись || (x >= Slovo[i].x && x <= Slovo[i].x2))
- SetRect( &rect, Slovo[i].x,
- Slovo[i].y,
- Slovo[i].x2, // ширина надписи в пикселях
- Slovo[i].y2); // Высота строки
- InvalidateRect(hWnd, &rect, 1);
- //---------------------------------------------------------------------------------------------
- _L += Slovo[i].L;
- memcpy(Slovo[i].addr, Slovo[i+1].addr, Last_addr - Slovo[i+1].addr);
- Last_addr -= Slovo[i].L;
- Slovo[Last_Slovo].addr -= Slovo[i].L;
- }
- }
- }
- }
- } if(_L) goto L_x1;
- }
- //-------------------------------------------------------------------------------------------
- int Graph_OUT::Last_Slovo = 0;
- int Graph_OUT:: i = 0;
- char Graph_OUT::base[2048];
- char *Graph_OUT::Last_addr = base;
- RECT Graph_OUT::rect;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement