?? migrate_to_4x.html
字號:
<br> <br> <span style="font-style: italic; color: rgb(255, 0, 0);"> set_colors(CWHITE,CGRAYED);</span><br style="font-style: italic; color: rgb(255, 0, 0);"> <span style="font-style: italic; color: rgb(255, 0, 0);"> set_ppop(_GTRANSP);</span><br style="font-style: italic; color: rgb(255, 0, 0);"> <span style="font-style: italic; color: rgb(255, 0, 0);"> text_out(pp[0][0]/1000+XSTR, -pp[0][1]/1000+XSTR, name);</span><br style="font-style: italic; color: rgb(255, 0, 0);"> <span style="font-style: italic; color: rgb(255, 0, 0);"> set_ppop(_GSET);</span><br style="font-style: italic;"> <br style="font-style: italic;"> <span style="font-style: italic; font-weight: bold; color: rgb(51, 51, 255);"> text_out(pp[0][0]/1000+XSTR, -pp[0][1]/1000+XSTR,name,CWHITE,CGRAYED,_GTRANSP);</span><br style="font-style: italic;"> <br> <span style="font-style: italic;"><br> <span style="color: rgb(255, 0, 0);"> set_fcolor(color);</span></span><br style="font-style: italic; color: rgb(255, 0, 0);"> <span style="font-style: italic; color: rgb(255, 0, 0);"> draw_point(int(x/1000)+XSTR, int(-y/1000)+XSTR);</span><br style="font-style: italic; color: rgb(255, 0, 0);"> <br style="font-style: italic; font-weight: bold; color: rgb(51, 51, 255);"> <span style="font-style: italic; font-weight: bold; color: rgb(51, 51, 255);"> draw_point(int(x/1000)+XSTR, int(-y/1000)+XSTR, color, _GSET);</span><br style="font-style: italic;"> <br> <br> <span style="font-style: italic; color: rgb(255, 0, 0);"> set_fcolor(0);</span><br style="font-style: italic; color: rgb(255, 0, 0);"> <span style="font-style: italic; color: rgb(255, 0, 0);"> fill_box(0, 0, XMAX, XMAX);</span><br style="font-style: italic;"> <br style="font-style: italic;"> <span style="font-style: italic; font-weight: bold; color: rgb(51, 51, 255);"> fill_box(0, 0, XMAX, XMAX, 0, _GSET);</span><br style="font-style: italic;"> <br> <br> <span style="font-style: italic; color: rgb(255, 0, 0);"> set_colors(CWHITE,CBLACK);</span><br style="font-style: italic; color: rgb(255, 0, 0);"> <span style="font-style: italic; color: rgb(255, 0, 0);"> gprintf(100, 100, "Pocitam viditelnosti!!!");</span><br style="font-style: italic;"> <br style="font-style: italic; font-weight: bold; color: rgb(51, 51, 255);"> <span style="font-style: italic; font-weight: bold; color: rgb(51, 51, 255);"> gprintf(CWHITE, CBLACK, 100, 100, "Pocitam viditelnosti!!!");</span><br style="font-style: italic;"> </font></code><br> <font face="Arial"><code><span style="font-weight: bold;">3.implementation for DrawBuffer class and its successors<br> <br> </span><span style="font-style: italic; color: rgb(255, 0, 0);"> DrawBuffer *w;</span><br style="font-style: italic; color: rgb(255, 0, 0);"> <span style="font-style: italic; color: rgb(255, 0, 0);"> set_fcolor(bg);</span><br style="font-style: italic; color: rgb(255, 0, 0);"> <span style="font-style: italic; color: rgb(255, 0, 0);"> w->box(x, y, 30, 20);</span><br style="font-style: italic; color: rgb(255, 0, 0);"> <span style="font-style: italic; color: rgb(255, 0, 0);"> set_colors(HARD_BLACK, bg);</span><br style="font-style: italic; color: rgb(255, 0, 0);"> <span style="font-style: italic; color: rgb(255, 0, 0);"> w->text(x + 3, y + 3, s);</span><br style="font-style: italic; color: rgb(255, 0, 0);"> <br style="font-style: italic;"> <span style="font-style: italic; font-weight: bold; color: rgb(51, 51, 255);"> w->box(x, y, 30, 20, bg);</span><br style="font-style: italic; font-weight: bold; color: rgb(51, 51, 255);"> <span style="font-style: italic; font-weight: bold; color: rgb(51, 51, 255);"> w->text(x + 3, y + 3, s, HARD_BLACK, bg);</span><br style="font-style: italic;"> <br> <span style="font-style: italic; color: rgb(255, 0, 0);"> set_bcolor(CBLUE);</span><br style="font-style: italic; color: rgb(255, 0, 0);"> <span style="font-style: italic; color: rgb(255, 0, 0);"> w->WindowText(320, 150 + ss[j].sonda * 16, ss[j].nazov, CYELLOW);</span><br style="font-style: italic;"> <br style="font-style: italic;"> <span style="font-style: italic; font-weight: bold; color: rgb(51, 51, 255);"> w->WindowText(320, 150 + ss[j].sonda * 16, ss[j].nazov, CYELLOW,CBLUE);</span><br style="font-style: italic;"> <br> <span style="font-style: italic; color: rgb(255, 0, 0);"> set_font(1);</span><br style="font-style: italic; color: rgb(255, 0, 0);"> <span style="font-style: italic; color: rgb(255, 0, 0);"> set_colors(CREDLIGHT, CBLACK);</span><br style="font-style: italic; color: rgb(255, 0, 0);"> <span style="font-style: italic; color: rgb(255, 0, 0);"> set_ppop(_GTRANSP);</span><br style="font-style: italic; color: rgb(255, 0, 0);"> <span style="font-style: italic; color: rgb(255, 0, 0);"> rootwnd->WindowText(xoff-8, yoff, buf);</span><br style="font-style: italic;"> <br style="font-style: italic;"> <span style="font-style: italic; font-weight: bold; color: rgb(51, 51, 255);"> rootwnd->set_font(1);</span><br style="font-style: italic; font-weight: bold; color: rgb(51, 51, 255);"> <span style="font-style: italic; font-weight: bold; color: rgb(51, 51, 255);"> rootwnd->set_ppop(_GTRANSP);</span><br style="font-style: italic; font-weight: bold; color: rgb(51, 51, 255);"> <span style="font-style: italic; font-weight: bold; color: rgb(51, 51, 255);"> rootwnd->WindowText(xoff-8, yoff, buf, CREDLIGHT, CBLACK);</span><br style="font-style: italic;"> <br> </code></font></p> <h3><font face="Arial"><code>Appendix A: prototypes</code></font></h3> <pre>int get_point(int x, int y);<br>void draw_hline(int x, int y, int w, FGPixel ink, unsigned ppop);<br>void draw_box(int x, int y, int w, int h, FGPixel ink, unsigned ppop);<br>void fill_box(int x, int y, int w, int h, FGPixel ink, unsigned ppop);<br>void draw_point(int x, int y, FGPixel color, unsigned ppop);<br>int draw_line(int x, int y, int x1, int y1, FGPixel color, unsigned ppop);<br>int drawto_line(int x, int y, FGPixel ink, unsigned ppop);<br>void draw_pattern_line(int x, int y, int x1, int y1, Pattern *, unsigned ppop);<br>void drawto_pattern_line(int x, int y, Pattern *, unsigned ppop);<br>void draw_pattern_box(int x, int y, int a, int b, Pattern *pat, unsigned ppop);<br>void draw_spline(int points[8], FGPixel ink, unsigned ppop);<br>void calc_spline(int points[8], int npts, int *x, int *y);<br>void moveto(int x, int y);<br><br>void FGmemcpy(FGPixel * to, FGPixel * from, unsigned c);<br>void FGmemset(FGPixel * to, FGPixel data, unsigned c);<br>void FGmemcpy2(FGPixel * to, FGPixel * from, unsigned c, unsigned ppop);<br>void FGmemset2(FGPixel * to, FGPixel data, unsigned c, unsigned ppop);<br><br>void _set_default_palette(void);<br>void _set_fgl_palette(void);<br>unsigned int get_palette(unsigned int i);<br>void _palette(unsigned, unsigned int);<br><br>int text_out(int x, int y, char *text, FGPixel ink, FGPixel paper, unsigned ppop, int font=FONT0816);<br>int get_area_size(int x, int y);<br>void fill_convex(int c, int a[][2], FGPixel ink, unsigned ppop);<br>void draw_convex(int c, int a[][2], FGPixel ink, unsigned ppop);<br>void get_block(int x, int y, int a, int b, FGPixel * p);<br>void put_block(int x, int y, int a, int b, FGPixel * p, unsigned ppop);<br>void set_clip_rect(int w, int h, int x, int y);<br><br>void fill_ellipse(int x, int y, int rx, int ry, FGPixel ink, unsigned ppop);<br>void draw_ellipse(int x, int y, int rx, int ry, FGPixel ink, unsigned ppop);<br>void draw_arc(int x, int y, double ang1, double ang2, int r, FGPixel ink, unsigned ppop);<br>extern void draw_circle(int x, int y, int r, FGPixel ink, unsigned ppop);<br>extern void fill_circle(int xs, int ys, int r, FGPixel ink, unsigned ppop);<br><br>extern void RamToVideo(FGPixel * Image, int x, int y, int xm, int ym, int w, int h, int cx_max, int cy_max, int opcia, unsigned ppop);<br>extern void VideoToRam(FGPixel * Image, int x, int y, int xm, int ym, int w, int h, int cx_max, int cy_max);<br>extern void RamToRam(int x, int y, int xmax, int ymax, int xdst, int ydst, int xmaxdst, int ymaxdst, int w, int h, FGPixel * from, FGPixel * to, int alpha, int ppop);<br>int gprintf(FGPixel ink, FGPixel paper, int x, int y, const char *format,...);<br><br>int get_key(void);<br>int get_colordepth(void);<br>void set_transpcolor(FGPixel);<br><br>class DrawBuffer : public FGConnector<br>{<br> friend class GLSurface;<br> friend class _listbox;<br> private:<br> static int ID_counter;<br> int id;<br> FGMutex atomic;<br> inline void lock(void)<br> {<br> atomic.Lock();<br> }<br> inline void unlock(void)<br> {<br> atomic.Unlock();<br> }<br> public:<br> enum Type { WINDOW=0x4000, CHECKBUTTON, PUSHBUTTON, POINTBUTTON, EDITBOX, PROGRESSBAR,<br> BASEMENU, BASEMENUITEM, MENUWINDOW, SLIDEBAR, MULTILINEEDIT, LISTBOX, LABEL,<br> BMP_FILE, BMP_IMAGE, BMP_MEM, ROOTWINDOW, FGFRAMEBUFFER, COMBOBOX,<br> BMP_NONE=0 };<br> void Assign(int a, int b, void *c);<br> // modify pixel data<br> protected:<br> int w,h;<br> int xoff,yoff; // coor<br> int wwrk,hwrk; // sizes<br> unsigned long status;<br> FGPixel *image;<br> char *name;<br> int colorkey;<br> union { Type type; int _asd; };<br> FGPixel ink, paper;<br> FGPixel _ink, _paper;<br> int _font; // kod fontu<br> unsigned _ppop;<br> unsigned char alpha;<br><br> static const char *empty_string;<br> static int oldx, oldy;<br><br> FGPixel * SetArray(FGPixel *array) { return image = array; }<br><br> DrawBuffer(int ww, int hh, char * nm, Type t, FGPixel i, FGPixel p);<br> void modify_point(FGPixel *ptr, FGPixel ink);<br> void __line(int,int,int,int, FGPixel color);<br> void _init(int ww, int hh, Type t, FGPixel ii=CBLACK, FGPixel pp=CWHITE, char *nm=0);<br> void _symetry(int xs, int ys, int x, int y, FGPixel color);<br> void _symetry2(int xs, int ys, int x, int y, FGPixel color);<br> public:<br> inline FGPixel * CalcAddr(int x, int y)<br> {<br> return image + (w * y + x);<br> }<br> inline void set_font(int f)<br> {<br> // try get font image, and save requested font ID if success<br> if (FGFontManager::get_font_ptr(f))<br> _font = f;<br> }<br> inline int get_font(void)<br> {<br> return _font;;<br> }<br> inline int textwidth(char *txt)<br> {<br> return FGFontManager::textwidth(_font, txt);<br> }<br> inline int _textwidth(char *txt, int cnt)<br> {<br> return FGFontManager::_textwidth(_font, txt, cnt);<br> }<br> inline int charwidth(int c)<br> {<br> return FGFontManager::charwidth(_font, c);<br> }<br> inline int GetFontW(void)<br> {<br> return FGFontManager::GetW(_font);<br> }<br> inline int GetFontH(void)<br> {<br> return FGFontManager::GetH(_font);<br> }<br> inline int set_ppop(unsigned op)<br> {<br> int oldp = _ppop;<br> _ppop = op;<br> return oldp;<br> }<br> inline void set_fcolor(FGPixel val) { _ink = val; }<br> inline void set_bcolor(FGPixel val) { _paper = val; }<br> inline void set_colors(FGPixel i, FGPixel p) { _ink = i; _paper = p; }<br><br> int GetId(void) const { return id; }<br> static int GetCounter(void) { return ID_counter; }<br><br> // ww & hh are size!<br> inline int set_clip_rect(int xx, int yy, int ww, int hh)<br> {<br> if (hh<1 || ww<1 || xx<0 || yy<0) return 0;<br> xoff = xx;<br> yoff = yy;<br> if ((xx + ww) > w) ww -= ((xx + ww) - w);<br> if ((yy + hh) > h) hh -= ((yy + hh) - h);<br> wwrk = ww;<br> hwrk = hh;<br> return 1;<br> }<br> inline void get_clip_rect(int& x,int& y,int& w,int& h)<br> {<br> x = xoff;<br> y = yoff;<br> w = wwrk;<br> h = hwrk;<br> }<br> //<br> // clip coor and size to user space<br> //<br> inline int clip(int& xr, int& yr, int& wr, int& hr)<br> {<br> if (xr<xoff)<br> {<br> wr -= (xoff-xr);<br> xr = xoff;<br> }<br> if (yr<yoff)<br> {<br> hr -= (yoff-yr);<br> yr = yoff;<br> }<br> if (xr+wr > wwrk)<br> {<br> wr = wwrk-(xr-xoff);<br> }<br> int yoff2 = h - (hwrk+yoff);<br> if (yr+hr > h-yoff2)<br> {<br> hr = h-yr-yoff2;<br> }<br> return (wr<1 || hr<1) ? 0 : 1; // return if valid<br> }<br> inline int clip_shape(int& xr, int& yr, int& wr, int& hr)<br> {<br> if (xr<0)<br> {<br> wr += xr;<br> xr = 0;<br> }<br> if (yr<0)<br> {<br> hr += yr;<br> yr = 0;<br> }<br> if (xr+wr>w)<br> {<br> wr = w-xr;<br> }<br> if (yr+hr>h)<br> {<br> hr = h-yr;<br> }<br> return (wr<1 || hr<1) ? 0 : 1; // return if valid<br> }<br><br> DrawBuffer(int ww=0, int hh=0, Type=BMP_MEM, int color=CBLACK, FGPixel *buf=0);<br> DrawBuffer(int ww, int hh, FGPixel *buf);<br><br> virtual ~DrawBuffer();<br><br> // copy block from one buffer to other (with ppop or alpha)<br> // this is software blitter only<br> int bitblit(int xdst, int ydst, int xsrc, int ysrc, int ww, int hh, class DrawBuffer *src, int opcia=BITBLIT_COPY);<br><br> int hline(int x, int y, int size, FGPixel color);<br> int vline(int x, int y, int size, FGPixel color);<br> int line(int x, int y, int x2, int y2);<br> int line(int x, int y, int x2, int y2, FGPixel color);<br> int lineto(int x, int y);<br> int lineto(int x, int y, FGPixel color);<br> void moveto(int x, int y) { oldx = x; oldy = y; }<br> int pline(int x1, int y1, int x2, int y2, Pattern *p);<br> void spline(int points[8]);<br> void spline(int points[8], FGPixel color);<br><br> int rect(int xdst, int ydst, int ww, int hh);<br> int rect(int xdst, int ydst, int ww, int hh, FGPixel ink);<br> int box(int xdst, int ydst, int ww, int hh);<br> int box(int xdst, int ydst, int ww, int hh, FGPixel i);<br><br> int text(int x, int y, const char *txt);<br> int text(int x, int y, const char *txt, FGPixel i);<br> int text(int x, int y, const char *txt, FGPixel i, FGPixel p);<br> int printf(int , int , const char * , ... );<br> int putpixel(int x, int y);<br> int putpixel(int x, int y, FGPixel color);<br> int getpixel(int x, int y)<br> {<br> if (x<0 || y<0 || x>=wwrk || y>=hwrk)<br> return 0xFFFFFFFF;<br> return *(GetArray()+(x+xoff)+(y+yoff)*w);<br> }<br> void stretch(int _w, int _h);<br> void stretch(float ratiox, float ratioy);<br><br> int arc(int xs, int ys, double ang1, double ang2, int r);<br> int arc(int xs, int ys, double ang1, double ang2, int r, FGPixel color);<br> int ellipse(int x, int y, int rx, int ry);<br> int ellipse(int x, int y, int rx, int ry, FGPixel color);<br> int fellipse(int x, int y, int rx, int ry);<br> int fellipse(int x, int y, int rx, int ry, FGPixel color);<br> int circle(int xs, int ys, int r);<br> int circle(int xs, int ys, int r, FGPixel color);<br> int fcircle(int xs, int ys, int r);<br> int fcircle(int xs, int ys, int r, FGPixel color);<br> void polygon(int n, int pt[][2]);<br> void polygon(int n, int pt[][2], FGPixel color);<br> FGRect fpolygon(int n, int pt[][2]);<br> FGRect fpolygon(int n, int pt[][2], FGPixel color);<br> FGRect ftriangle(int x1, int y1, int x2, int y2, int x3, int y3);<br> FGRect ftriangle(int x1, int y1, int x2, int y2, int x3, int y3, FGPixel color);<br><br> FGPixel *GetArray(void) const { return image; }<br> int GetAlpha(void) const { return alpha; }<br> FGPixel GetInk(void) const { return (FGPixel)ink; }<br> FGPixel GetPaper(void) const { return (FGPixel)paper; }<br> long GetStatus(void) const { return status; }<br> int GetW(void) const { return w; }<br> int GetH(void) const { return h; }<br> int GetXW(void) const { return xoff; }<br> int GetYW(void) const { return yoff; }<br> int GetWW(void) const { return wwrk; }<br> int GetHW(void) const { return hwrk; }<br> int GetType(void) const { return type; }<br> int GetColorKey(void) const { return colorkey; }<br> char *GetName(void) const { return name; }<br> void SetStatus(long s) { status = s; }<br> void SetColors(void)<br> {<br> set_colors(ink, paper);<br> }<br> void SetColorKey(int ck)<br> {<br> colorkey = ck;<br> }<br> void SetName(char *s);<br> void SetAlpha(int a) { alpha = a; }<br> void Resize(int dx, int dy);<br> void clear(int c) { FGmemset(image, c, w*h); }</pre> <h3><font face="Arial"><code></code></font></h3> <pre>};<br><br></pre> <h3><font face="Arial"><code>Appendix B: <big>class App</big></code></font></h3> <small>class App<br>{<br> int mouseflag;<br> int mx, my, mb, oldx, oldy, oldb,drag, action;<br> int XX, YY;<br> <br> int mousefirst, resize, tmp_event,<br> resizex,resizey,<br> dragx, dragy,<br> clickx, clicky, clickw, clickh,<br> vyrez;<br> <br> Control *idcb;<br> Control *idc2;<br> Window *drag_okno;<br> static int repeat_status,repeat_delay1, repeat_delay2;<br> GuiEvent *hold_event;<br> <br> int RemoveMousePointer(void);<br> void ShowMousePointer(void);<br> void blue_rect(int x, int y, intw, int h);<br> void blue_rect2(int x, int y, intw, int h);<br> protected:<br> void AutoRepeatStart(Control *);<br> void AutoRepeatDo(void);<br> void DoubleClick(int& event);<br> <br> static GuiEventqueque[MAX_EVENT_QUEQUE];<br> static void(*DelayProc)(void);<br> static int quequeIndex;<br> static void(*OnEverySecond)(int);<br>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -