Skip to content

Commit

Permalink
v2.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JulStrat committed Nov 22, 2022
1 parent 759d7c9 commit 5514d7e
Show file tree
Hide file tree
Showing 79 changed files with 2,918 additions and 926 deletions.
9 changes: 4 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

cmake_minimum_required (VERSION 3.5.0)

set (SDL_BGI_VERSION 2.5.0)
set (SDL_BGI_VERSION 2.6.0)

# Project name
project (SDL_bgi VERSION ${SDL_BGI_VERSION} LANGUAGES C)
Expand All @@ -22,10 +22,10 @@ include_directories (SDL_bgi ${SDL2_INCLUDE_DIRS})
include (GNUInstallDirs)

# fix stupid bug on Linux
string (STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES)
# string (STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES)

# Find source files
file (GLOB SOURCES src/*.c)
file (GLOB SOURCES src/SDL_bgi.c)

# Include header files
include_directories (src)
Expand Down Expand Up @@ -61,8 +61,7 @@ file (GLOB man doc/graphics.3.gz)
install (FILES ${man} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)

# Install test programs
file (GLOB test test/*)
install (FILES ${test} DESTINATION ${CMAKE_INSTALL_DOCDIR}/test)
install (DIRECTORY test/ DESTINATION ${CMAKE_INSTALL_DOCDIR}/test)

# --- Packaging, thanks to cpack

Expand Down
30 changes: 29 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
Changelog
---------

v. 2.6.0, 2022-05-30

- Emscripten support: unmodified SDL_bgi programs can be compiled to
WebAssembly embedded in html pages
- added test/Makefile.emscripten, test/emcc.sh, doc/emscripten.md,
doc/emscripten.pdf
- added support for "environment files" (Emscripten replacement for
environment variables)
- added getclick(), doubleclick()
- extended mouseclick()
- update Windows Makefiles to SDL2-2.0.22

v. 2.5.1, 2022-02-28

- fixed bug in getch()
- added copysurface(), lastkey()
- added test/loadimage.c (demo for SDL2_image and copysurface());
added test/pdj.c (demo for lastkey())
- modified build.sh to to run on GNU/Linux only; renamed as mkpkg.sh
to avoid confusion
- added support for the tcc compiler (GNU/Linux only); added
test/tccrun
- modified CMakeList.txt
- documentation: added doc/howto_AppImage.md, doc/howto_AppImage.pdf,
doc/README.md; minor updates
- added doc/icon.png
- update Windows Makefiles to SDL2-2.0.20

v. 2.5.0, 2021-09-20
- fixed kbhit() bug on MSYS2 (at last!)
- fixed minor bug in setallpalette()
Expand Down Expand Up @@ -57,7 +85,7 @@ v. 2.4.1, 2020-08-08
- implemented a 16-colour palette that uses the same RGB values as
Turbo C. This palette is used if the environment variable
SDL_BGI_PALETTE is set to "BGI"
- extended 'setpalette()' to modify the default 16 colours too
- extended setpalette() to modify the default 16 colours too
(requested by Austin Hurst)
- added initpalette() to restore the original 16 colours in the
palette
Expand Down
48 changes: 48 additions & 0 deletions INSTALL_Emscripten.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# `SDL_bgi` and Emscripten

Unmodified `SDL_bgi` programs can be compiled to WebAssembly using the
[Emscripten](https://emscripten.org/) compiler `emcc`. The following
tools are used to produce standalone `html` files that can be run in
supported browsers:

- `src/Makefile` provides a `wasm` target, only available when the
`EMSDK` environment variable is defined;
- `test/emcc.sh` can be used to compile a program;
- `test/Makefile.emcc` compiles the sample programs.

Emscripten support was tested with `emcc` 3.1.8 and `clang'' 15.0.0 on
GNU/Linux Mint 20.2 and MSYS2 20220503.


## Installing Emscripten Support

Emscripten must be properly installed, and the `EMSDK` environment
variable must be defined; please consult the Emscripten [Download and
install](https://emscripten.org/docs/getting_started/downloads.html)
page.

To compile `SDL_bgi` and install Emscripten support:

```
$ cd src/
src/$ make wasm
*** Building on Linux ***
...
src/$ make clean
```

Files will be installed in appropriate directories:

````
graphics.h -> $EMSDK/upstream/emscripten/cache/sysroot/include
SDL_bgi.h -> $EMSDK/upstream/emscripten/cache/sysroot/include/SDL2
libSDL_bgi.a -> $EMSDK/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten
````

To uninstall:

````
$ cd src/
src/$ make unwasm
````

10 changes: 5 additions & 5 deletions INSTALL_Linux.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Installing `SDL_bgi` in GNU/Linux
# Installing `SDL_bgi` on GNU/Linux

The easiest way to install `SDL_bgi` is by using the binary packages
provided at <http://libxbgi.sourceforge.net/#download> in `.deb` and
provided at <http://sdl-bgi.sourceforge.io/#download> in `.deb` and
`.rpm` format.

Alternatively, you can easily compile `SDL_bgi` yourself, as shown below.
Expand All @@ -19,7 +19,7 @@ you'll also need `make` and a C compiler; `gcc` or `clang` are fine.

To compile and install `SDL_bgi`, run the following commands:

$ VERSION=2.5.0
$ VERSION=2.5.1
$ tar zxvf SDL_bgi-$VERSION.tar.gz
$ cd SDL_bgi-$VERSION/src
$ make
Expand All @@ -38,10 +38,10 @@ This only works if `cmake` and `cpack` are installed.

To compile the `SDL_bgi` library and make `.deb` or `.rpm` packages:

$ VERSION=2.5.0
$ VERSION=2.5.1
$ tar zxvf SDL_bgi-$VERSION.tar.gz
$ cd SDL_bgi-$VERSION
$ ./build.sh
$ ./mkpkg.sh

which creates a subdirectory called `build/`, moves to it, runs
`cmake`, then `cpack`. In a few seconds, in directory `build/` you
Expand Down
53 changes: 30 additions & 23 deletions INSTALL_Windows.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# Installing `SDL_bgi` in Windows
# Installing `SDL_bgi` on Windows

The easiest way to install `SDL_bgi` is by using the binary packages
provided at <http://libxbgi.sourceforge.net/#download>, for MSYS2 +
provided at <http://sdl-bgi.sourceforge.io/#download>, for MSYS2 +
mingw-w64, CodeBlocks, and Dev-C++. Alternatively, you can easily
compile `SDL_bgi` yourself, as shown below.

The following sections were tested with:

- msys2-x86_64-20200720.exe (**note:** previous releases may not work!)
- msys2-x86_64-20220128
- codeblocks-20.03mingw
- Dev-Cpp 5.11 + TDM-GCC 4.9.2
- SDL2-2.0.20

**Please note:** previous MSYS2 releases may not work!

## Installing the MSYS2 + Mingw-w64 Binaries

Let's assume you installed SDL2 as native package, that is
`mingw-w64-x86_64-SDL2`.
## Installing the MSYS2 + MINGW64 Binaries

Provided binaries were compiled on `msys2` and its native package
`mingw-w64-x86_64-SDL2` version 2.0.22-1.

Start the MSYS2 shell, unzip the `SDL_bgi` archive, then copy:

Expand All @@ -24,20 +27,21 @@ Start the MSYS2 shell, unzip the `SDL_bgi` archive, then copy:
bin/Mingw64/SDL_bgi.dll -> /mingw64/bin

Please note that to run a program compiled with `SDL_bgi` outside of
the MSYS2 environment (e.g. in an ordinary command prompt), you will need
to copy `SDL_bgi.dll` and `SDL2.dll` to the same directory as the program.
the MSYS2 environment (e.g. in an ordinary Windows command prompt),
you will need to copy `SDL_bgi.dll` and `SDL2.dll` to the same
directory as the program.


## Installing the Code::Blocks Binaries

Let's assume that you installed CodeBlocks in `C:\CodeBlocks` and SDL2
development libraries in in `C:\SDL2-2.0.16`. Change the following
development libraries in in `C:\SDL2-2.0.22`. Change the following
instructions as needed for your installation.

Unzip `SDL_bgi` archive, then copy:

src/graphics.h -> C:\CodeBlocks\MinGW\include
src/SDL_bgi.h -> C:\SDL2-2.0.16\i686-w64-mingw32\include\SDL2
src/SDL_bgi.h -> C:\SDL2-2.0.22\i686-w64-mingw32\include\SDL2
bin/CodeBlocks/SDL_bgi.dll -> C:\CodeBlocks\MinGW\bin

To learn how to compile programs, please see `howto_CodeBlocks.md`.
Expand All @@ -46,13 +50,13 @@ To learn how to compile programs, please see `howto_CodeBlocks.md`.
## Installing the Dev-C++ Binaries

Let's assume that you installed Dev-C++ in `C:\DevCpp` and SDL2
in `C:\SDL2-2.0.16`. Change the following instructions as needed for
in `C:\SDL2-2.0.22`. Change the following instructions as needed for
your installation.

Unzip `SDL_bgi` archive, then copy:

src/graphics.h -> C:\SDL2-2.0.16\i686-w64-mingw32\include
src/SDL_bgi.h -> C:\SDL2-2.0.16\i686-w64-mingw32\include\SDL2
src/graphics.h -> C:\SDL2-2.0.22\i686-w64-mingw32\include
src/SDL_bgi.h -> C:\SDL2-2.0.22\i686-w64-mingw32\include\SDL2
bin/DevCpp/SDL_bgi.dll -> C:\DevCpp\MinGW64\bin

To learn how to compile programs, please see `howto_DevCpp.md`.
Expand All @@ -63,6 +67,9 @@ To learn how to compile programs, please see `howto_DevCpp.md`.
Windows support is provided for MSYS2 + Mingw-w64 toolchain,
CodeBlocks, and Dev-C++. The MSYS2 shell is required.


## MSYS2 + Mingw-w64

Please make sure you have SDL2 development packages. You should
install `make`, `mingw-w64-x86_64-SDL2`, and `mingw-w64-x86_64-gcc`.
**Do not** install plain `gcc`. Also, make sure that directory
Expand All @@ -73,12 +80,12 @@ install `make`, `mingw-w64-x86_64-SDL2`, and `mingw-w64-x86_64-gcc`.
$ # expand the $PATH variable if necessary
$ echo export PATH=/mingw64/bin:$PATH >> $HOME/.bashrc


## MSYS2 + Mingw-w64
The procedure was tested on `msys2` and its native package
`mingw-w64-x86_64-SDL2` version 2.0.22-1.

Start the MSYS2 shell, then run the following commands:

$ VERSION=2.5.0
$ VERSION=2.5.1
$ tar zxvf SDL_bgi-$VERSION.tar.gz
$ cd SDL_bgi-$VERSION/src
$ make
Expand All @@ -99,17 +106,17 @@ To uninstall:

Start the MSYS2 shell, then run the following commands:

$ VERSION=2.5.0
$ VERSION=2.5.1
$ tar zxvf SDL_bgi-$VERSION.tar.gz
$ cd SDL_bgi-$VERSION/src
$ PATH=/c/CodeBlocks/MinGW/bin/:$PATH && make -f Makefile.CodeBlocks
$ make install

Assuming that you installed CodeBlocks in `C:\CodeBlocks` and SDL2
development libraries in in `C:\SDL2-2.0.16`, files will be installed
development libraries in in `C:\SDL2-2.0.22`, files will be installed
in these directories:

SDL_bgi_.h -> C:\SDL2-2.0.16\i686-w64-mingw32\include\SDL2
SDL_bgi_.h -> C:\SDL2-2.0.22\i686-w64-mingw32\include\SDL2
graphics.h -> C:\CodeBlocks\MinGW\include
SDL_bgi.dll -> C:\CodeBlocks\MinGW\bin

Expand All @@ -118,18 +125,18 @@ in these directories:

Start the MSYS2 shell, then run the following commands:

$ VERSION=2.5.0
$ VERSION=2.5.1
$ tar zxvf SDL_bgi-$VERSION.tar.gz
$ cd SDL_bgi-$VERSION/src
$ PATH=/c/CodeBlocks/MinGW/bin/:$PATH && make -f Makefile.DevCpp
$ make install

Assuming that you installed Dev-C++ in `C:\DevCpp` and SDL2
development libraries in in `C:\SDL2-2.0.16`, files will be installed
development libraries in in `C:\SDL2-2.0.22`, files will be installed
in these directories:

SDL_bgi_.h -> C:\SDL2-2.0.16\i686-w64-mingw32\include\SDL2
graphics.h -> C:\SDL2-2.0.16\i686-w64-mingw32\include
SDL_bgi_.h -> C:\SDL2-2.0.22\i686-w64-mingw32\include\SDL2
graphics.h -> C:\SDL2-2.0.22\i686-w64-mingw32\include
SDL_bgi.dll -> C:\DevCpp\MinGW64\bin


Expand Down
2 changes: 1 addition & 1 deletion INSTALL_macOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ You're now ready to compile `SDL_bgi`.
To compile and install `SDL_bgi`, start Terminal and run the following
commands:

% VERSION=2.5.0
% VERSION=2.5.1
% tar xvf SDL_bgi-$VERSION.tar
% cd SDL_bgi-$VERSION/src
% make
Expand Down
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,23 @@ programs, too.

`SDL_bgi` should compile on any platform supported by SDL2; it has
been tested on GNU/Linux, MS Windows (MSYS2 + Mingw-w64, CodeBlocks,
Dev-C++), macOS (High Sierra and Catalina), and Raspios (ARM, i386). A
few example programs are provided in the `test/` directory.

If you don't need BGI compatibility, I suggest that you check out
`SDL_gfx`, a graphics library that is more complete and more powerful
than `SDL_bgi`.
Dev-C++), macOS (High Sierra and Catalina), Raspios (ARM, i386), and
WebAssembly (Emscripten). A few example programs are provided in the
`test/` directory.

Links:

0. The SDL library:
0. `SDL_bgi` home page:
<http://sdl-bgi.sourceforge.io/>

1. The SDL library:
<https://www.libsdl.org/>

1. BGI on Wikipedia:
2. BGI on Wikipedia:
<https://en.wikipedia.org/wiki/Borland_Graphics_Interface>

2. WinBGIm, another BGI Windows port:
<http://www.cs.colorado.edu/~main/cs1300/doc/bgi/>

3. SDL_gfx, graphics drawing primitives and more:
<https://sourceforge.net/projects/sdl2gfx/>
3. WinBGIm, a BGI port for Windows:
<http://www.codecutter.net/tools/winbgim/>

4. Xbgi, a BGI XLib port:
<http://libxbgi.sourceforge.net/>
Expand Down
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TODO
----

- colours as negative numbers: add 16
- colours as negative numbers (undocumented TC feature): add 16?
- documentation: provide an example for each function

Your suggestions are welcome!
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.0
2.6.0
Binary file modified bin/CodeBlocks/SDL_bgi.dll
Binary file not shown.
Binary file modified bin/Dev-Cpp/SDL_bgi.dll
Binary file not shown.
Binary file modified bin/Mingw64/SDL_bgi.dll
Binary file not shown.
35 changes: 35 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# README.md

Documentation in this directory:

- Compatibility (`compatibility.md`)

- About internal fonts (`fonts.md`)

- Functions (`functions.md`)

- How to compile SDL_bgi programs with Code-Blocks (`howto_CodeBlocks.md`)

- How to compile SDL_bgi programs with Dev-C++ (`howto_Dev-Cpp.md`)

- How to turn an `SDL_bgi` program to an AppImage (`making_AppImages.md`)

- SDL bgi 2.5.1 Quick Reference (`sdl_bgi-quickref.tex`)

- Turtle Graphics Quick Reference (`turtlegraphics.tex`)

- Using SDL_bgi (`using.md`)

- graphics.3.gz (GNU/Linux manpage)

All `.md` (Markdown) files have been converted to PDF using `pandoc`
and the default PDF engine (pdflatex). If you want to modify these
files and convert them to PDF without a LaTeX installation, a good
alternative is `pdfroff`, provided by the `groff` package:

````
pandoc --latex-engine=pdfroff file.md -o file.pdf
````

Documents written in LaTeX are typeset with `pdflatex`.

Loading

0 comments on commit 5514d7e

Please sign in to comment.