maug
Quick and dirty C mini-augmentation library.
Loading...
Searching...
No Matches
RetroFlat Compilation

Makefile examples and compiler considerations for using RetroFlat. More...

Collaboration diagram for RetroFlat Compilation:

Macros

#define RETROFLAT_FPS   30
 Target Frames Per Second.
 
#define retroflat_fps_next()
 
#define RETROFLAT_WINDOW_CLASS   "RetroFlatWindowClass"
 Unique window class to use on some platforms (e.g. Win32). Is a RetroFlat Compiler Definitions.
 
#define RETROFLAT_WIN_FRAME_TIMER_ID   6001
 Unique ID for the timer that execute frame draws in Win16/Win32. Is a RetroFlat Compiler Definitions.
 
#define RETROFLAT_WIN_LOOP_TIMER_ID   6002
 Unique ID for the timer that execute loop ticks in Win16/Win32. Is a RetroFlat Compiler Definitions.
 
#define RETROFLAT_MSG_MAX   4096
 Maximum number of characters possible in a message using retroflat_message(). Is a RetroFlat Compiler Definitions.
 
#define RETROFLAT_PATH_MAX   MAUG_PATH_MAX
 
#define RETROFLAT_TITLE_MAX   255
 
#define RETROFLAT_VDP_ARGS_SZ_MAX   255
 
#define RETROFLAT_PATH_SEP   '/'
 The valid path separator on the target platform.
 
#define RETROFLAT_ASSETS_PATH_MAX   (RETROFLAT_PATH_MAX >> 1)
 Maximum size of the assets path, to allow room for appending.
 
#define RETROFLAT_BMP_COLORS_SZ_MAX   256
 

Detailed Description

Makefile examples and compiler considerations for using RetroFlat.

RetroFlat Compiler Definitions

Certain options can be configured when a RetroFlat program is compiled by passing definitions with the compiler using the -D flag, or by #define-ing them before retroflt.h is included in the source files.

OS Selection Definitions

These are mutually exclusive. It's best to specify them, in case RetroFlat can't figure it out from the compiler options.
Define Description
RETROFLAT_OS_WIN Specify that the program will run on Windows.
RETROFLAT_OS_DOS Specify that the program will run on DOS DPMI.
RETROFLAT_OS_DOS_REAL Specify that the program will run DOS real mode.
RETROFLAT_OS_UNIX Specify that the program will run on UNIX/Linux.

API/Library Selection Definitions

These are mutually exclusive. RetroGLU API is only supported on some (32-bit and up) platforms.
Define Description Supports OpenGL
RETROFLAT_API_ALLEGRO Allegro No
RETROFLAT_API_SDL1 SDL 1.2 Yes
RETROFLAT_API_SDL2 SDL 2 No
RETROFLAT_API_WIN16 Windows 3.1x API No
RETROFLAT_API_WIN32 Win32/NT API Yes
RETROFLAT_API_LIBNDS Nintendo DS Yes (Limited)
RETROFLAT_API_PC_BIOS MS-DOS w/ PC BIOS No
RETROFLAT_API_GLUT GLUT (OpenGL-Only) Yes

Option Definitions

These are NOT mutually exclusive.
Define Description
RETROFLAT_MOUSE Force-enable mouse on broken APIs (DANGEROUS!)
RETROFLAT_TXP_R Specify R component of bitmap transparent color.
RETROFLAT_TXP_G Specify G component of bitmap transparent color.
RETROFLAT_TXP_B Specify B component of bitmap transparent color.
RETROFLAT_BITMAP_EXT Specify file extension for bitmap assets.
RETROFLAT_NO_RESIZABLE Disallow resizing the RetroFlat window.
RETROFLAT_NO_BLANK_INIT Do not blank screen on retroflat_ini().

RetroFlat Project Makefiles

Win16 (OpenWatcom)

Compiling projects for Win16 requires the OpenWatcom compiler from https://github.com/open-watcom/open-watcom-v2. Other compilers may work, but this is the only one that has been tested. No other specific libraries are required. The Windows API is used directly.The Watcom Makefile includes assume the following variable definitions from the environment:
  • $WATCOM should be set to the path where the OpenWatcom compiler has been extracted, containing the binw, binl, h, and lib386 directories (among others).
  • $PATH should contain $WATCOM/bin, so that the wcc386 and accompanying tools below can be executed.
For an example of the main.c file, please see RetroFlat Example.

Makefile

An example to use the unified Makefile include follows. Please name it "Makefile" in the root directory of the project and replace "exampl" with a 6-character binary name for best results!

  # A list of C files included in the project. These must be provided
  # by you. In this example, our program only has one file.
  C_FILES := main.c

  # Project-specific defines to pass to EVERY target.
  GLOBAL_DEFINES := 

  # Include the template Makefile that will create targets for
  # platforms as specified below.
  include maug/Makefile.inc

  # Build these targets by default.
  all: exampl.sdl examplb.exe examplnt.exe

  # Create an icon from exampl.bmp for SDL to use for its window.
  $(eval $(call TGTSDLICO,mdemo))

  $(eval $(call TGTUNIXSDL,mdemo))

  # Build a DOS real-mode target.
  $(eval $(call TGTDOSBIOS,exampl))

  # Create an icon and resource file from exampl.bmp for Windows
  # targets to use.
  $(eval $(call TGTWINICO,exampl))

  # Build a Windows NT 32-bit target.
  $(eval $(call TGTWINNT,exampl))

  # Remove built files from previously defined targets.
  clean:
     rm -rf $(CLEAN_TARGETS)

Macro Definition Documentation

◆ RETROFLAT_FPS

#define RETROFLAT_FPS   30

Target Frames Per Second.

Todo
FPS currently has no effect in Allegro.

◆ retroflat_fps_next

#define retroflat_fps_next ( )
Value:
(1000 / RETROFLAT_FPS)
#define RETROFLAT_FPS
Target Frames Per Second.
Definition retroflt.h:677

◆ RETROFLAT_VDP_ARGS_SZ_MAX

#define RETROFLAT_VDP_ARGS_SZ_MAX   255

\warn Changing this may break binary compatibility!