Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LDLIBS = `sdl2-config --libs`
LIBGL = `pkg-config --libs --cflags gl`
LIBGLU = `pkg-config --libs --cflags glu`

SDL_SRC = src/c_util.F90 \
SDL_SRC = src/sdl2/sdl2_c_types.F90 \
src/sdl2/sdl2_stdinc.f90 \
src/sdl2/sdl2_audio.f90 \
src/sdl2/sdl2_blendmode.f90 \
Expand Down Expand Up @@ -37,7 +37,7 @@ SDL_SRC = src/c_util.F90 \
src/sdl2/sdl2_opengl.f90 \
src/sdl2.f90
IMG_SRC = src/sdl2_image.f90
MIX_SRC = src/c_util.F90 \
MIX_SRC = src/sdl2/sdl2_c_types.F90 \
src/sdl2_mixer.f90
TTF_SRC = src/sdl2_ttf.f90
GLU_SRC = src/glu.f90
Expand Down
56 changes: 0 additions & 56 deletions src/c_util.F90

This file was deleted.

2 changes: 1 addition & 1 deletion src/glu.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
! GitHub: https://github.com/interkosmos/fortran-sdl2/
! Licence: ISC
module glu
use, intrinsic :: iso_c_binding
use sdl2_c_types, only: c_ptr, c_int
use :: sdl2_opengl
implicit none
private
Expand Down
6 changes: 3 additions & 3 deletions src/sdl2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
! GitHub: https://github.com/interkosmos/fortran-sdl2/
! Licence: ISC
module sdl2
use, intrinsic :: iso_c_binding
use, intrinsic :: iso_fortran_env, only: i2 => int16, i4 => int32, i8 => int64
use :: c_util
use, intrinsic :: iso_c_binding, only: c_associated, c_f_pointer
use :: sdl2_c_types, only: c_int, c_int8_t, c_int32_t, c_uint8_t, c_uint32_t, c_size_t, c_null_char, c_null_ptr
use :: sdl2_audio
use :: sdl2_blendmode
use :: sdl2_cpuinfo
Expand All @@ -30,7 +30,7 @@ module sdl2
use :: sdl2_render
use :: sdl2_rwops
use :: sdl2_scancode
use :: sdl2_stdinc
use :: sdl2_stdinc, only: c_strlen
use :: sdl2_surface
use :: sdl2_thread
use :: sdl2_timer
Expand Down
3 changes: 2 additions & 1 deletion src/sdl2/sdl2_audio.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
! GitHub: https://github.com/interkosmos/fortran-sdl2/
! Licence: ISC
module sdl2_audio
use, intrinsic :: iso_c_binding, only: c_int, c_ptr
use sdl2_c_types, only: c_ptr, c_int
implicit none
private

public :: sdl_get_audio_driver_
public :: sdl_get_current_audio_driver_
Expand Down
13 changes: 7 additions & 6 deletions src/sdl2/sdl2_blendmode.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
! GitHub: https://github.com/interkosmos/fortran-sdl2/
! Licence: ISC
module sdl2_blendmode
use, intrinsic :: iso_c_binding, only: c_int
use sdl2_c_types, only: c_int
implicit none
private

! SDL_BlendMode
integer(kind=c_int), parameter :: SDL_BLENDMODE_NONE = int(z'00000000')
integer(kind=c_int), parameter :: SDL_BLENDMODE_BLEND = int(z'00000001')
integer(kind=c_int), parameter :: SDL_BLENDMODE_ADD = int(z'00000002')
integer(kind=c_int), parameter :: SDL_BLENDMODE_MOD = int(z'00000004')
integer(kind=c_int), parameter :: SDL_BLENDMODE_INVALID = int(z'7FFFFFFF')
integer(kind=c_int), parameter, public :: SDL_BLENDMODE_NONE = int(z'00000000')
integer(kind=c_int), parameter, public :: SDL_BLENDMODE_BLEND = int(z'00000001')
integer(kind=c_int), parameter, public :: SDL_BLENDMODE_ADD = int(z'00000002')
integer(kind=c_int), parameter, public :: SDL_BLENDMODE_MOD = int(z'00000004')
integer(kind=c_int), parameter, public :: SDL_BLENDMODE_INVALID = int(z'7FFFFFFF')
end module sdl2_blendmode
71 changes: 71 additions & 0 deletions src/sdl2/sdl2_c_types.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
! sdl2_c_types.F90
!
! Types aliases for C interoperability.
!
! Author: Philipp Engel, Igor S. Gerasimov
! GitHub: https://github.com/interkosmos/fortran-sdl2/
! Licence: ISC
module sdl2_c_types

use, intrinsic :: iso_c_binding, only: c_int8_t, c_int16_t, c_int32_t, c_int64_t, &
c_char, c_signed_char, c_short, c_int, &
c_long, c_long_long, &
c_ptr, c_funptr, c_null_ptr, c_null_char, &
c_size_t, &
c_float, c_double

#if HAS_UNSIGNED

use, intrinsic :: iso_c_binding, only: c_uint8_t, c_uint16_t, c_uint32_t, c_uint64_t, &
c_unsigned_char, c_unsigned, c_unsigned_short, &
c_unsigned_long, c_unsigned_long_long

#endif

implicit none
private

#if !HAS_UNSIGNED

integer, parameter :: c_uint8_t = c_int8_t
integer, parameter :: c_uint16_t = c_int16_t
integer, parameter :: c_uint32_t = c_int32_t
integer, parameter :: c_uint64_t = c_int64_t
integer, parameter :: c_unsigned = c_int
integer, parameter :: c_unsigned_char = c_signed_char
integer, parameter :: c_unsigned_long = c_long
integer, parameter :: c_unsigned_long_long = c_long_long
integer, parameter :: c_unsigned_short = c_short

#endif

public :: c_ptr
public :: c_funptr
public :: c_size_t
public :: c_float
public :: c_double
public :: c_null_ptr
public :: c_null_char

public :: c_int8_t
public :: c_int16_t
public :: c_int32_t
public :: c_int64_t
public :: c_char
public :: c_signed_char
public :: c_short
public :: c_int
public :: c_long
public :: c_long_long

public :: c_uint8_t
public :: c_uint16_t
public :: c_uint32_t
public :: c_uint64_t
public :: c_unsigned_char
public :: c_unsigned_short
public :: c_unsigned
public :: c_unsigned_long
public :: c_unsigned_long_long

end module sdl2_c_types
3 changes: 2 additions & 1 deletion src/sdl2/sdl2_cpuinfo.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
! GitHub: https://github.com/interkosmos/fortran-sdl2/
! Licence: ISC
module sdl2_cpuinfo
use, intrinsic :: iso_c_binding
use sdl2_c_types, only: c_int
use :: sdl2_stdinc, only: sdl_bool
implicit none
private

public :: sdl_get_cpu_cache_line_size
public :: sdl_get_cpu_count
Expand Down
3 changes: 2 additions & 1 deletion src/sdl2/sdl2_error.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
! GitHub: https://github.com/interkosmos/fortran-sdl2/
! Licence: ISC
module sdl2_error
use, intrinsic :: iso_c_binding, only: c_int, c_ptr
use sdl2_c_types, only: c_ptr
implicit none
private

public :: sdl_get_error_

Expand Down
Loading
Loading