diff --git a/README.md b/README.md index 518c8fa..c18782f 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,34 @@ # unigi unigi (Universal Graphics & Input) is a collection of headers, that implement a cross-platform API for drawing to the screen (framebuffer or window), and taking inputs (keyboard, mouse, joypad). -This is achieved through platforms (See `src/platform`), which act as the translation layer for different targets. The idea is to minimize the amount of work it takes to port graphical applications. - -The pixel format and screen coordinates are standardized, however, the HID inputs are not. It is best to make button layouts for each platform. +This repository contains documentation, links and example applications. -# Features +# Compatibility * Highly compatible with compilers (C89, simple preprocessors) -* No `make` required, entirely configurable from your compiler, or a header file (`src/config/user.h`) +* No `make` required, entirely configurable from your compiler, or header files * Supports wide range of hardware (16-bit+, little/big endian) -* Standardized 16-bit color format (RRRRGGGGBBBBAAAA, effectively 12-bit on most platforms) -* Implements API for floats, letting you pick between fixed point or actual float numbers -* Decent performance (Though some performance is sacrificed to standardize the interface. On DOS, it targets 30 fps on i586-class CPUs) +* Standardized 16-bit color format (AAAARRRRGGGGBBBB, effectively 12-bit on most platforms) +* Screen coordinates are standardized +* Decent performance (Though some performance is sacrificed for standardization) -# How to build -## Preparation -1. `git clone "https://git.lumen.sh/Fierelier/unigi"` -2. `git submodule update --init --recursive` (optional, required for fixed point math) +# Layers +A unigi app is built from different layers: +* [Headers](https://git.lumen.sh/Fierelier/unigi.headers) - The functions to be implemented by the Platform +* Platform - Implements the functions from Headers to work on a particular system (see below for a list) +* ... - Optionally, more layers +* App - Your code, uses other layers for input/output -## Platform: null -This platform has a very simple implementation, that is essentially a no-op for any possible target. It's meant for running a basic test before one makes a proper port. -1. `cc src/tests/draw.c -Dunigi_flag_platform_null` +# Platforms +Platforms act as the translation layer for different systems. The idea is to minimize the amount of work it takes to port graphical applications. -## Platform: dos -This platform implements DOS (MS-DOS, FreeDOS, etc.), Tested with Open Watcom. -1. `cc src/tests/draw.c -Dunigi_flag_platform_dos` +## Official platforms +* [SDL1](https://git.lumen.sh/Fierelier/unigi.platform.sdl1) - The highly compatible SDL 1.2, works on old Linux and Windows 95+ +* SDL2 (soon) - SDL 2.x, works on somewhat recent Linux and Windows XP+ +* DOS (soon) - DOS (Disk Operating System), compatible with FreeDOS and MS-DOS +* PSP (soon) - PlayStation Portable gaming console +* Null (soon) - A placeholder that does "nothing", good if you want to test basic compilation for an unsupported platform -## Platform: sdl1 -This platform implements the highly compatible SDL 1.2, which runs on all sorts of versions of Linux and Windows, as well as big endian CPUs. -1. `cc src/tests/draw.c -Dunigi_flag_platform_sdl1 -lSDL` - -## Advanced configuration -### No stdint.h -If no stdint.h is available, one must define `unigi_flag_nostdint` and also one of `unigi_flag_alu_*bit` (`*` = 8, 16, 32, 64), depending on how wide the ALU of the target CPU is. - -### Fixed point numbers -If fixed point is wished instead of float, one can define `unigi_flag_fixedpoint`. This uses the external fptc-lib headers. +## Third party platforms +... diff --git a/src/api/README.txt b/src/api/README.txt deleted file mode 100644 index b82e190..0000000 --- a/src/api/README.txt +++ /dev/null @@ -1 +0,0 @@ -This holds generic implementations for certain things, likely to be the same across platforms. The files found here should only be used if you're developing a platform implementation. diff --git a/src/api/event.c b/src/api/event.c deleted file mode 100644 index cf405ca..0000000 --- a/src/api/event.c +++ /dev/null @@ -1,40 +0,0 @@ -unigi_type_event * unigi_api_event_buffer; -void * unigi_api_event_data_buffer; - -unigi_type_error unigi_api_event_init() { - size_t event_biggest = 0; - size_t size; - // Misc - size = sizeof(unigi_type_event_data_none); - if (size > event_biggest) { event_biggest = size; } - size = sizeof(unigi_type_event_data_unknown); - if (size > event_biggest) { event_biggest = size; } - - // Window - size = sizeof(unigi_type_event_data_window_exit); - if (size > event_biggest) { event_biggest = size; } - size = sizeof(unigi_type_event_data_window_focus); - if (size > event_biggest) { event_biggest = size; } - - // Input - size = sizeof(unigi_type_event_data_input_keyboard_button); - if (size > event_biggest) { event_biggest = size; } - size = sizeof(unigi_type_event_data_input_mouse_button); - if (size > event_biggest) { event_biggest = size; } - size = sizeof(unigi_type_event_data_input_mouse_wheel); - if (size > event_biggest) { event_biggest = size; } - size = sizeof(unigi_type_event_data_input_mouse_move); - if (size > event_biggest) { event_biggest = size; } - size = sizeof(unigi_type_event_data_input_joypad_button); - if (size > event_biggest) { event_biggest = size; } - size = sizeof(unigi_type_event_data_input_joypad_analog); - if (size > event_biggest) { event_biggest = size; } - - unigi_api_event_buffer = malloc(sizeof(unigi_type_event)); - if (unigi_api_event_buffer == NULL) { return 1; } - unigi_api_event_data_buffer = malloc(event_biggest); - if (unigi_api_event_data_buffer == NULL) { return 1; } - unigi_api_event_buffer->id = unigi_enum_event_none; - unigi_api_event_buffer->data = unigi_api_event_data_buffer; - return 0; -} diff --git a/src/api/graphics.c b/src/api/graphics.c deleted file mode 100644 index 20e6a83..0000000 --- a/src/api/graphics.c +++ /dev/null @@ -1,22 +0,0 @@ -#ifdef unigi_flag_api_graphics_draw_row -static inline void unigi_graphics_draw_row(unigi_type_resolution_pixel_index pixelFrom, unigi_type_resolution_pixel_index pixelTo, unigi_type_color color) { - pixelTo++; - while (pixelFrom < pixelTo) { - unigi_graphics_draw_pixel(pixelFrom,color); - pixelFrom++; - } -} -#endif - -#ifdef unigi_flag_api_graphics_draw_square -static inline void unigi_graphics_draw_square(unigi_type_resolution_pixel_index pixelFrom, unigi_type_resolution_pixel_index pixelTo, unigi_type_resolution_pixel_axis height, unigi_type_color color) { - unigi_type_resolution_pixel_index row = 0; - height++; - while (row < height) { - unigi_graphics_draw_row(pixelFrom,pixelTo,color); - pixelFrom += unigi_status_resolution.width; - pixelTo += unigi_status_resolution.width; - row++; - } -} -#endif diff --git a/src/config/checks.h b/src/config/checks.h deleted file mode 100644 index 3bd932d..0000000 --- a/src/config/checks.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef unigi_flag_platform - #define unigi_flag_exception - #error "Please define a valid platform:" - #error "* unigi_flag_platform_null" - #error "* unigi_flag_platform_dos" - #error "* unigi_flag_platform_sdl1" - //#error "* unigi_flag_platform_sdl2" - #error "" -#endif - -#ifdef unigi_flag_nostdint - #ifdef unigi_flag_alu_8bit - #ifdef unigi_flag_alu_defined - #define unigi_flag_alu_errored - #endif - #define unigi_flag_alu_defined - #endif - - #ifdef unigi_flag_alu_16bit - #ifdef unigi_flag_alu_defined - #define unigi_flag_alu_errored - #endif - #define unigi_flag_alu_defined - #endif - - #ifdef unigi_flag_alu_32bit - #ifdef unigi_flag_alu_defined - #define unigi_flag_alu_errored - #endif - #define unigi_flag_alu_defined - #endif - - #ifdef unigi_flag_alu_64bit - #ifdef unigi_flag_alu_defined - #define unigi_flag_alu_errored - #endif - #define unigi_flag_alu_defined - #endif - - #ifdef unigi_flag_alu_errored - #define unigi_flag_exception - #error "You may only define one of unigi_flag_alu_*!" - #error "" - #endif - - #ifndef unigi_flag_alu_defined - #define unigi_flag_exception - #error "If unigi_flag_nostdint is defined, either of these needs to be defined as well:" - #error "* unigi_flag_alu_8bit" - #error "* unigi_flag_alu_16bit" - #error "* unigi_flag_alu_32bit" - #error "* unigi_flag_alu_64bit" - #error "" - #endif -#endif diff --git a/src/config/user.h b/src/config/user.h deleted file mode 100644 index 8f854e6..0000000 --- a/src/config/user.h +++ /dev/null @@ -1,4 +0,0 @@ -//#define unigi_flag_platform_null -//#define unigi_flag_nostdint -//#define unigi_flag_alu_16bit -//#define unigi_flag_fixedpoint diff --git a/src/fptc-lib b/src/fptc-lib deleted file mode 160000 index 2e0f95d..0000000 --- a/src/fptc-lib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2e0f95d06f586fa21e79916c4018fcab4cbd002d diff --git a/src/main.h b/src/main.h deleted file mode 100644 index ba34e10..0000000 --- a/src/main.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef unigi_flag_h -#define unigi_flag_h -#include "config/user.h" -#include "platform/defs.h" -#include "config/checks.h" - -#ifdef unigi_flag_exception -#error "The configuration is invalid! Compilation cannot continue, fix the errors above." -#else -#include "type/int.h" -#ifndef unigi_flag_fixedpoint - #include "type/float.h" -#else - #include - #include - #include "type/float_fp.h" -#endif - -// Misc -typedef unigi_type_uint16 unigi_type_color; -typedef unigi_type_uint8 unigi_type_color_depth; -typedef unigi_type_uint8 unigi_type_event_enum; -typedef unigi_type_int16 unigi_type_input_joypad_analog; - -// Event -struct unigi_type_event { - unigi_type_event_enum id; - void * data; -}; -typedef struct unigi_type_event unigi_type_event; -#define unigi_enum_event_unknown 0 -#define unigi_enum_event_none 1 -#define unigi_enum_event_window_exit 2 -#define unigi_enum_event_window_focus 3 -#define unigi_enum_event_input_keyboard_button 4 -#define unigi_enum_event_input_mouse_button 5 -#define unigi_enum_event_input_mouse_wheel 6 -#define unigi_enum_event_input_mouse_move 7 -#define unigi_enum_event_input_joypad_button 8 -#define unigi_enum_event_input_joypad_analog 9 - -// Platform -#include "platform/main.h" - -// Misc -struct unigi_type_event_data_unknown { - unigi_type_bool none; -}; -typedef struct unigi_type_event_data_unknown unigi_type_event_data_unknown; -typedef unigi_type_event_data_unknown unigi_type_event_data_none; - -// Window -typedef unigi_type_event_data_none unigi_type_event_data_window_exit; -struct unigi_type_event_data_window_focus { - unigi_type_bool focused; -}; -typedef struct unigi_type_event_data_window_focus unigi_type_event_data_window_focus; - -// Input -struct unigi_type_event_data_input_keyboard_button { - unigi_type_input_keyboard_button button; - unigi_type_bool pressed; -}; -typedef struct unigi_type_event_data_input_keyboard_button unigi_type_event_data_input_keyboard_button; - -struct unigi_type_event_data_input_mouse_button { - unigi_type_input_mouse_button button; - unigi_type_bool pressed; -}; -typedef struct unigi_type_event_data_input_mouse_button unigi_type_event_data_input_mouse_button; - -struct unigi_type_event_data_input_mouse_wheel { - unigi_type_int8 scroll; -}; -typedef struct unigi_type_event_data_input_mouse_wheel unigi_type_event_data_input_mouse_wheel; - -struct unigi_type_event_data_input_mouse_move { - unigi_type_resolution_pixel_axis x; - unigi_type_resolution_pixel_axis y; -}; -typedef struct unigi_type_event_data_input_mouse_move unigi_type_event_data_input_mouse_move; - -struct unigi_type_event_data_input_joypad_button { - unigi_type_input_mouse_button button; - unigi_type_bool pressed; -}; -typedef struct unigi_type_event_data_input_joypad_button unigi_type_event_data_input_joypad_button; - -struct unigi_type_event_data_input_joypad_analog { - unigi_type_input_joypad_button axis; - unigi_type_input_joypad_analog analog; -}; -typedef struct unigi_type_event_data_input_joypad_analog unigi_type_event_data_input_joypad_analog; - -// Resolution -struct unigi_type_resolution { - unigi_type_resolution_pixel_axis width; - unigi_type_resolution_pixel_axis height; - unigi_type_color_depth depth; - unigi_type_bool fullscreen; -}; -typedef struct unigi_type_resolution unigi_type_resolution; - -struct unigi_type_resolution_range { - unigi_type_resolution * min; - unigi_type_resolution * max; -}; -typedef struct unigi_type_resolution_range unigi_type_resolution_range; - -unigi_type_resolution_range * unigi_status_resolutions; -unigi_type_resolution unigi_status_resolution; - -// Platform main -#include "platform/main.c" -#endif -#endif diff --git a/src/platform/defs.h b/src/platform/defs.h deleted file mode 100644 index 248ff3b..0000000 --- a/src/platform/defs.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef unigi_flag_platform_null - #define unigi_flag_platform "null" -#endif - -#ifdef unigi_flag_platform_sdl1 - #define unigi_flag_platform "sdl1" -#endif - -#ifdef unigi_flag_platform_dos - #define unigi_flag_platform "dos" -#endif diff --git a/src/platform/dos/event.c b/src/platform/dos/event.c deleted file mode 100644 index e32fb71..0000000 --- a/src/platform/dos/event.c +++ /dev/null @@ -1,5 +0,0 @@ -#define unigi_event_init unigi_api_event_init -#include "../../api/event.c" -unigi_type_event * unigi_event_get() { - return unigi_api_event_buffer; -} diff --git a/src/platform/dos/graphics.c b/src/platform/dos/graphics.c deleted file mode 100644 index 99d4756..0000000 --- a/src/platform/dos/graphics.c +++ /dev/null @@ -1,342 +0,0 @@ -#include -#define unigi_platform_palette_dos_colors 216 -unigi_type_uint8 unigi_platform_palette_dos[unigi_platform_palette_dos_colors * 3] = { - 00, 00, 00, - 00, 00, 12, - 00, 00, 25, - 00, 00, 38, - 00, 00, 51, - 00, 00, 63, - 00, 12, 00, - 00, 12, 12, - 00, 12, 25, - 00, 12, 38, - 00, 12, 51, - 00, 12, 63, - 00, 25, 00, - 00, 25, 12, - 00, 25, 25, - 00, 25, 38, - 00, 25, 51, - 00, 25, 63, - 00, 38, 00, - 00, 38, 12, - 00, 38, 25, - 00, 38, 38, - 00, 38, 51, - 00, 38, 63, - 00, 51, 00, - 00, 51, 12, - 00, 51, 25, - 00, 51, 38, - 00, 51, 51, - 00, 51, 63, - 00, 63, 00, - 00, 63, 12, - 00, 63, 25, - 00, 63, 38, - 00, 63, 51, - 00, 63, 63, - 12, 00, 00, - 12, 00, 12, - 12, 00, 25, - 12, 00, 38, - 12, 00, 51, - 12, 00, 63, - 12, 12, 00, - 12, 12, 12, - 12, 12, 25, - 12, 12, 38, - 12, 12, 51, - 12, 12, 63, - 12, 25, 00, - 12, 25, 12, - 12, 25, 25, - 12, 25, 38, - 12, 25, 51, - 12, 25, 63, - 12, 38, 00, - 12, 38, 12, - 12, 38, 25, - 12, 38, 38, - 12, 38, 51, - 12, 38, 63, - 12, 51, 00, - 12, 51, 12, - 12, 51, 25, - 12, 51, 38, - 12, 51, 51, - 12, 51, 63, - 12, 63, 00, - 12, 63, 12, - 12, 63, 25, - 12, 63, 38, - 12, 63, 51, - 12, 63, 63, - 25, 00, 00, - 25, 00, 12, - 25, 00, 25, - 25, 00, 38, - 25, 00, 51, - 25, 00, 63, - 25, 12, 00, - 25, 12, 12, - 25, 12, 25, - 25, 12, 38, - 25, 12, 51, - 25, 12, 63, - 25, 25, 00, - 25, 25, 12, - 25, 25, 25, - 25, 25, 38, - 25, 25, 51, - 25, 25, 63, - 25, 38, 00, - 25, 38, 12, - 25, 38, 25, - 25, 38, 38, - 25, 38, 51, - 25, 38, 63, - 25, 51, 00, - 25, 51, 12, - 25, 51, 25, - 25, 51, 38, - 25, 51, 51, - 25, 51, 63, - 25, 63, 00, - 25, 63, 12, - 25, 63, 25, - 25, 63, 38, - 25, 63, 51, - 25, 63, 63, - 38, 00, 00, - 38, 00, 12, - 38, 00, 25, - 38, 00, 38, - 38, 00, 51, - 38, 00, 63, - 38, 12, 00, - 38, 12, 12, - 38, 12, 25, - 38, 12, 38, - 38, 12, 51, - 38, 12, 63, - 38, 25, 00, - 38, 25, 12, - 38, 25, 25, - 38, 25, 38, - 38, 25, 51, - 38, 25, 63, - 38, 38, 00, - 38, 38, 12, - 38, 38, 25, - 38, 38, 38, - 38, 38, 51, - 38, 38, 63, - 38, 51, 00, - 38, 51, 12, - 38, 51, 25, - 38, 51, 38, - 38, 51, 51, - 38, 51, 63, - 38, 63, 00, - 38, 63, 12, - 38, 63, 25, - 38, 63, 38, - 38, 63, 51, - 38, 63, 63, - 51, 00, 00, - 51, 00, 12, - 51, 00, 25, - 51, 00, 38, - 51, 00, 51, - 51, 00, 63, - 51, 12, 00, - 51, 12, 12, - 51, 12, 25, - 51, 12, 38, - 51, 12, 51, - 51, 12, 63, - 51, 25, 00, - 51, 25, 12, - 51, 25, 25, - 51, 25, 38, - 51, 25, 51, - 51, 25, 63, - 51, 38, 00, - 51, 38, 12, - 51, 38, 25, - 51, 38, 38, - 51, 38, 51, - 51, 38, 63, - 51, 51, 00, - 51, 51, 12, - 51, 51, 25, - 51, 51, 38, - 51, 51, 51, - 51, 51, 63, - 51, 63, 00, - 51, 63, 12, - 51, 63, 25, - 51, 63, 38, - 51, 63, 51, - 51, 63, 63, - 63, 00, 00, - 63, 00, 12, - 63, 00, 25, - 63, 00, 38, - 63, 00, 51, - 63, 00, 63, - 63, 12, 00, - 63, 12, 12, - 63, 12, 25, - 63, 12, 38, - 63, 12, 51, - 63, 12, 63, - 63, 25, 00, - 63, 25, 12, - 63, 25, 25, - 63, 25, 38, - 63, 25, 51, - 63, 25, 63, - 63, 38, 00, - 63, 38, 12, - 63, 38, 25, - 63, 38, 38, - 63, 38, 51, - 63, 38, 63, - 63, 51, 00, - 63, 51, 12, - 63, 51, 25, - 63, 51, 38, - 63, 51, 51, - 63, 51, 63, - 63, 63, 00, - 63, 63, 12, - 63, 63, 25, - 63, 63, 38, - 63, 63, 51, - 63, 63, 63 -}; - -unigi_type_uint8 unigi_platform_palette[65536]; - -static inline void unigi_platform_color_16_to_32(unigi_type_uint16 color16,unigi_type_uint8 * r, unigi_type_uint8 * g, unigi_type_uint8 * b, unigi_type_uint8 * a) { - *r = (color16 >> 12) & 0xF; - *g = (color16 >> 8) & 0xF; - *b = (color16 >> 4) & 0xF; - *a = color16 & 0xF; - - *r = *r << 4; - *g = *g << 4; - *b = *b << 4; - *a = *a << 4; -} - -unigi_type_uint8 unigi_platform_color_find(unigi_type_uint8 r, unigi_type_uint8 g, unigi_type_uint8 b) { - unigi_type_uint8 color = 0; - unigi_type_uint16 index = 0; - unigi_type_uint16 smallestDiff = 32767; - r /= 4; g /= 4; b /= 4; - - while (index < unigi_platform_palette_dos_colors * 3) { - unigi_type_uint16 diff = abs(r - unigi_platform_palette_dos[index]) + - abs(g - unigi_platform_palette_dos[index + 1]) + - abs(b - unigi_platform_palette_dos[index + 2]); - - if (diff < smallestDiff) { - smallestDiff = diff; - color = index / 3; - } - index += 3; - } - return color; -} - -#include -unigi_type_error unigi_graphics_init() { - // Create palette - unigi_type_uint32 index = 0; - while (index < 65536) { - unigi_type_uint8 r,g,b,a; - unigi_platform_color_16_to_32(index,&r,&g,&b,&a); - if (index % 500 == 0) { - printf("Generating palette %ld ...\r",index); - fflush(stdout); - } - unigi_platform_palette[index] = unigi_platform_color_find(r,g,b); - index++; - } - - // Create a list of compatible resolutions - unigi_status_resolutions = malloc(sizeof(unigi_type_resolution_range) * 2); - if (unigi_status_resolutions == NULL) { return 1; } - unigi_status_resolutions[0].min = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[0].min == NULL) { return 1; } - unigi_status_resolutions[0].min->width = 320; - unigi_status_resolutions[0].min->height = 200; - unigi_status_resolutions[0].min->depth = 8; - unigi_status_resolutions[0].min->fullscreen = 1; - unigi_status_resolutions[0].max = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[0].max == NULL) { return 1; } - unigi_status_resolutions[0].max->width = 320; - unigi_status_resolutions[0].max->height = 200; - unigi_status_resolutions[0].max->depth = 8; - unigi_status_resolutions[0].max->fullscreen = 1; - - // End the list with a resolution range where all values are set to 0 - unigi_status_resolutions[1].min = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[1].min == NULL) { return 1; } - unigi_status_resolutions[1].min->width = 0; - unigi_status_resolutions[1].min->height = 0; - unigi_status_resolutions[1].min->depth = 0; - unigi_status_resolutions[1].min->fullscreen = 0; - unigi_status_resolutions[1].max = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[1].max == NULL) { return 1; } - unigi_status_resolutions[1].max->width = 0; - unigi_status_resolutions[1].max->height = 0; - unigi_status_resolutions[1].max->depth = 0; - unigi_status_resolutions[1].max->fullscreen = 0; - - return 0; -} - -void outportb(unsigned short port, unsigned char value) { - __asm { - mov dx, port - mov al, value - out dx, al - } -} - -unigi_type_error unigi_graphics_mode(unigi_type_resolution * resolution, char * title) { - unigi_type_uint16 color; - union REGS inregs, outregs; - unigi_status_resolution.width = 320; - unigi_status_resolution.height = 240; - unigi_status_resolution.depth = 8; - unigi_status_resolution.fullscreen = 1; - - inregs.h.ah = 0; - inregs.h.al = 0x13; - int86(0x10,&inregs,&outregs); - - outportb(0x03C8, 0); - for (color = 0; color < unigi_platform_palette_dos_colors * 3; color++) { - if (color % 16 == 0) delay(1); - outportb(0x03C9, unigi_platform_palette_dos[color]); - } - return 0; -} - -static inline void unigi_graphics_draw_pixel(unigi_type_resolution_pixel_index pixel, unigi_type_color color) { // This is horribly slow, for now - unsigned char far *unigi_platform_vidbuf = (unsigned char far *)0xA0000000L; - unigi_platform_vidbuf[pixel] = unigi_platform_palette[color]; -} - -static inline void unigi_graphics_flush() { -} - -#define unigi_flag_api_graphics_draw_row -#define unigi_flag_api_graphics_draw_square -#include "../../api/graphics.c" diff --git a/src/platform/dos/input.c b/src/platform/dos/input.c deleted file mode 100644 index 2981601..0000000 --- a/src/platform/dos/input.c +++ /dev/null @@ -1,3 +0,0 @@ -unigi_type_error unigi_input_init() { - return 0; -} diff --git a/src/platform/dos/main.c b/src/platform/dos/main.c deleted file mode 100644 index 9e470a5..0000000 --- a/src/platform/dos/main.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include "input.c" -#include "graphics.c" -#include "event.c" -#include "time.c" - -unigi_type_error unigi_init() { - if (unigi_event_init() != 0) { return 1; } - return 0; -} - -void unigi_close() { - union REGS inregs, outregs; - inregs.h.ah = 0; - inregs.h.al = 0x03; - int86(0x10,&inregs,&outregs); -} diff --git a/src/platform/dos/main.h b/src/platform/dos/main.h deleted file mode 100644 index 5e815b6..0000000 --- a/src/platform/dos/main.h +++ /dev/null @@ -1,8 +0,0 @@ -char unigi_platform[] = "null"; -typedef unigi_type_uint8 unigi_type_error; -typedef unigi_type_uint32 unigi_type_time; -typedef unigi_type_uint16 unigi_type_resolution_pixel_axis; -typedef unigi_type_uint32 unigi_type_resolution_pixel_index; -typedef unigi_type_uint8 unigi_type_input_keyboard_button; -typedef unigi_type_uint8 unigi_type_input_mouse_button; -typedef unigi_type_uint8 unigi_type_input_joypad_button; diff --git a/src/platform/dos/time.c b/src/platform/dos/time.c deleted file mode 100644 index 161c288..0000000 --- a/src/platform/dos/time.c +++ /dev/null @@ -1,2 +0,0 @@ -unigi_type_time unigi_time_clock() { return 0; } -void unigi_time_sleep(unigi_type_time time) { } diff --git a/src/platform/main.c b/src/platform/main.c deleted file mode 100644 index 2f69d9c..0000000 --- a/src/platform/main.c +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef unigi_flag_platform_null - #include "null/main.c" -#endif - -#ifdef unigi_flag_platform_sdl1 - #include "sdl1/main.c" -#endif - -#ifdef unigi_flag_platform_dos - #include "dos/main.c" -#endif diff --git a/src/platform/main.h b/src/platform/main.h deleted file mode 100644 index 6ead378..0000000 --- a/src/platform/main.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef unigi_flag_platform_null - #include "null/main.h" -#endif - -#ifdef unigi_flag_platform_sdl1 - #include "sdl1/main.h" -#endif - -#ifdef unigi_flag_platform_dos - #include "dos/main.h" -#endif diff --git a/src/platform/null/event.c b/src/platform/null/event.c deleted file mode 100644 index e32fb71..0000000 --- a/src/platform/null/event.c +++ /dev/null @@ -1,5 +0,0 @@ -#define unigi_event_init unigi_api_event_init -#include "../../api/event.c" -unigi_type_event * unigi_event_get() { - return unigi_api_event_buffer; -} diff --git a/src/platform/null/graphics.c b/src/platform/null/graphics.c deleted file mode 100644 index c9f6053..0000000 --- a/src/platform/null/graphics.c +++ /dev/null @@ -1,76 +0,0 @@ -unigi_type_error unigi_graphics_init() { - // Create a list of compatible resolutions - unigi_status_resolutions = malloc(sizeof(unigi_type_resolution_range) * 4); - if (unigi_status_resolutions == NULL) { return 1; } - unigi_status_resolutions[0].min = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[0].min == NULL) { return 1; } - unigi_status_resolutions[0].min->width = 640; - unigi_status_resolutions[0].min->height = 480; - unigi_status_resolutions[0].min->depth = 0; // 0 indicates unknown - unigi_status_resolutions[0].min->fullscreen = 0; - unigi_status_resolutions[0].max = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[0].max == NULL) { return 1; } - unigi_status_resolutions[0].max->width = 640; - unigi_status_resolutions[0].max->height = 480; - unigi_status_resolutions[0].max->depth = 0; - unigi_status_resolutions[0].max->fullscreen = 0; - - unigi_status_resolutions[1].min = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[1].min == NULL) { return 1; } - unigi_status_resolutions[1].min->width = 800; - unigi_status_resolutions[1].min->height = 600; - unigi_status_resolutions[1].min->depth = 0; - unigi_status_resolutions[1].min->fullscreen = 0; - unigi_status_resolutions[1].max = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[1].max == NULL) { return 1; } - unigi_status_resolutions[1].max->width = 800; - unigi_status_resolutions[1].max->height = 600; - unigi_status_resolutions[1].max->depth = 0; - unigi_status_resolutions[1].max->fullscreen = 0; - - unigi_status_resolutions[2].min = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[2].min == NULL) { return 1; } - unigi_status_resolutions[2].min->width = 1024; - unigi_status_resolutions[2].min->height = 768; - unigi_status_resolutions[2].min->depth = 0; - unigi_status_resolutions[2].min->fullscreen = 0; - unigi_status_resolutions[2].max = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[2].max == NULL) { return 1; } - unigi_status_resolutions[2].max->width = 1024; - unigi_status_resolutions[2].max->height = 768; - unigi_status_resolutions[2].max->depth = 0; - unigi_status_resolutions[2].max->fullscreen = 0; - - // End the list with a resolution range where all values are set to 0 - unigi_status_resolutions[3].min = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[3].min == NULL) { return 1; } - unigi_status_resolutions[3].min->width = 0; - unigi_status_resolutions[3].min->height = 0; - unigi_status_resolutions[3].min->depth = 0; - unigi_status_resolutions[3].min->fullscreen = 0; - unigi_status_resolutions[3].max = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[3].max == NULL) { return 1; } - unigi_status_resolutions[3].max->width = 0; - unigi_status_resolutions[3].max->height = 0; - unigi_status_resolutions[3].max->depth = 0; - unigi_status_resolutions[3].max->fullscreen = 0; - return 0; -} - -unigi_type_error unigi_graphics_mode(unigi_type_resolution * resolution, char * title) { - unigi_status_resolution.width = resolution -> width; - unigi_status_resolution.height = resolution -> height; - unigi_status_resolution.depth = resolution -> depth; - unigi_status_resolution.fullscreen = resolution -> fullscreen; - return 0; -} - -static inline void unigi_graphics_draw_pixel(unigi_type_resolution_pixel_index pixel, unigi_type_color color) { -} - -static inline void unigi_graphics_flush() { -} - -#define unigi_flag_api_graphics_draw_row -#define unigi_flag_api_graphics_draw_square -#include "../../api/graphics.c" diff --git a/src/platform/null/input.c b/src/platform/null/input.c deleted file mode 100644 index 2981601..0000000 --- a/src/platform/null/input.c +++ /dev/null @@ -1,3 +0,0 @@ -unigi_type_error unigi_input_init() { - return 0; -} diff --git a/src/platform/null/main.c b/src/platform/null/main.c deleted file mode 100644 index 3bd95d2..0000000 --- a/src/platform/null/main.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include "input.c" -#include "graphics.c" -#include "event.c" -#include "time.c" - -unigi_type_error unigi_init() { - if (unigi_event_init() != 0) { return 1; } - return 0; -} - -void unigi_close() { -} diff --git a/src/platform/null/main.h b/src/platform/null/main.h deleted file mode 100644 index 5e815b6..0000000 --- a/src/platform/null/main.h +++ /dev/null @@ -1,8 +0,0 @@ -char unigi_platform[] = "null"; -typedef unigi_type_uint8 unigi_type_error; -typedef unigi_type_uint32 unigi_type_time; -typedef unigi_type_uint16 unigi_type_resolution_pixel_axis; -typedef unigi_type_uint32 unigi_type_resolution_pixel_index; -typedef unigi_type_uint8 unigi_type_input_keyboard_button; -typedef unigi_type_uint8 unigi_type_input_mouse_button; -typedef unigi_type_uint8 unigi_type_input_joypad_button; diff --git a/src/platform/null/time.c b/src/platform/null/time.c deleted file mode 100644 index 161c288..0000000 --- a/src/platform/null/time.c +++ /dev/null @@ -1,2 +0,0 @@ -unigi_type_time unigi_time_clock() { return 0; } -void unigi_time_sleep(unigi_type_time time) { } diff --git a/src/platform/sdl1/event.c b/src/platform/sdl1/event.c deleted file mode 100644 index 639c1ee..0000000 --- a/src/platform/sdl1/event.c +++ /dev/null @@ -1,25 +0,0 @@ -#define unigi_event_init unigi_api_event_init -#include "../../api/event.c" -unigi_type_event * unigi_event_get() { - SDL_Event event; - if (SDL_PollEvent(&event) != 1) { - unigi_api_event_buffer->id = unigi_enum_event_none; - goto rtn; - } else if (event.type == SDL_QUIT) { - unigi_api_event_buffer->id = unigi_enum_event_window_exit; - goto rtn; - } else if ( - event.type == SDL_KEYDOWN || - event.type == SDL_KEYUP - ) { - unigi_api_event_buffer->id = unigi_enum_event_input_keyboard_button; - unigi_type_event_data_input_keyboard_button * data = (unigi_type_event_data_input_keyboard_button *)unigi_api_event_buffer->data; - data->button = event.key.keysym.sym; - data->pressed = (event.type == SDL_KEYDOWN); - goto rtn; - } - - unigi_api_event_buffer->id = unigi_enum_event_unknown; - rtn:; - return unigi_api_event_buffer; -} diff --git a/src/platform/sdl1/graphics.c b/src/platform/sdl1/graphics.c deleted file mode 100644 index 24299c8..0000000 --- a/src/platform/sdl1/graphics.c +++ /dev/null @@ -1,125 +0,0 @@ -SDL_Surface * unigi_platform_surface; -SDL_PixelFormat * unigi_platform_status_format; -unigi_type_uint8 * unigi_platform_palette; - -static inline void unigi_platform_color_16_to_32(unigi_type_uint16 color16,unigi_type_uint8 * r, unigi_type_uint8 * g, unigi_type_uint8 * b, unigi_type_uint8 * a) { - *r = (color16 >> 12) & 0xF; - *g = (color16 >> 8) & 0xF; - *b = (color16 >> 4) & 0xF; - *a = color16 & 0xF; - - *r = *r << 4; - *g = *g << 4; - *b = *b << 4; - *a = *a << 4; -} - -unigi_type_error unigi_graphics_init() { - printf("[PLATFORM:SDL1] Initializing video...\n"); - if (SDL_Init(SDL_INIT_VIDEO) < 0) { - printf("[PLATFORM:SDL1] %s\n",SDL_GetError()); - return 1; - } - const SDL_VideoInfo * vidInfo = SDL_GetVideoInfo(); - if (vidInfo == NULL) { return 1; } - unigi_type_color_depth bpp = vidInfo->vfmt->BitsPerPixel; - unigi_platform_status_format = vidInfo->vfmt; - - unigi_platform_palette = malloc((bpp / 8) * 65536); - if (unigi_platform_palette == NULL) { return 1; } - unigi_type_uint8 r,g,b,a; - unigi_type_uint32 sdlcolor; - unigi_type_uint8 * sdlcolor8; - - unigi_type_uint32 index; - index = 0; - while (index < 65536) { - unigi_platform_color_16_to_32((unigi_type_uint16)index,&r,&g,&b,&a); - sdlcolor = SDL_MapRGBA(unigi_platform_status_format,r,g,b,a); - sdlcolor8 = (unigi_type_uint8 *)&sdlcolor; - unigi_type_color_depth i; - for(i = 0; i < bpp/8; i++) - { - unigi_platform_palette[(index * (bpp/8)) + i] = sdlcolor8[i]; - } - index++; - } - - // Create a list of compatible resolutions - unigi_status_resolutions = malloc(sizeof(unigi_type_resolution_range) * 2); - if (unigi_status_resolutions == NULL) { return 1; } - unigi_status_resolutions[0].min = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[0].min == NULL) { return 1; } - unigi_status_resolutions[0].min->width = 128; - unigi_status_resolutions[0].min->height = 64; - unigi_status_resolutions[0].min->depth = bpp; - unigi_status_resolutions[0].min->fullscreen = 0; - unigi_status_resolutions[0].max = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[0].max == NULL) { return 1; } - unigi_status_resolutions[0].max->width = 4096; - unigi_status_resolutions[0].max->height = 4096; - unigi_status_resolutions[0].max->depth = bpp; - unigi_status_resolutions[0].max->fullscreen = 0; - - // End the list with a resolution range where all values are set to 0 - unigi_status_resolutions[1].min = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[1].min == NULL) { return 1; } - unigi_status_resolutions[1].min->width = 0; - unigi_status_resolutions[1].min->height = 0; - unigi_status_resolutions[1].min->depth = 0; - unigi_status_resolutions[1].min->fullscreen = 0; - unigi_status_resolutions[1].max = malloc(sizeof(unigi_type_resolution)); - if (unigi_status_resolutions[1].max == NULL) { return 1; } - unigi_status_resolutions[1].max->width = 0; - unigi_status_resolutions[1].max->height = 0; - unigi_status_resolutions[1].max->depth = 0; - unigi_status_resolutions[1].max->fullscreen = 0; - return 0; -} - -unigi_type_error unigi_graphics_mode(unigi_type_resolution * resolution, char * title) { - printf("[PLATFORM:SDL1] Setting video mode...\n"); - unigi_platform_surface = SDL_SetVideoMode(resolution->width,resolution->height,resolution->depth,SDL_SWSURFACE); - if (unigi_platform_surface == NULL) { return 1; } - SDL_WM_SetCaption(title,NULL); - unigi_status_resolution.width = resolution->width; - unigi_status_resolution.height = resolution->height; - unigi_status_resolution.depth = resolution->depth; - unigi_status_resolution.fullscreen = resolution->fullscreen; - return 0; -} - -static inline void unigi_graphics_draw_pixel(unigi_type_resolution_pixel_index pixel, unigi_type_color color) { - unigi_type_uint8 * pixels1 = (unigi_type_uint8 *)(unigi_platform_surface->pixels); - unigi_type_uint8 * palette1 = (unigi_type_uint8 *)unigi_platform_palette; - unigi_type_uint16 * pixels2 = (unigi_type_uint16 *)(unigi_platform_surface->pixels); - unigi_type_uint16 * palette2 = (unigi_type_uint16 *)unigi_platform_palette; - unigi_type_uint32 * pixels4 = (unigi_type_uint32 *)(unigi_platform_surface->pixels); - unigi_type_uint32 * palette4 = (unigi_type_uint32 *)unigi_platform_palette; - - if (unigi_status_resolution.depth < 24) { - if (unigi_status_resolution.depth == 8) { - pixels1[pixel] = palette1[color]; - } else { - pixels2[pixel] = palette2[color]; - } - } else { - if (unigi_status_resolution.depth == 24) { - memcpy( - pixels1 + (pixel * 3), - palette1 + (color * 3), - 3 - ); - } else { - pixels4[pixel] = palette4[color]; - } - } -} - -static inline void unigi_graphics_flush() { - SDL_Flip(unigi_platform_surface); -} - -#define unigi_flag_api_graphics_draw_row -#define unigi_flag_api_graphics_draw_square -#include "../../api/graphics.c" diff --git a/src/platform/sdl1/input.c b/src/platform/sdl1/input.c deleted file mode 100644 index 2981601..0000000 --- a/src/platform/sdl1/input.c +++ /dev/null @@ -1,3 +0,0 @@ -unigi_type_error unigi_input_init() { - return 0; -} diff --git a/src/platform/sdl1/main.c b/src/platform/sdl1/main.c deleted file mode 100644 index 7267f54..0000000 --- a/src/platform/sdl1/main.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include "input.c" -#include "graphics.c" -#include "event.c" -#include "time.c" - -unigi_type_error unigi_init() { - if (unigi_event_init() != 0) { return 1; } - return 0; -} - -void unigi_close() { - SDL_Quit(); -} \ No newline at end of file diff --git a/src/platform/sdl1/main.h b/src/platform/sdl1/main.h deleted file mode 100644 index 323932b..0000000 --- a/src/platform/sdl1/main.h +++ /dev/null @@ -1,8 +0,0 @@ -char unigi_platform[] = "sdl1"; -typedef unigi_type_uint8 unigi_type_error; -typedef unigi_type_uint32 unigi_type_time; -typedef unigi_type_uint16 unigi_type_resolution_pixel_axis; -typedef unigi_type_uint32 unigi_type_resolution_pixel_index; -typedef unigi_type_uint8 unigi_type_input_keyboard_button; -typedef unigi_type_uint8 unigi_type_input_mouse_button; -typedef unigi_type_uint8 unigi_type_input_joypad_button; diff --git a/src/platform/sdl1/time.c b/src/platform/sdl1/time.c deleted file mode 100644 index cbf681a..0000000 --- a/src/platform/sdl1/time.c +++ /dev/null @@ -1,4 +0,0 @@ -unigi_type_time unigi_time_clock() { return (unigi_type_time)SDL_GetTicks() * 1000; } -void unigi_time_sleep(unigi_type_time microseconds) { - SDL_Delay(microseconds/1000); -} diff --git a/src/tests/draw.c b/src/tests/draw.c deleted file mode 100644 index 06e5b6a..0000000 --- a/src/tests/draw.c +++ /dev/null @@ -1,155 +0,0 @@ -#include "../main.h" -#ifndef unigi_flag_exception -#include - -#ifndef min - #define min(x, y) ((x) < (y) ? (x) : (y)) -#endif - -#ifndef max - #define max(x, y) ((x) > (y) ? (x) : (y)) -#endif - -unigi_type_uint32 seed = 1337; -unigi_type_uint32 example_random() { - seed = (seed * 1103515245 + 12345) & 0x7FFFFFFF; - return seed; -} - -int main_shelled() { - size_t resolution_index = 0; - unigi_type_resolution_pixel_index smallestValidSize = 0 - 1; - unigi_type_resolution smallestValidRes; - smallestValidRes.width = 0; - - if (unigi_init() > 0) { return 1; } - if (unigi_graphics_init() > 0) { return 1; } - - while (1) { - unigi_type_resolution_range * range = &unigi_status_resolutions[resolution_index]; - if ( - range->min->width == 0 && - range->min->height == 0 && - range->min->depth == 0 && - range->min->fullscreen == 0 && - range->max->width == 0 && - range->max->height == 0 && - range->max->depth == 0 && - range->max->fullscreen == 0 - ) { - break; - } - - // Get smallest resolution between 320x200 and 800x600 - if ( - range->max->width >= 320 && - range->max->height >= 200 && - range->min->width <= 800 && - range->min->height <= 600 - ) { - unigi_type_resolution_pixel_index size; - unigi_type_resolution_pixel_axis smallestWidth = min( - max(range->min->width,320), - min(range->max->width,800) - ); - - unigi_type_resolution_pixel_axis smallestHeight = min( - max(range->min->height,200), - min(range->max->height,600) - ); - - printf("Found valid resolution: %ix%ix%i\n",smallestWidth,smallestHeight,range->min->depth); - - size = (unigi_type_resolution_pixel_index)smallestWidth * smallestHeight; - if (size < smallestValidSize) { - smallestValidRes.width = smallestWidth; - smallestValidRes.height = smallestHeight; - smallestValidRes.depth = range->min->depth; - smallestValidRes.fullscreen = range->min->fullscreen; - smallestValidSize = size; - } - } - - ++resolution_index; - } - - if (smallestValidRes.width == 0) { - printf("No valid resolutions found.\n"); - return 1; - } - - printf("* Using smallest resolution: %ix%ix%i\n", - smallestValidRes.width, - smallestValidRes.height, - smallestValidRes.depth - ); - unigi_graphics_mode(&smallestValidRes,"unigi test"); - unigi_input_init(); - - while (1) { - unigi_type_resolution_pixel_axis startX; - unigi_type_resolution_pixel_axis startY; - unigi_type_resolution_pixel_axis width; - unigi_type_resolution_pixel_axis height; - unigi_type_resolution_pixel_index startIndex; - unigi_type_resolution_pixel_index stopIndex; - unigi_type_resolution_pixel_index prog; - unigi_type_resolution_pixel_axis ind; - - while (1) { - unigi_type_event * event = unigi_event_get(); - if (event->id == unigi_enum_event_none) { break; } - if (event->id == unigi_enum_event_window_exit) { - unigi_close(); - return 0; - } - if (event->id == unigi_enum_event_input_keyboard_button) { - unigi_close(); - return 0; - } - } - - // Draw some random squares on the screen - startX = example_random() % (unigi_status_resolution.width); - startY = example_random() % (unigi_status_resolution.height); - width = example_random() % (unigi_status_resolution.width - startX); - height = example_random() % (unigi_status_resolution.height - startY); - startIndex = startX + (unigi_status_resolution.width * startY); - stopIndex = startIndex + width; - unigi_graphics_draw_square(startIndex,stopIndex,height,example_random() % 65535); - - // Draw a simple test pattern, and demonstrate how to use floats - prog = unigi_float_2int(unigi_float_mul( - unigi_float_make(unigi_status_resolution.width), - unigi_float_div(unigi_float_make(1),unigi_float_make(40)) - )); - ind = 0; - unigi_graphics_draw_square(prog * ind,prog * (ind + 1),unigi_status_resolution.height,0xF00F); - ind++; - unigi_graphics_draw_square(prog * ind,prog * (ind + 1),unigi_status_resolution.height,0xFF0F); - ind++; - unigi_graphics_draw_square(prog * ind,prog * (ind + 1),unigi_status_resolution.height,0x0F0F); - ind++; - unigi_graphics_draw_square(prog * ind,prog * (ind + 1),unigi_status_resolution.height,0x0FFF); - ind++; - unigi_graphics_draw_square(prog * ind,prog * (ind + 1),unigi_status_resolution.height,0x00FF); - ind++; - unigi_graphics_draw_square(prog * ind,prog * (ind + 1),unigi_status_resolution.height,0xF0FF); - ind++; - unigi_graphics_draw_square(prog * ind,prog * (ind + 1),unigi_status_resolution.height,0x0000); - ind++; - unigi_graphics_draw_square(prog * ind,prog * (ind + 1),unigi_status_resolution.height,0xFFFF); - ind++; - - unigi_graphics_flush(); - unigi_time_sleep(33000); // Wait 33ms - } - return 0; -} - -int main() { - int rtn = main_shelled(); - unigi_close(); - return rtn; -} -#endif diff --git a/src/type/float.h b/src/type/float.h deleted file mode 100644 index 5998dde..0000000 --- a/src/type/float.h +++ /dev/null @@ -1,16 +0,0 @@ -typedef float unigi_type_float; -#define unigi_float_make(A) ((unigi_type_float)A) -#define unigi_float_2int(A) ((unigi_type_int32)A) -#define unigi_float_add(A,B) (A + B) -#define unigi_float_sub(A,B) (A - B) -#define unigi_float_mul(A,B) (A * B) -#define unigi_float_div(A,B) (A / B) -//#define unigi_float_scan fpt_scan -//#define unigi_float_str fpt_str -#define unigi_float_sqrt sqrtf -#define unigi_float_sin sin -#define unigi_float_cos cosf -#define unigi_float_tan tanf -#define unigi_float_exp exp -#define unigi_float_log log -#define unigi_float_pow(A,B) (A ^ B) diff --git a/src/type/float_fp.h b/src/type/float_fp.h deleted file mode 100644 index 963f6c5..0000000 --- a/src/type/float_fp.h +++ /dev/null @@ -1,17 +0,0 @@ -#include "../fptc-lib/src/fptc.h" -typedef fpt unigi_type_float; -#define unigi_float_make fl2fpt -#define unigi_float_2int fpt2i -#define unigi_float_add fpt_add -#define unigi_float_sub fpt_sub -#define unigi_float_mul fpt_mul -#define unigi_float_div fpt_div -#define unigi_float_scan fpt_scan -#define unigi_float_str fpt_str -#define unigi_float_sqrt fpt_sqrt -#define unigi_float_sin fpt_sin -#define unigi_float_cos fpt_cos -#define unigi_float_tan fpt_tan -#define unigi_float_exp fpt_exp -#define unigi_float_log fpt_ln -#define unigi_float_pow fpt_pow diff --git a/src/type/int.h b/src/type/int.h deleted file mode 100644 index 0beb68d..0000000 --- a/src/type/int.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef unigi_flag_nostdint - #include - typedef int8_t unigi_type_int8; - typedef uint8_t unigi_type_uint8; - typedef int16_t unigi_type_int16; - typedef uint16_t unigi_type_uint16; - typedef int32_t unigi_type_int32; - typedef uint32_t unigi_type_uint32; -#else - typedef signed char unigi_type_int8; - typedef unsigned char unigi_type_uint8; - typedef signed short unigi_type_int16; - typedef unsigned short unigi_type_uint16; - #ifndef unigi_flag_alu_64bit // On 8-bit, 16-bit and 32-bit C compilers, long is usually 32 bits. - typedef signed long unigi_type_int32; - typedef unsigned long unigi_type_uint32; - #else - typedef signed int unigi_type_int32; - typedef unsigned int unigi_type_uint32; - #endif - - // Define *int*_t for fptc-lib - typedef unigi_type_int8 int8_t; - typedef unigi_type_uint8 uint8_t; - typedef unigi_type_int16 int16_t; - typedef unigi_type_uint16 uint16_t; - typedef unigi_type_int32 int32_t; - typedef unigi_type_uint32 uint32_t; -#endif -typedef unigi_type_uint8 unigi_type_bool;