Hello community, here is the log from the commit of package SDL_bgi for openSUSE:Factory checked in at 2015-10-19 22:54:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/SDL_bgi (Old) and /work/SRC/openSUSE:Factory/.SDL_bgi.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "SDL_bgi" Changes: -------- --- /work/SRC/openSUSE:Factory/SDL_bgi/SDL_bgi.changes 2015-06-08 08:30:54.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.SDL_bgi.new/SDL_bgi.changes 2015-10-20 00:09:16.000000000 +0200 @@ -1,0 +2,9 @@ +Mon Oct 12 16:52:07 UTC 2015 - jeng...@inai.de + +- Update to new upstream release 2.0.3 +* in "slow mode", screen refresh is also + triggered by kbhit() and getch() +* minimal dos.h and conio.h provided +* kbhit() rewritten to avoid buffered keys + +------------------------------------------------------------------- Old: ---- SDL_bgi-2.0.2.tar.gz New: ---- SDL_bgi-2.0.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ SDL_bgi.spec ++++++ --- /var/tmp/diff_new_pack.3VmpsM/_old 2015-10-20 00:09:17.000000000 +0200 +++ /var/tmp/diff_new_pack.3VmpsM/_new 2015-10-20 00:09:17.000000000 +0200 @@ -18,7 +18,7 @@ Name: SDL_bgi %define lname libSDL_bgi0 -Version: 2.0.2 +Version: 2.0.3 Release: 0 Summary: BGI-compatible 2D graphics C library with SDL backend License: Zlib and GPL-2.0+ @@ -75,7 +75,9 @@ %make_install b="%buildroot" rm -f "$b/%_libdir"/*.la -mkdir -p "$b/%_libdir/pkgconfig" +mkdir -p "$b/%_includedir/SDL_bgi" "$b/%_libdir/pkgconfig" +ln -s "../SDL2/SDL_bgi.h" "$b/%_includedir/SDL_bgi/graphics.h" +install -pm0644 src/test/dos.h src/test/conio.h "$b/%_includedir/SDL_bgi/" cat >"$b/%_libdir/pkgconfig/SDL_bgi.pc" <<-EOF Name: SDL_bgi Description: BGI-compatible API with SDL backend @@ -96,6 +98,7 @@ %defattr(-,root,root) %doc 00_README doc/* %_includedir/SDL2/ +%_includedir/SDL_bgi/ %_libdir/libSDL_bgi.so %_libdir/pkgconfig/SDL_bgi.pc ++++++ SDL_bgi-2.0.2.tar.gz -> SDL_bgi-2.0.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/00_README new/SDL_bgi-2.0.3/00_README --- old/SDL_bgi-2.0.2/00_README 2015-05-21 11:43:40.000000000 +0200 +++ new/SDL_bgi-2.0.3/00_README 2015-09-28 09:09:54.000000000 +0200 @@ -24,12 +24,12 @@ Links: -0. WinBGIm, a BGI Windows port: - http://www.cs.colorado.edu/~main/cs1300/doc/bgi/ - -1. The SDL library: +0. The SDL library: https://www.libsdl.org/ +1. WinBGIm, a BGI Windows port: + http://www.cs.colorado.edu/~main/cs1300/doc/bgi/ + 2. SDL_gfx, graphics drawing primitives and more: http://cms.ferzkopp.net/index.php/software/13-sdl-gfx diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/Changelog new/SDL_bgi-2.0.3/Changelog --- old/SDL_bgi-2.0.2/Changelog 2015-05-27 11:31:52.000000000 +0200 +++ new/SDL_bgi-2.0.3/Changelog 2015-09-28 09:08:18.000000000 +0200 @@ -1,9 +1,15 @@ Changelog --------- +v 2.0.3, 2015-09-28 +- in "slow mode", screen refresh is also + triggered by kbhit() and getch() +- minimal dos.h and conio.h provided +- kbhit() rewritten to avoid buffered keys + v 2.0.2, 2015-06-03 -- fill patterns (not for floodfill()) -- setfillpattern() / getfillpattern () implemented +- fill patterns (not for floodfill() yet) +- setfillpattern()/getfillpattern() implemented - writeimagefile() added - documentation updates - test programs updates @@ -11,12 +17,12 @@ v 2.0.1, 2015-05-11 - line patterns implemented - floodfill improvements -- readimagefile() added +- writeimagefile() added - documentation updates v. 2.0.0, 2015-04-30 - major release: rewritten to use SDL2 only -- added readimagefile () and logical plotting (XOR, etc.) +- added readimagefile() and logical plotting (XOR, etc.) v. 1.0.1, 2014-12-09 - Fixed minor bugs in putpixel() (reported by Angelo Graziosi) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/VERSION new/SDL_bgi-2.0.3/VERSION --- old/SDL_bgi-2.0.2/VERSION 2015-05-15 09:45:34.000000000 +0200 +++ new/SDL_bgi-2.0.3/VERSION 2015-08-18 14:56:37.000000000 +0200 @@ -1 +1 @@ -2.0.2 +2.0.3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/doc/.#sdl_bgi-quickref.tex new/SDL_bgi-2.0.3/doc/.#sdl_bgi-quickref.tex --- old/SDL_bgi-2.0.2/doc/.#sdl_bgi-quickref.tex 1970-01-01 01:00:00.000000000 +0100 +++ new/SDL_bgi-2.0.3/doc/.#sdl_bgi-quickref.tex 2015-10-20 00:09:17.000000000 +0200 @@ -0,0 +1 @@ +symbolic link to guido@geo.6880 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/doc/functions.txt new/SDL_bgi-2.0.3/doc/functions.txt --- old/SDL_bgi-2.0.2/doc/functions.txt 2015-05-25 11:30:17.000000000 +0200 +++ new/SDL_bgi-2.0.3/doc/functions.txt 2015-09-28 09:05:27.000000000 +0200 @@ -1,7 +1,8 @@ SDL_bgi functions and macros ---------------------------- -This is a list of functions provided by SDL_bgi. +This is a list of functions and macros provided by SDL_bgi. + void arc (int x, int y, int stangle, int endangle, int radius); Files old/SDL_bgi-2.0.2/doc/sdl_bgi-quickref.pdf and new/SDL_bgi-2.0.3/doc/sdl_bgi-quickref.pdf differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/doc/sdl_bgi-quickref.tex new/SDL_bgi-2.0.3/doc/sdl_bgi-quickref.tex --- old/SDL_bgi-2.0.2/doc/sdl_bgi-quickref.tex 2015-05-28 10:39:29.000000000 +0200 +++ new/SDL_bgi-2.0.3/doc/sdl_bgi-quickref.tex 2015-09-22 10:15:09.000000000 +0200 @@ -1,6 +1,6 @@ % sdl_bgi-quickref.tex % -% Guido Gonzato, May 20, 2015 +% Guido Gonzato, September 22, 2015 \documentclass[a4paper,11pt]{article} \usepackage{graphicx} @@ -1101,7 +1101,8 @@ \V{} \func{delay} (\I{} \A{millisec}); \end{bgi} -Waits for \A{millisec} milliseconds. +Waits for \A{millisec} milliseconds. In ``slow mode'', a screen +refresh is performed. % ----- @@ -1109,7 +1110,8 @@ \I{} \func{getch} (\V{}); \end{bgi} -Waits for a key and returns its ASCII code. +Waits for a key and returns its ASCII code. In ``slow mode'', a screen +refresh is performed. % ----- @@ -1118,7 +1120,7 @@ \end{bgi} Returns 1 when a key is pressed, including Ctrl, Shift, Alt, and so -on. +on. In ``slow mode'', a screen refresh is performed. % ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/doc/using.txt new/SDL_bgi-2.0.3/doc/using.txt --- old/SDL_bgi-2.0.2/doc/using.txt 2015-05-27 11:36:38.000000000 +0200 +++ new/SDL_bgi-2.0.3/doc/using.txt 2015-09-28 08:59:02.000000000 +0200 @@ -24,8 +24,11 @@ $ sudo ln -s /usr/include/SDL2/SDL_bgi.h /usr/include/graphics.h which lets you leave old programs untouched - unless they also include -dos.h and conio.h, which you'll have to remove or replace. The -graphics.h link must be created manually, since other software +dos.h and conio.h, which you'll have to remove or replace. Very basic +dos.h and conio.h are provided in the src/test directory; they're good +enough to compile the original bgidemo.c (not provided!) unmodified. + +The graphics.h link must be created manually, since other software packages provide it (e.g. Allegro, wx, and others). Then, to compile a program: @@ -52,27 +55,31 @@ SDL_1152x900 1152x900 SDL_1280x1024 1280x1024 SDL_1366x768 1366x768 - SDL_FULLSCREEN full screen + SDL_FULLSCREEN fullscreen -You may want to use initwindow (int width, int height) instead. +You may want to use initwindow(int width, int height) instead. Screen update ------------- The only real difference between the original BGI and SDL_bgi is the -way the screen is refreshed. In BGI, every pixel drawn on screen was -immediately displayed. This was a terribly inefficient way of drawing -stuff: the screen should be refreshed only when the drawing is done. -For example, in SDL2 this action is performed by SDL_RenderPresent (). +way the screen is refreshed. In BGI, every graphics element drawn on +screen was immediately displayed. This was a terribly inefficient way +of drawing stuff: the screen should be refreshed only when the drawing +is done. For example, in SDL2 this action is performed by +SDL_RenderPresent(). -You can choose whether to open the graphics system using initgraph (), +You can choose whether to open the graphics system using initgraph(), which toggles BGI compatibility and forces a screen refresh after -every graphics command, or using initwindow () that leaves you in +every graphics command, or using initwindow() that leaves you in charge of refreshing the screen when needed, using the new function -refresh (). The second method is *much* faster and is preferable. +refresh(). The second method is *much* faster and is preferable. -Functions sdlbgifast (void) and sdlbgislow (void) are also available. +As a tradeoff between performance and speed, a screen refresh is also +performed by getch(), kbhit(), and delay(). Functions sdlbgifast(void) +and sdlbgislow(void) are also available. They trigger fast and slow +mode, respectively. Documentation and sample BGI programs are available at this address: http://www.cs.colorado.edu/~main/cs1300/doc/bgi/ @@ -82,7 +89,7 @@ Differences ----------- -- The following functions are not implemented: +- The following functions may be called but do nothing: _graphfreemem - unneeded _graphgetmem - unneeded @@ -92,23 +99,23 @@ registerbgifont - it makes no sense in SDL setgraphbufsize - unneeded -- floodfill () only uses SOLID_FILL. Fill patterns are used by bar (), -bar3d (), and filledellipse (). +- floodfill() only uses SOLID_FILL. Fill patterns are used by bar(), +bar3d(), and filledellipse(), though. -- setpalette () only affects future drawing. That is, you can't get a +- setpalette() only affects future drawing. That is, you can't get a "rotating palette animation" as in Turbo C. - an 8x8 bitmap font is included, and it's the only one font. Changes to other BGI fonts (e.g. TRIPLEX_FONT, and others) make no effect: consider using SDL_ttf! -- fillpoly () only works correctly when the polygon is convex, and it -only uses SOLID_FILL. +- fillpoly() only works correctly when the polygon is convex, and it +only uses SOLID_FILL since it uses floodfill(). -- kbhit () (provided by conio.h in Turbo C/Borland C++) returns 1 when +- kbhit() (provided by conio.h in Turbo C/Borland C++) returns 1 when any key is pressed, including Shift, Ctrl, etc. -- Key presses may not be detected during a delay (). +- Key presses may not be detected during a delay(). Additions @@ -119,7 +126,7 @@ WinBGIm). Further, the following variables (declared in SDL_bgi.h) are -accessible: +accessible to the programmer: SDL_Window *bgi_window; SDL_Renderer *bgi_renderer; @@ -127,79 +134,82 @@ and can be used by native SDL2 functions. -- void initwindow (int width, int height) lets you open a window +- void initwindow(int width, int height) lets you open a window specifying its size. -- void detectgraph (int *gd, int *gm) returns SDL, SDL_FULLSCREEN. +- void detectgraph(int *gd, int *gm) returns SDL, SDL_FULLSCREEN. -- void setrgbpalette (int color, int r, int g, int b) sets an +- void setrgbpalette(int color, int r, int g, int b) sets an additional palette containing RGB colours (up to MAXRGBCOLORS + 1). See example in test/mandelbrot.c. -- void setrgbcolor (int col) and void setbkrgbcolor (int col) are the +- void setrgbcolor(int col) and void setbkrgbcolor(int col) are the RGB equivalent of setcolor(int col) and setbkcolor(int col). 'col' is an allocated colour entry in the RGB palette. -- COLOR (int r, int g, int b) can be used as an argument whenever a -colour value is expected (e.g. setcolor (int col) and other -functions). It's an alternative to setrgbcolor (int col) and -setbkrgbcolor (int col). Allocating colours with setrgbpalette () and -using setrgbcolor () is much faster, though. +- COLOR(int r, int g, int b) can be used as an argument whenever a +colour value is expected (e.g. setcolor(int col) and other functions). +It's an alternative to setrgbcolor(int col) and setbkrgbcolor(int +col). Allocating colours with setrgbpalette() and using setrgbcolor() +is much faster, though. -- IS_BGI_COLOR (int c) and IS_RGB_COLOR (int c) return 1 if the current +- IS_BGI_COLOR(int c) and IS_RGB_COLOR(int c) return 1 if the current colour is standard BGI or RGB, respectively. -- RED_VALUE (int c), GREEN_VALUE (int c), and BLUE_VALUE (int c) return +- RED_VALUE(int c), GREEN_VALUE(int c), and BLUE_VALUE(int c) return the R, G, B component of an RGB colour. -- setalpha (int col, Uint8 alpha) sets the alpha component of colour +- setalpha(int col, Uint8 alpha) sets the alpha component of colour 'col'. -- void _putpixel (int x, int y) is equivalent to putpixel (int x, int +- void _putpixel(int x, int y) is equivalent to putpixel(int x, int y, int col), but uses the current drawing colour and the pixel is not refreshed in slow mode. -- random (range) is defined as macro: rand()%range +- random(range) is defined as macro: rand()%range -- int getch () waits for a key and returns its ASCII code. Special keys +- int getch() waits for a key and returns its ASCII code. Special keys are also reported; please see SDL_bgi.h. -- void delay (msec) waits for 'msec' milliseconds. - -- int mouseclick (void) returns the code of the mouse button that was -clicked, or 0 if none was clicked. Mouse buttons are defined in -SDL_bgi.h: +- void delay(msec) waits for 'msec' milliseconds. - WM_LBUTTONDOWN 1 - WM_MBUTTONDOWN 2 - WM_RBUTTONDOWN 3 +- int mouseclick(void) returns the code of the mouse button that was +clicked, or 0 if none was clicked. Mouse buttons and movement +constants are defined in SDL_bgi.h: + + WM_LBUTTONDOWN + WM_MBUTTONDOWN + WM_RBUTTONDOWN + WM_WHEELUP + WM_WHEELDOWN + WM_MOUSEMOVE -- int mousex (void) and int mousey (void) return the mouse coordinates +- int mousex(void) and int mousey(void) return the mouse coordinates of the last click. -- int ismouseclick (int kind) returns 1 if the 'kind' mouse button was +- int ismouseclick(int kind) returns 1 if the 'kind' mouse button was clicked. -- void getmouseclick (int kind, int *x, int *y) sets the x, y -coordinates of the last button click expected by ismouseclick (). +- void getmouseclick(int kind, int *x, int *y) sets the x, y +coordinates of the last button click expected by ismouseclick(). -- int getevent (void) waits for a keypress or mouse click, and returns +- int getevent(void) waits for a keypress or mouse click, and returns the code of the mouse button or key that was pressed. -- int event (void) is a non-blocking version of getevent (). +- int event(void) is a non-blocking version of getevent(). -- void readimagefile (char *filename, int x1, int y1, int x2, int y2) +- void readimagefile(char *filename, int x1, int y1, int x2, int y2) reads a .bmp file and displays it immediately (i.e. no refresh needed). -- sdlbgifast (void) triggers "fast mode" even if the graphics system -was opened with initgraph (). Calling refresh () is needed to display +- sdlbgifast(void) triggers "fast mode" even if the graphics system +was opened with initgraph(). Calling refresh() is needed to display graphics. - sdlbgislow (void) triggers "slow mode" even if the graphics system -was opened with initwindow (). Calling refresh () is not needed. +was opened with initwindow(). Calling refresh() is not needed. -- void writeimagefile (char *filename, int left, int top, int right, +- void writeimagefile(char *filename, int left, int top, int right, int bottom) writes a .bmp file from the screen rectangle defined by (left,top--right,bottom). @@ -207,11 +217,14 @@ Bugs & Issues ------------- -Drawing in BGI compatibility mode is much slower than it should, since -SDL_UpdateTexture () doesn't work as expected (bug?). +Drawing in BGI compatibility (slow) mode is much slower than it +should, since SDL_UpdateTexture() doesn't work as expected (bug?). Colours don't have the same RGB values as the original BGI colours. But they look better (IMHO). +Some NVIDIA cards (my GeForce 9300 GE, for instance) along with their +nvidia-* binary driver may work strangely and cause memory leaks. + Probably, this documentation is not 100% accurate. Your feedback is more than welcome. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/sdl_bgi.spec new/SDL_bgi-2.0.3/sdl_bgi.spec --- old/SDL_bgi-2.0.2/sdl_bgi.spec 2015-05-21 11:47:14.000000000 +0200 +++ new/SDL_bgi-2.0.3/sdl_bgi.spec 2015-09-28 09:14:09.000000000 +0200 @@ -1,6 +1,6 @@ Summary: BGI-compatible 2D graphics C library Name: SDL_bgi -Version: 2.0.2 +Version: 2.0.3 Release: 1 License: ZLib Group: Libraries @@ -10,12 +10,13 @@ Prefix: %{_prefix} BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot -%description +%description This package contains a Borland Graphics Interface (BGI) emulation library based on SDL2. This library strictly emulates most BGI functions, making it possible to compile SDL versions of programs written for Turbo/Borland C. ARGB extensions and basic mouse support -are also implemented. +are also implemented; further, native SDL2 functions may be used in +SDL_bgi programs. %prep %setup -q -n %{name}-%{version} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/src/SDL_bgi.c new/SDL_bgi-2.0.3/src/SDL_bgi.c --- old/SDL_bgi-2.0.2/src/SDL_bgi.c 2015-05-28 10:34:23.000000000 +0200 +++ new/SDL_bgi-2.0.3/src/SDL_bgi.c 2015-09-28 07:51:41.000000000 +0200 @@ -2,7 +2,7 @@ // A BGI (Borland Graphics Library) implementation based on SDL2. // Easy to use, and useful for porting old programs. -// Guido Gonzato PhD, May 2015. +// Guido Gonzato PhD, September 2015. #include <math.h> #include "SDL_bgi.h" @@ -217,10 +217,10 @@ bgi_last_arc.yend = y - (radius * sin (endangle * PI_CONV)); for (angle = stangle; angle < endangle; angle++) - line_fast (x + (radius * cos (angle * PI_CONV)), - y - (radius * sin (angle * PI_CONV)), - x + (radius * cos ((angle+1) * PI_CONV)), - y - (radius * sin ((angle+1) * PI_CONV))); + line_fast (x + floor (0.5 + (radius * cos (angle * PI_CONV))), + y - floor (0.5 + (radius * sin (angle * PI_CONV))), + x + floor (0.5 + (radius * cos ((angle+1) * PI_CONV))), + y - floor (0.5 + (radius * sin ((angle+1) * PI_CONV)))); if (! bgi_fast_mode) refresh (); @@ -412,6 +412,8 @@ void delay (int msec) { + if (! bgi_fast_mode) + refresh (); SDL_Delay (msec); } // delay () @@ -805,6 +807,9 @@ { SDL_Event event; + if (! bgi_fast_mode) + refresh (); + if (window_is_hidden) return getchar (); else @@ -1312,7 +1317,8 @@ return; } - bgi_renderer = SDL_CreateRenderer (bgi_window, -1, SDL_RENDERER_SOFTWARE); + bgi_renderer = SDL_CreateRenderer (bgi_window, -1, + SDL_RENDERER_SOFTWARE); bgi_texture = SDL_CreateTexture (bgi_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, @@ -1349,20 +1355,21 @@ int kbhit (void) { - const Uint8 *keys; - int i, n, pressed; - - SDL_PumpEvents (); - keys = SDL_GetKeyboardState (&n); - pressed = NOPE; + SDL_Event event; - for (i = 0; i < n; i++) - if (keys[i]) - pressed = YEAH; + if (! bgi_fast_mode) + refresh (); - return (pressed); - -} // kbhit () + if (SDL_PollEvent (&event)) { + if (event.type == SDL_KEYDOWN) { + // last_key = event.key.keysym.sym; + return YEAH; + } + else + SDL_PushEvent (&event); // don't disrupt the mouse + } + return NOPE; +} // ----- @@ -2342,6 +2349,7 @@ SDL_SetTextureBlendMode (bgi_texture, SDL_BLENDMODE_BLEND); SDL_RenderCopy (bgi_renderer, bgi_texture, NULL, NULL); SDL_RenderPresent (bgi_renderer); + //SDL_UpdateWindowSurface (bgi_window); } // refresh () // ----- @@ -2693,27 +2701,25 @@ void updaterect (int x1, int y1, int x2, int y2) { - SDL_Rect rect, rect2; + SDL_Rect rect1, rect2; + int pitch = (bgi_maxx + 1) * sizeof (Uint32); swap_if_greater (&x1, &x2); swap_if_greater (&y1, &y2); - rect.x = x1; - rect.y = y1; - rect.w = x2 - x1 + 1; - rect.h = y2 - y1 + 1; + rect1.x = x1; + rect1.y = y1; + rect1.w = x2 - x1 + 1; + rect1.h = y2 - y1 + 1; // this works: but is THIS the expected behaviour? rect2.x = 0; rect2.y = 0; rect2.w = x2 + 1; rect2.h = y2 + 1; - - SDL_UpdateTexture (bgi_texture, - &rect2, - bgi_activepage, - (bgi_maxx + 1) * sizeof (Uint32)); - SDL_RenderCopy (bgi_renderer, bgi_texture, &rect, &rect); + + SDL_UpdateTexture (bgi_texture, &rect2, bgi_activepage, pitch); + SDL_RenderCopy (bgi_renderer, bgi_texture, &rect1, &rect1); SDL_RenderPresent (bgi_renderer); } // updaterect () @@ -2735,11 +2741,22 @@ // create a surface from the existing window src = SDL_GetWindowSurface (bgi_window); + if (NULL == src) { + SDL_Log("SDL_GetWindowSurface failed: %s", SDL_GetError()); + return; + } + // create a destination surface dest = SDL_CreateRGBSurface (0, rect.w, rect.h, 32, 0, 0, 0, 0); + + if (NULL == dest) { + SDL_Log("SDL_CreateRGBSurface: %s", SDL_GetError()); + return; + } // blit and save SDL_BlitSurface (src, &rect, dest, NULL); SDL_SaveBMP (dest, filename); + // free the stuff SDL_FreeSurface (src); SDL_FreeSurface (dest); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/src/SDL_bgi.h new/SDL_bgi-2.0.3/src/SDL_bgi.h --- old/SDL_bgi-2.0.2/src/SDL_bgi.h 2015-05-28 10:06:49.000000000 +0200 +++ new/SDL_bgi-2.0.3/src/SDL_bgi.h 2015-09-22 10:18:00.000000000 +0200 @@ -2,11 +2,11 @@ // A BGI-like graphics library based on SDL2. // Easy to use and useful for porting old programs. -// Guido Gonzato PhD, May 2015. +// Guido Gonzato PhD, September 2015. #include <SDL2/SDL.h> -#define SDL_BGI_VERSION 2.0.1 +#define SDL_BGI_VERSION 2.0.3 #define NOPE 0 #define YEAH 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/src/description-pak new/SDL_bgi-2.0.3/src/description-pak --- old/SDL_bgi-2.0.2/src/description-pak 1970-01-01 01:00:00.000000000 +0100 +++ new/SDL_bgi-2.0.3/src/description-pak 2015-09-22 14:41:37.000000000 +0200 @@ -0,0 +1 @@ +Package created with checkinstall 1.6.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/src/test/Makefile new/SDL_bgi-2.0.3/src/test/Makefile --- old/SDL_bgi-2.0.2/src/test/Makefile 2015-05-25 11:19:10.000000000 +0200 +++ new/SDL_bgi-2.0.3/src/test/Makefile 2015-09-28 07:53:31.000000000 +0200 @@ -1,17 +1,20 @@ # Makefile for test SDL_bgi programs - -SDL2_bgi = ../libSDL_bgi.so +# Please note that f90_test.f90 is not included # C compiler: gcc or clang CC = gcc CFLAGS = -std=c99 -O2 -g -I.. -L.. LIBS = -lSDL2 +SDL2_bgi = ../libSDL_bgi.so PROGRAMS = cellular dla fern floodfilltest hopalong life \ -mandelbrot mousetest moveit sdlbgidemo simple turtledemo +mandelbrot mousetest moveit sdlbgidemo simple turtledemo pixels all: $(PROGRAMS) +../libSDL_bgi.so: + cd ..; make + sdlbgidemo: sdlbgidemo.c $(SDL2_bgi) $(CC) $(CFLAGS) -I. -o sdlbgidemo sdlbgidemo.c $(SDL2_bgi) $(LIBS) -lm @@ -45,6 +48,9 @@ simple: simple.c $(SDL2_bgi) $(CC) $(CFLAGS) -o simple simple.c $(SDL2_bgi) $(LIBS) +pixels: pixels.c $(SDL2_bgi) + $(CC) $(CFLAGS) -o pixels pixels.c $(SDL2_bgi) $(LIBS) + turtledemo: turtledemo.c turtle.c $(SDL2_bgi) $(CC) $(CFLAGS) -o turtledemo turtledemo.c turtle.c $(SDL2_bgi) $(LIBS) -lm diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/src/test/conio.h new/SDL_bgi-2.0.3/src/test/conio.h --- old/SDL_bgi-2.0.2/src/test/conio.h 1970-01-01 01:00:00.000000000 +0100 +++ new/SDL_bgi-2.0.3/src/test/conio.h 2015-09-22 11:23:23.000000000 +0200 @@ -0,0 +1,3 @@ +// dummmy conio.h for bgidemo.c + +// empty! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/src/test/dos.h new/SDL_bgi-2.0.3/src/test/dos.h --- old/SDL_bgi-2.0.2/src/test/dos.h 1970-01-01 01:00:00.000000000 +0100 +++ new/SDL_bgi-2.0.3/src/test/dos.h 2015-09-22 11:23:19.000000000 +0200 @@ -0,0 +1,57 @@ +// dummy dos.h for bgidemo.c + +#define far + +// provide missing declaration + +void RandomBars(void); + +// ADDED: +int itoa (int val, char* buf, int ignore_me) +{ + const unsigned int radix = 10; + + char* p; + unsigned int a; //every digit + int len; + char* b; //start of the digit char + char temp; + unsigned int u; + + p = buf; + + if (val < 0) + { + *p++ = '-'; + val = 0 - val; + } + u = (unsigned int)val; + + b = p; + + do + { + a = u % radix; + u /= radix; + + *p++ = a + '0'; + + } while (u > 0); + + len = (int)(p - buf); + + *p-- = 0; + + //swap + do + { + temp = *p; + *p = *b; + *b = temp; + --p; + ++b; + + } while (b < p); + + return len; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/src/test/fern.c new/SDL_bgi-2.0.3/src/test/fern.c --- old/SDL_bgi-2.0.2/src/test/fern.c 2015-05-06 17:50:32.000000000 +0200 +++ new/SDL_bgi-2.0.3/src/test/fern.c 2015-06-24 09:53:04.000000000 +0200 @@ -87,7 +87,7 @@ if (kbhit ()) stop = 1; } - if (10000000 == counter) + if (10000000 == counter) // 10 millions break; } setcolor (GREEN); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/src/test/pixels.c new/SDL_bgi-2.0.3/src/test/pixels.c --- old/SDL_bgi-2.0.2/src/test/pixels.c 1970-01-01 01:00:00.000000000 +0100 +++ new/SDL_bgi-2.0.3/src/test/pixels.c 2015-08-21 13:12:27.000000000 +0200 @@ -0,0 +1,48 @@ +/* simple.c -*- C -*- + * + * To compile: + * gcc -o simple simple.c SDL_bgi.c -lSDL -lSDL_gfx -lm + * + * By Guido Gonzato, March 2013. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <graphics.h> + +/* ----- */ + +int main () +{ + + int i, x; + + initwindow (800, 600); + sdlbgislow (); + + setbkcolor (BLUE); + cleardevice (); + for (i = 0; i < 1000; i++) + putpixel (random (800), random (600), YELLOW); + + refresh (); + delay (2000); + closegraph (); + return 0; + +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/src/test/plasma.c new/SDL_bgi-2.0.3/src/test/plasma.c --- old/SDL_bgi-2.0.2/src/test/plasma.c 1970-01-01 01:00:00.000000000 +0100 +++ new/SDL_bgi-2.0.3/src/test/plasma.c 2015-09-28 07:52:49.000000000 +0200 @@ -0,0 +1,61 @@ +// plasma.c +// used to produce the plasma.bmp file +// gcc plasma.c -lSDL_bgi -lSDL2 -lm + +#include <math.h> +#include <graphics.h> + +#define PI 3.141593 + +int main (void) +{ + + int i, x, y, r, g, b; + int cols[3][255]; + double c; + + initwindow (600, 600); + + for (i = 0; i < 255; i++) { + + cols[0][i] = (int) fabs( (128.0 - 127.0 * sin ((double) i * PI / 32.0))); + cols[1][i] = (int) fabs( (128. - 127. * sin((double) i * PI / 64.))); + cols[2][i] = (int) fabs( (128. - 127. * sin((double) i * PI / 128.))); + + } + + for (y = 0; y < getmaxy (); y++) { + for (x = 0; x < getmaxx (); x++) { + c = (sin(x/35.)*128.+sin(y/28.)*32. + sin((x+y)/16.)*64.); + if (c > 255) + c = c - 256; + if (c < 0) + c = 256 + c; + r = cols[0][(int)c]; + if (r > 255) + r = r - 256; + if (r < 0) + r = 256 + c; + g = cols[1][(int)c]; + if (g > 255) + g = g - 256; + if (g < 0) + g = 256 + c; + b = cols[2][(int)c]; + if (b > 255) + b = b - 256; + if (b < 0) + b = 256 + c; + setcolor (COLOR(r, g, b)); + _putpixel(x, y); + } + } + refresh (); + writeimagefile ("plasma.bmp", 0, 0, 599, 599); + getch (); + closegraph (); + return 0; + +} + +// end of file plasma.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SDL_bgi-2.0.2/src/test/sdlbgidemo.c new/SDL_bgi-2.0.3/src/test/sdlbgidemo.c --- old/SDL_bgi-2.0.2/src/test/sdlbgidemo.c 2015-05-21 11:40:03.000000000 +0200 +++ new/SDL_bgi-2.0.3/src/test/sdlbgidemo.c 2015-09-22 12:15:22.000000000 +0200 @@ -1008,8 +1008,11 @@ getviewsettings (&viewport); xm = (viewport.right - viewport.left) / 2; ym = (viewport.bottom - viewport.top ) / 2; - settextstyle (DEFAULT_FONT, HORIZ_DIR, 2); + settextstyle (DEFAULT_FONT, HORIZ_DIR, 6); settextjustify (CENTER_TEXT, CENTER_TEXT); + setcolor (GREEN); + outtextxy (xm, ym/2, "P A G E 0"); + settextstyle (DEFAULT_FONT, HORIZ_DIR, 2); setcolor (YELLOW); outtextxy (xm, ym, "This is active page (and visual page) #0"); @@ -1022,6 +1025,10 @@ setbkcolor (RED); clearviewport (); + setcolor (BLUE); + settextstyle (DEFAULT_FONT, HORIZ_DIR, 6); + outtextxy (xm, ym/2, "P A G E 1"); + settextstyle (DEFAULT_FONT, HORIZ_DIR, 2); outtextxy (xm, ym, "This is active page (and visual page) #1"); outtextxy (xm, ym + 30, "Press a key to go back to page #0"); refresh ();