;
; Raw Game Engine
; Copyright (C) 2023 Ernest Deak
;
; 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 3 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, see .
;
%ifndef SDL2_MAC
%define SDL2_MAC
; All functions can be directly called via the `exmcall` pseudo instruction
; there is therefore no need to define them here, so only names are included
; with brief documentation
; The following code is mostly taken from SDL2/*.h header files located usually
; in /usr/include/SDL2/
; The constants and enums have been modified to suit the macro/constant
; definitions required by NASM. Constants were directly taken from the headers
; and only slightly modified.
; See the actual SDL2 headers for full documentation, descriptions and license
%define SDL_INIT_VIDEO 0x00000020
%define SDL_WINDOW_SHOWN 0x00000004,
struc SDL_rect
.x resd 1
.y resd 1
.w resd 1
.h resd 1
endstruc
struc SDL_frect
.x_float resd 1
.y_float resd 1
.w_float resd 1
.h_float resd 1
endstruc
defstruct_shortcuts SDL_rect
defstruct_shortcuts SDL_frect
; SDL2 SDL_image related
%define IMG_INIT_JPG 0x00000001
%define IMG_INIT_PNG 0x00000002
%define IMG_INIT_TIF 0x00000004
%define IMG_INIT_WEBP 0x00000008
%define IMG_INIT_JXL 0x00000010
%define IMG_INIT_AVIF 0x00000020
;;/* RWops Types */
; copied from SDL_rwops.h
; SDL2 Licensing applies, for the full license see your source distribution
; of SDL2 (usually located in /usr/include/SDL2 or /usr/local/include/SDL2 on linux)
; Additional documentation can be found there as well
%define SDL_RWOPS_UNKNOWN 0U ;;/**< Unknown stream type */
%define SDL_RWOPS_WINFILE 1U ;;/**< Win32 file */
%define SDL_RWOPS_STDFILE 2U ;;/**< Stdio file */
%define SDL_RWOPS_JNIFILE 3U ;;/**< Android asset */
%define SDL_RWOPS_MEMORY 4U ;;/**< Memory stream */
%define SDL_RWOPS_MEMORY_RO 5U ;;/**< Read-Only memory stream */
; Any macros or definitions provided here are either for simplification,
; ease of use, just testing or pure convenience. Anything should work with the exmcall macro.
; Calling SDL2 functions or SDL2 plugin functions (like SDL2_image):
; IMG_LoadTexture(SDL_Renderer *rend, const char* file);
; exmcall IMG_LoadTexture, , "path/to/file.png"
; - for using with SDL2's rendering API via GPU instead of CPU
; returns SDL_Texture*
; Dispose of it after we are done with it with SDL_DestroyTexture(tex*)
; exmcall SDL_DestroyTexture,
; Convenience defines
;%define IMG_LoadTexture(rend, filename) exmcall rend, filename
;%define SDL_DestroyTexture(tex) exmcall tex
; Pixel formats, figured out via a .c file with printf of desired enum
SDL_PIXELFORMAT_ARGB4444 equ 0x15321002 ; 32bit little endian
SDL_PIXELFORMAT_RGBA32 equ 0x16762004
; Texture access
enum 0,\
SDL_TEXTUREACCESS_STATIC,\
SDL_TEXTUREACCESS_STREAMING,\
SDL_TEXTUREACCESS_TARGET
%include "inc/sdl2_keys.inc"
%include "inc/sdl2_event.inc"
%endif
.