diff --git a/README.md b/README.md index 0eb6d3d..d7021d6 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,20 @@ more samples, and the necessary corrections! - SDL2 is required; - Optional bindings for `SDL2_Mixer`, `SDL2_Image` and `SDL2_TTF`; - Crystal > 0.22.0 is required for `SDL2_Mixer` to work correctly. + +## How to use as shard + +Add this to your shard.yml file +```yaml +dependencies: + sdl: + github: ysbaddaden/sdl.cr +``` + +You should then run `shards update` + +Make sure to +```crystal +require "sdl" +``` +in your project. diff --git a/samples/04_keyboard.cr b/samples/04_keyboard.cr index 85c2437..e5ecce2 100644 --- a/samples/04_keyboard.cr +++ b/samples/04_keyboard.cr @@ -7,10 +7,10 @@ window = SDL::Window.new("SDL tutorial", 640, 480) surfaces = { default: SDL.load_bmp(File.join(__DIR__, "data", "press.bmp")), - up: SDL.load_bmp(File.join(__DIR__, "data", "up.bmp")), - down: SDL.load_bmp(File.join(__DIR__, "data", "down.bmp")), - left: SDL.load_bmp(File.join(__DIR__, "data", "left.bmp")), - right: SDL.load_bmp(File.join(__DIR__, "data", "right.bmp")), + up: SDL.load_bmp(File.join(__DIR__, "data", "up.bmp")), + down: SDL.load_bmp(File.join(__DIR__, "data", "down.bmp")), + left: SDL.load_bmp(File.join(__DIR__, "data", "left.bmp")), + right: SDL.load_bmp(File.join(__DIR__, "data", "right.bmp")), } bmp = surfaces[:default] diff --git a/samples/10_colorkey.cr b/samples/10_colorkey.cr index 77e21d0..1f56ccf 100644 --- a/samples/10_colorkey.cr +++ b/samples/10_colorkey.cr @@ -19,7 +19,7 @@ image.color_key = {0, 255, 255} foo = SDL::Texture.from(image, renderer) # image has a transparent background color (SDL_image sets the colorkey): -#foo = IMG.load(File.join(__DIR__, "data", "foo2.png"), renderer) +# foo = IMG.load(File.join(__DIR__, "data", "foo2.png"), renderer) loop do case event = SDL::Event.poll diff --git a/src/events.cr b/src/events.cr index 207ebdd..0301b87 100644 --- a/src/events.cr +++ b/src/events.cr @@ -280,21 +280,18 @@ module SDL case event.type when .window_event? Window.new(event.window) - when .keydown?, .keyup? Keyboard.new(event.key) when .text_editing? TextEditing.new(event.edit) when .text_input? TextInput.new(event.text) - when .mouse_motion? MouseMotion.new(event.motion) when .mouse_button_down?, .mouse_button_up? MouseButton.new(event.button) when .mouse_wheel? MouseWheel.new(event.wheel) - when .joy_axis_motion? JoyAxis.new(event.jaxis) when .joy_ball_motion? @@ -305,24 +302,20 @@ module SDL JoyButton.new(event.jbutton) when .joy_device_added?, .joy_device_removed? JoyDevice.new(event.jdevice) - when .controller_axis_motion? ControllerAxis.new(event.caxis) when .controller_button_down?, .controller_button_up? ControllerButton.new(event.cbutton) when .controller_device_added?, .controller_device_removed?, .controller_device_remapped? ControllerDevice.new(event.cdevice) - when .finger_down?, .finger_up?, .finger_motion? TouchFinger.new(event.tfinger) when .dollar_gesture?, .dollar_record? DollarGesture.new(event.dgesture) when .multi_gesture? MultiGesture.new(event.mgesture) - when .drop_file? Drop.new(event.drop) - when .quit? Quit.new(event.quit) when .sys_wm_event? diff --git a/src/image.cr b/src/image.cr index 7d19f27..f366ff1 100644 --- a/src/image.cr +++ b/src/image.cr @@ -41,7 +41,7 @@ module SDL # `SDL::Surface`. def self.load(path, type : Type? = nil) SDL::RWops.open(path, "rb") do |rwops| - if type + if type surface = LibIMG.load_typed_rw(rwops, 1, type.to_s) raise Error.new("IMG_LoadTyped_RW") unless surface else @@ -56,7 +56,7 @@ module SDL # `SDL::Texture` for *renderer*. def self.load(path, renderer : SDL::Renderer, type : Type? = nil) SDL::RWops.open(path, "rb") do |rwops| - if type + if type texture = LibIMG.load_texture_typed_rw(renderer, rwops, 1, type.to_s) raise Error.new("IMG_LoadTextureTyped_RW") unless texture else @@ -85,7 +85,7 @@ module SDL end {% end %} - #class File + # class File # def initialize(path) # @rwops = SDL::RWops.new(path, "rb") # end @@ -110,6 +110,6 @@ module SDL # LibIMG.is_{{type.downcase.id}}(@rwops) == 1 # end # {% end %} - #end + # end end end diff --git a/src/lib_img.cr b/src/lib_img.cr index 36243a3..5e41926 100644 --- a/src/lib_img.cr +++ b/src/lib_img.cr @@ -14,9 +14,9 @@ lib LibIMG alias RWops = LibSDL::RWops VERSION = {% `pkg-config SDL2_image --modversion`.strip %} - MAJOR = {% VERSION.split('.')[0] %} - MINOR = {% VERSION.split('.')[1] %} - PATCH = {% VERSION.split('.')[2] %} + MAJOR = {% VERSION.split('.')[0] %} + MINOR = {% VERSION.split('.')[1] %} + PATCH = {% VERSION.split('.')[2] %} @[Flags] enum Init @@ -27,7 +27,7 @@ lib LibIMG end fun init = IMG_Init(flags : Init) : Int - fun quit = IMG_Quit() + fun quit = IMG_Quit fun load = IMG_Load(file : Char*) : Surface* fun load_rw = IMG_Load_RW(src : RWops*, freesrc : Int) : Surface* diff --git a/src/lib_mix.cr b/src/lib_mix.cr index 50164de..333143b 100644 --- a/src/lib_mix.cr +++ b/src/lib_mix.cr @@ -6,13 +6,13 @@ lib LibMix alias Char = LibC::Char alias RWops = LibSDL::RWops - VERSION = {% `pkg-config SDL2_mixer --modversion`.strip %} - MAJOR = {% VERSION.split('.')[0] %} - MINOR = {% VERSION.split('.')[1] %} - PATCH = {% VERSION.split('.')[2] %} - MIN_MAX_VOLUME = 128 + VERSION = {% `pkg-config SDL2_mixer --modversion`.strip %} + MAJOR = {% VERSION.split('.')[0] %} + MINOR = {% VERSION.split('.')[1] %} + PATCH = {% VERSION.split('.')[2] %} + MIN_MAX_VOLUME = 128 Mix_DEFAULT_FORMAT = LibSDL::AUDIO_S16LSB - + @[Flags] enum Init FLAC = 0x00000001 @@ -53,6 +53,7 @@ lib LibMix alen : UInt32 volume : UInt8 end + alias Chunk = Mix_Chunk struct WAVStream @@ -64,23 +65,24 @@ lib LibMix union Data cmd : MusicCMD* wave : WAVStream* - #mp3 : SMPEG* - #ogg : OGG_music* + # mp3 : SMPEG* + # ogg : OGG_music* end struct Mix_Music type : MusicType data : Data end + alias Music = Mix_Music fun init = Mix_Init(flags : Init) : Int - fun quit = Mix_Quit() + fun quit = Mix_Quit fun open_audio = Mix_OpenAudio(frequency : Int, format : UInt16, channels : Int, chunksize : Int) : Int - fun close_audio = Mix_CloseAudio() + fun close_audio = Mix_CloseAudio fun open_audio_device = Mix_OpenAudioDevice(frequency : Int, format : UInt16) : Int - + fun allocate_channels = Mix_AllocateChannels(numchans : Int) : Int fun query_spec = Mix_QuerySpec(frequency : Int*, format : UInt16*, channels : Int*) : Int fun load_wav_rw = Mix_LoadWAV_RW(src : RWops*, freesrc : Int) : Chunk* @@ -91,12 +93,12 @@ lib LibMix fun quick_load_raw = Mix_QuickLoad_RAW(mem : UInt8*, len : UInt32) : Chunk* fun free_chunk = Mix_FreeChunk(chunk : Chunk*) fun free_music = Mix_FreeMusic(music : Music*) - fun get_num_chunk_decoders = Mix_GetNumChunkDecoders() : Int + fun get_num_chunk_decoders = Mix_GetNumChunkDecoders : Int fun get_chunk_decoder = Mix_GetChunkDecoder(index : Int) : Char* - fun get_num_music_decoders = Mix_GetNumMusicDecoders() : Int + fun get_num_music_decoders = Mix_GetNumMusicDecoders : Int fun get_music_decoder = Mix_GetMusicDecoder(index : Int) : Char* fun get_music_type = Mix_GetMusicType(music : Music*) : MusicType - fun get_music_hook_data = Mix_GetMusicHookData() + fun get_music_hook_data = Mix_GetMusicHookData fun play_channel = Mix_PlayChannel(channel : Int, chunk : Chunk*, loops : Int) : Int fun play_channel_timed = Mix_PlayChannelTimed(channel : Int, chunk : Chunk*, loops : Int, ticks : Int) : Int fun fade_in_channel = Mix_FadeInChannelTimed(channel : Int, chunk : Chunk*, loops : Int, ticks : Int, dur : Int) : Int @@ -107,14 +109,14 @@ lib LibMix fun channel_volume = Mix_Volume(channel : Int, volume : Int) : Int fun channel_paused = Mix_Paused(channel : Int) : Int fun play_music = Mix_PlayMusic(music : Music*, loops : Int) : Int - fun music_playing = Mix_PlayingMusic() : Int - fun music_paused = Mix_PausedMusic() : Int - fun rewind_music = Mix_RewindMusic() - fun resume_music = Mix_ResumeMusic() - fun pause_music = Mix_PauseMusic() - fun halt_music = Mix_HaltMusic() : Int + fun music_playing = Mix_PlayingMusic : Int + fun music_paused = Mix_PausedMusic : Int + fun rewind_music = Mix_RewindMusic + fun resume_music = Mix_ResumeMusic + fun pause_music = Mix_PauseMusic + fun halt_music = Mix_HaltMusic : Int fun fade_in_music = Mix_FadeInMusic(music : Music*, loops : Int, ms : Int) fun fade_out_music = Mix_FadeOutMusic(ms : Int) fun music_volume = Mix_VolumeMusic(volume : Int) : Int - fun get_error = Mix_GetError() : Char* + fun get_error = Mix_GetError : Char* end diff --git a/src/lib_sdl.cr b/src/lib_sdl.cr index 11a6c35..595ce5d 100644 --- a/src/lib_sdl.cr +++ b/src/lib_sdl.cr @@ -1,12 +1,12 @@ require "./lib_sdl/main" require "./lib_sdl/audio" require "./lib_sdl/clipboard" -#require "./lib_sdl/cpuinfo" +# require "./lib_sdl/cpuinfo" require "./lib_sdl/error" require "./lib_sdl/events" require "./lib_sdl/joystick" require "./lib_sdl/gamecontroller" -#require "./lib_sdl/haptic" +# require "./lib_sdl/haptic" require "./lib_sdl/hints" require "./lib_sdl/messagebox" require "./lib_sdl/mouse" @@ -15,7 +15,7 @@ require "./lib_sdl/power" require "./lib_sdl/render" require "./lib_sdl/rwops" require "./lib_sdl/shape" -#require "./lib_sdl/system" +# require "./lib_sdl/system" require "./lib_sdl/video" @[Link("SDL2")] @@ -31,9 +31,9 @@ lib LibSDL alias SizeT = LibC::SizeT VERSION = {% `pkg-config sdl2 --modversion`.strip %} - MAJOR = {% VERSION.split('.')[0] %} - MINOR = {% VERSION.split('.')[1] %} - PATCH = {% VERSION.split('.')[2] %} + MAJOR = {% VERSION.split('.')[0] %} + MINOR = {% VERSION.split('.')[1] %} + PATCH = {% VERSION.split('.')[2] %} INIT_TIMER = 0x00000001 INIT_AUDIO = 0x00000010 @@ -49,5 +49,5 @@ lib LibSDL fun init_sub_system = SDL_InitSubSystem(flags : UInt32) : Int fun quit_sub_system = SDL_QuitSubSystem(flags : UInt32) fun was_init = SDL_WasInit(flags : UInt32) : UInt32 - fun quit = SDL_Quit() + fun quit = SDL_Quit end diff --git a/src/lib_sdl/audio.cr b/src/lib_sdl/audio.cr index 7138617..0b09043 100644 --- a/src/lib_sdl/audio.cr +++ b/src/lib_sdl/audio.cr @@ -9,16 +9,16 @@ lib LibSDL AUDIO_S16LSB = 0x8010 AUDIO_U16MSB = 0x1010 AUDIO_S16MSB = 0x9010 - AUDIO_U16 = AUDIO_U16LSB - AUDIO_S16 = AUDIO_S16LSB + AUDIO_U16 = AUDIO_U16LSB + AUDIO_S16 = AUDIO_S16LSB AUDIO_S32LSB = 0x8020 AUDIO_S32MSB = 0x9020 - AUDIO_S32 = AUDIO_S32LSB + AUDIO_S32 = AUDIO_S32LSB AUDIO_F32LSB = 0x8120 AUDIO_F32MSB = 0x9120 - AUDIO_F32 = AUDIO_F32LSB + AUDIO_F32 = AUDIO_F32LSB # LITTLE ENDIAN AUDIO_U16SYS = AUDIO_U16LSB @@ -27,10 +27,10 @@ lib LibSDL AUDIO_F32SYS = AUDIO_F32LSB # BIG ENDIAN - #AUDIO_U16SYS = AUDIO_U16MSB - #AUDIO_S16SYS = AUDIO_S16MSB - #AUDIO_S32SYS AUDIO_S32MSB - #AUDIO_F32SYS AUDIO_F32MSB + # AUDIO_U16SYS = AUDIO_U16MSB + # AUDIO_S16SYS = AUDIO_S16MSB + # AUDIO_S32SYS AUDIO_S32MSB + # AUDIO_F32SYS AUDIO_F32MSB AUDIO_ALLOW_FREQUENCY_CHANGE = 0x00000001 AUDIO_ALLOW_FORMAT_CHANGE = 0x00000002 @@ -41,15 +41,15 @@ lib LibSDL alias AudioCallback = (Void*, UInt8*, Int) -> Void struct AudioSpec - freq : Int - format : AudioFormat - channels : UInt8 - silence : UInt8 - samples : UInt16 - padding : UInt16 - size : UInt32 + freq : Int + format : AudioFormat + channels : UInt8 + silence : UInt8 + samples : UInt16 + padding : UInt16 + size : UInt32 callback : AudioCallback* - userdata : Void* + userdata : Void* end # (cvt, format) @@ -57,30 +57,30 @@ lib LibSDL @[Packed] struct AudioCVT - needed : Int - src_format : AudioFormat - dst_format : AudioFormat - rate_incr : Double - buf : UInt8* - len : Int - len_cvt : Int - len_mult : Int - len_ratio : Double + needed : Int + src_format : AudioFormat + dst_format : AudioFormat + rate_incr : Double + buf : UInt8* + len : Int + len_cvt : Int + len_mult : Int + len_ratio : Double filters : StaticArray(AudioFilter*, 10) - filter_index : Int + filter_index : Int end enum AudioStatus - STOPPED = 0 - PLAYING= 1 + STOPPED = 0 + PLAYING = 1 PAUSED end - fun get_num_audio_drivers = SDL_GetNumAudioDrivers() : Int + fun get_num_audio_drivers = SDL_GetNumAudioDrivers : Int fun get_audio_driver = SDL_GetAudioDriver(index : Int) : Char* fun audio_init = SDL_AudioInit(driver_name : Char*) : Int - fun audio_quit = SDL_AudioQuit() - fun get_current_audio_driver = SDL_GetCurrentAudioDriver() : Char* + fun audio_quit = SDL_AudioQuit + fun get_current_audio_driver = SDL_GetCurrentAudioDriver : Char* fun open_audio = SDL_OpenAudio(desierd : AudioSpec*, obtained : AudioSpec*) : Int fun get_num_audio_devices = SDL_GetNumAudioDevices(iscapture : Int) : Int @@ -88,7 +88,7 @@ lib LibSDL fun open_audio_device = SDL_OpenAudioDevice(device : Char*, iscapture : Int, desired : AudioSpec*, obtained : AudioSpec*, allowed_changes : Int) : AudioDeviceID - fun get_audio_status = SDL_GetAudioStatus() : AudioStatus + fun get_audio_status = SDL_GetAudioStatus : AudioStatus fun get_audio_device_status = SDL_GetAudioDeviceStatus(dev : AudioDeviceID) : AudioStatus fun pause_audio = SDL_PauseAudio(pause_on : Int) @@ -109,11 +109,11 @@ lib LibSDL fun mix_audio = SDL_MixAudio(dst : UInt8*, src : UInt8*, len : UInt32, volume : Int) fun mix_audio_format = SDL_MixAudioFormat(dst : UInt8*, src : UInt8*, format : AudioFormat, len : UInt32, volume : Int) - fun lock_audio = SDL_LockAudio() + fun lock_audio = SDL_LockAudio fun lock_audio_device = SDL_LockAudioDevice(dev : AudioDeviceID) - fun unlock_audio = SDL_UnlockAudio() + fun unlock_audio = SDL_UnlockAudio fun unlock_audio_device = SDL_UnlockAudioDevice(dev : AudioDeviceID) - fun close_audio = SDL_CloseAudio() + fun close_audio = SDL_CloseAudio fun close_audio = SDL_CloseAudioDevice(dev : AudioDeviceID) end diff --git a/src/lib_sdl/blend_mode.cr b/src/lib_sdl/blend_mode.cr index f6e7346..73b3a8f 100644 --- a/src/lib_sdl/blend_mode.cr +++ b/src/lib_sdl/blend_mode.cr @@ -1,8 +1,8 @@ lib LibSDL enum BlendMode : UInt32 - NONE = 0x00000000 + NONE = 0x00000000 BLEND = 0x00000001 - ADD = 0x00000002 - MOD = 0x00000004 + ADD = 0x00000002 + MOD = 0x00000004 end end diff --git a/src/lib_sdl/clipboard.cr b/src/lib_sdl/clipboard.cr index 13450e8..8d4fdb2 100644 --- a/src/lib_sdl/clipboard.cr +++ b/src/lib_sdl/clipboard.cr @@ -1,5 +1,5 @@ lib LibSDL fun set_clipboard_text = SDL_SetClipboardText(text : Char*) : Int - fun get_clipboard_text = SDL_GetClipboardText() : Char* - fun has_clipboard_text = SDL_HasClipboardText() : Bool + fun get_clipboard_text = SDL_GetClipboardText : Char* + fun has_clipboard_text = SDL_HasClipboardText : Bool end diff --git a/src/lib_sdl/error.cr b/src/lib_sdl/error.cr index 2d174a8..0f44bb8 100644 --- a/src/lib_sdl/error.cr +++ b/src/lib_sdl/error.cr @@ -1,5 +1,5 @@ lib LibSDL fun set_error = SDL_SetError(fmt : Char*, ...) - fun get_error = SDL_GetError() : Char* - fun clear_error = SDL_ClearError() + fun get_error = SDL_GetError : Char* + fun clear_error = SDL_ClearError end diff --git a/src/lib_sdl/events.cr b/src/lib_sdl/events.cr index 7dedc55..ca0873d 100644 --- a/src/lib_sdl/events.cr +++ b/src/lib_sdl/events.cr @@ -12,11 +12,11 @@ lib LibSDL PRESSED = 1 enum EventType : UInt32 - FIRSTEVENT = 0 + FIRSTEVENT = 0 # application - QUIT = 0x100 + QUIT = 0x100 APP_TERMINATING APP_LOW_MEMORY APP_WILL_ENTER_BACKGROUND @@ -31,21 +31,21 @@ lib LibSDL # keyboard - KEYDOWN = 0x300 + KEYDOWN = 0x300 KEYUP TEXT_EDITING TEXT_INPUT # mouse - MOUSE_MOTION = 0x400 + MOUSE_MOTION = 0x400 MOUSE_BUTTON_DOWN MOUSE_BUTTON_UP MOUSE_WHEEL # joystick - JOY_AXIS_MOTION = 0x600 + JOY_AXIS_MOTION = 0x600 JOY_BALL_MOTION JOY_HAT_MOTION JOY_BUTTON_DOWN @@ -55,7 +55,7 @@ lib LibSDL # game controller - CONTROLLER_AXIS_MOTION = 0x650 + CONTROLLER_AXIS_MOTION = 0x650 CONTROLLER_BUTTON_DOWN CONTROLLER_BUTTON_UP CONTROLLER_DEVICE_ADDED @@ -64,7 +64,7 @@ lib LibSDL # touch - FINGER_DOWN = 0x700 + FINGER_DOWN = 0x700 FINGER_UP FINGER_MOTION @@ -78,7 +78,7 @@ lib LibSDL CLIPBOARD_UPDATE = 0x900 # drag n' drop - DROP_FILE = 0x1000 + DROP_FILE = 0x1000 # render RENDER_TARGETS_RESET = 0x2000 @@ -296,10 +296,10 @@ lib LibSDL timestamp : UInt32 end - #struct OSEvent + # struct OSEvent # type : EventType # timestamp : UInt32 - #end + # end struct UserEvent type : EventType @@ -352,7 +352,7 @@ lib LibSDL GET = 2 end - fun pump_events = SDL_PumpEvents() + fun pump_events = SDL_PumpEvents fun peep_events = SDL_PeepEvents(events : Event*, numevents : Int, action : EventAction, minType : EventType, maxType : EventType) : Int fun has_event = SDL_HasEvent(type : EventType) : Bool fun has_events = SDL_HasEvents(minType : EventType, maxType : EventType) : Bool @@ -371,9 +371,9 @@ lib LibSDL fun filter_events = SDL_FilterEvents(filter : EventFilter*, userdata : Void*) QUERY = -1 - IGNORE = 0 - DISABLE = 0 - ENABLE = 1 + IGNORE = 0 + DISABLE = 0 + ENABLE = 1 fun event_state = SDL_EventState(type : EventType, state : Int) : UInt8 # SDL_GetEventState(type) = SDL_EventState(type, QUERY) diff --git a/src/lib_sdl/gamecontroller.cr b/src/lib_sdl/gamecontroller.cr index a711f3f..42ec6c5 100644 --- a/src/lib_sdl/gamecontroller.cr +++ b/src/lib_sdl/gamecontroller.cr @@ -2,7 +2,7 @@ lib LibSDL type GameController = Void enum GameControllerAxis - INVALID = -1 + INVALID = -1 LEFTX LEFTY RIGHTX @@ -13,7 +13,7 @@ lib LibSDL end enum GameControllerButton - BUTTON_INVALID = -1 + BUTTON_INVALID = -1 BUTTON_A BUTTON_B BUTTON_X @@ -33,7 +33,7 @@ lib LibSDL end enum GameControllerBindType - NONE = 0 + NONE = 0 BUTTON AXIS HAT @@ -69,7 +69,7 @@ lib LibSDL fun game_controller_get_joystick = SDL_GameControllerGetJoystick(gamecontroller : GameController*) : Joystick* fun game_controller_event_state = SDL_GameControllerEventState(gamecontroller : GameController*) : Int fun game_controller_event_state = SDL_GameControllerEventState(gamecontroller : GameController*) : Int - fun game_controller_update = SDL_GameControllerUpdate() + fun game_controller_update = SDL_GameControllerUpdate fun game_controller_get_axis_from_string = SDL_GameControllerGetAxisFromString(pchString : Char*) : GameControllerAxis fun game_controller_get_string_for_axis = SDL_GameControllerGetStringForAxis(axis : GameControllerAxis) : Char* diff --git a/src/lib_sdl/hints.cr b/src/lib_sdl/hints.cr index f4e725c..b7cef67 100644 --- a/src/lib_sdl/hints.cr +++ b/src/lib_sdl/hints.cr @@ -1,30 +1,30 @@ lib LibSDL - HINT_FRAMEBUFFER_ACCELERATION = "SDL_FRAMEBUFFER_ACCELERATION" - HINT_RENDER_DRIVER = "SDL_RENDER_DRIVER" - HINT_RENDER_OPENGL_SHADERS = "SDL_RENDER_OPENGL_SHADERS" - HINT_RENDER_DIRECT3D_THREADSAFE = "SDL_RENDER_DIRECT3D_THREADSAFE" - HINT_RENDER_SCALE_QUALITY = "SDL_RENDER_SCALE_QUALITY" - HINT_RENDER_VSYNC = "SDL_RENDER_VSYNC" - HINT_VIDEO_ALLOW_SCREENSAVER = "SDL_VIDEO_ALLOW_SCREENSAVER" - HINT_VIDEO_X11_XVIDMODE = "SDL_VIDEO_X11_XVIDMODE" - HINT_VIDEO_X11_XINERAMA = "SDL_VIDEO_X11_XINERAMA" - HINT_VIDEO_X11_XRANDR = "SDL_VIDEO_X11_XRANDR" - HINT_GRAB_KEYBOARD = "SDL_GRAB_KEYBOARD" - HINT_MOUSE_RELATIVE_MODE_WARP = "SDL_MOUSE_RELATIVE_MODE_WARP" - HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS = "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS" - HINT_IDLE_TIMER_DISABLED = "SDL_IOS_IDLE_TIMER_DISABLED" - HINT_ORIENTATIONS = "SDL_IOS_ORIENTATIONS" - HINT_ACCELEROMETER_AS_JOYSTICK = "SDL_ACCELEROMETER_AS_JOYSTICK" - HINT_XINPUT_ENABLED = "SDL_XINPUT_ENABLED" - HINT_GAMECONTROLLERCONFIG = "SDL_GAMECONTROLLERCONFIG" - HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS = "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" - HINT_ALLOW_TOPMOST = "SDL_ALLOW_TOPMOST" - HINT_TIMER_RESOLUTION = "SDL_TIMER_RESOLUTION" - HINT_VIDEO_HIGHDPI_DISABLED = "SDL_VIDEO_HIGHDPI_DISABLED" + HINT_FRAMEBUFFER_ACCELERATION = "SDL_FRAMEBUFFER_ACCELERATION" + HINT_RENDER_DRIVER = "SDL_RENDER_DRIVER" + HINT_RENDER_OPENGL_SHADERS = "SDL_RENDER_OPENGL_SHADERS" + HINT_RENDER_DIRECT3D_THREADSAFE = "SDL_RENDER_DIRECT3D_THREADSAFE" + HINT_RENDER_SCALE_QUALITY = "SDL_RENDER_SCALE_QUALITY" + HINT_RENDER_VSYNC = "SDL_RENDER_VSYNC" + HINT_VIDEO_ALLOW_SCREENSAVER = "SDL_VIDEO_ALLOW_SCREENSAVER" + HINT_VIDEO_X11_XVIDMODE = "SDL_VIDEO_X11_XVIDMODE" + HINT_VIDEO_X11_XINERAMA = "SDL_VIDEO_X11_XINERAMA" + HINT_VIDEO_X11_XRANDR = "SDL_VIDEO_X11_XRANDR" + HINT_GRAB_KEYBOARD = "SDL_GRAB_KEYBOARD" + HINT_MOUSE_RELATIVE_MODE_WARP = "SDL_MOUSE_RELATIVE_MODE_WARP" + HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS = "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS" + HINT_IDLE_TIMER_DISABLED = "SDL_IOS_IDLE_TIMER_DISABLED" + HINT_ORIENTATIONS = "SDL_IOS_ORIENTATIONS" + HINT_ACCELEROMETER_AS_JOYSTICK = "SDL_ACCELEROMETER_AS_JOYSTICK" + HINT_XINPUT_ENABLED = "SDL_XINPUT_ENABLED" + HINT_GAMECONTROLLERCONFIG = "SDL_GAMECONTROLLERCONFIG" + HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS = "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" + HINT_ALLOW_TOPMOST = "SDL_ALLOW_TOPMOST" + HINT_TIMER_RESOLUTION = "SDL_TIMER_RESOLUTION" + HINT_VIDEO_HIGHDPI_DISABLED = "SDL_VIDEO_HIGHDPI_DISABLED" HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK = "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK" HINT_VIDEO_WIN_D3DCOMPILER = "SDL_VIDEO_WIN_D3DCOMPILER" HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT = "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT" - HINT_VIDEO_MAC_FULLSCREEN_SPACES = "SDL_VIDEO_MAC_FULLSCREEN_SPACES" + HINT_VIDEO_MAC_FULLSCREEN_SPACES = "SDL_VIDEO_MAC_FULLSCREEN_SPACES" enum HintPriority DEFAULT @@ -40,5 +40,5 @@ lib LibSDL fun add_hint_callback = SDL_AddHintCallback(name : Char*, callback : HintCallback*, userdata : Void*) fun del_hint_callback = SDL_DelHintCallback(name : Char*, callback : HintCallback*, userdata : Void*) - fun clear_hints = SDL_ClearHints() + fun clear_hints = SDL_ClearHints end diff --git a/src/lib_sdl/joystick.cr b/src/lib_sdl/joystick.cr index ea81ffa..955cd1e 100644 --- a/src/lib_sdl/joystick.cr +++ b/src/lib_sdl/joystick.cr @@ -16,7 +16,7 @@ lib LibSDL data : UInt8[16] end - fun num_joysticks = SDL_NumJoysticks() : Int + fun num_joysticks = SDL_NumJoysticks : Int fun joystick_name_for_index = SDL_JoystickNameForIndex(device_index : Int) : Char* fun joystick_open = SDL_JoystickOpen(device_index : Int) : Joystick* fun joystick_name = SDL_JoystickName(joystick : Joystick*) : Char* @@ -30,7 +30,7 @@ lib LibSDL fun joystick_num_balls = SDL_JoystickNumBalls(joystick : Joystick*) : Int fun joystick_num_hats = SDL_JoystickNumHats(joystick : Joystick*) : Int fun joystick_num_buttons = SDL_JoystickNumButtons(joystick : Joystick*) : Int - fun joystick_update = SDL_JoystickUpdate() + fun joystick_update = SDL_JoystickUpdate fun joystick_event_state = SDL_JoystickEventState(state : Int) : Int fun joystick_get_axis = SDL_JoystickGetAxis(joystick : Joystick*, axis : Int) : Int16 fun joystick_get_hat = SDL_JoystickGetHat(joystick : Joystick*, hat : Int) : UInt8 diff --git a/src/lib_sdl/keyboard.cr b/src/lib_sdl/keyboard.cr index 84306f1..3aeeb2b 100644 --- a/src/lib_sdl/keyboard.cr +++ b/src/lib_sdl/keyboard.cr @@ -8,20 +8,20 @@ lib LibSDL unused : UInt32 end - fun get_keyboard_focus = SDL_GetKeyboardFocus() : Window* + fun get_keyboard_focus = SDL_GetKeyboardFocus : Window* fun get_keyboard_state = SDL_GetKeyboardState(numkeys : Int*) : UInt8* - fun get_mod_state = SDL_GetModState() : Keymod + fun get_mod_state = SDL_GetModState : Keymod fun set_mod_state = SDL_SetModState(modstate : Keymod) fun get_key_from_scancode = SDL_GetKeyFromScancode(scancode : Scancode) : Keycode fun get_scancode_from_key = SDL_GetScancodeFromKey(key : Keycode) : Scancode fun get_scancode_name = SDL_GetScancodeName(scancode : Scancode) : Char* fun get_scancode_from_name = SDL_GetScancodeFromName(name : Char*) : Scancode - fun get_key_name = SDL_GetKeyName(key : Keycode ) : Char* + fun get_key_name = SDL_GetKeyName(key : Keycode) : Char* fun get_key_from_name = SDL_GetKeyFromName(name : Char*) : Keycode - fun start_text_input = SDL_StartTextInput() - fun is_text_input_active = SDL_IsTextInputActive() : Bool - fun stop_text_input = SDL_StopTextInput() + fun start_text_input = SDL_StartTextInput + fun is_text_input_active = SDL_IsTextInputActive : Bool + fun stop_text_input = SDL_StopTextInput fun set_text_input_rect = SDL_SetTextInputRect(rect : Rect*) - fun has_screen_keywboard_support = SDL_HasScreenKeyboardSupport() : Bool + fun has_screen_keywboard_support = SDL_HasScreenKeyboardSupport : Bool fun is_screen_keyboard_shown = SDL_IsScreenKeyboardShown(window : Window*) : Bool end diff --git a/src/lib_sdl/keycode.cr b/src/lib_sdl/keycode.cr index a1b1a90..774a125 100644 --- a/src/lib_sdl/keycode.cr +++ b/src/lib_sdl/keycode.cr @@ -7,270 +7,270 @@ lib LibSDL enum Keycode : UInt32 UNKNOWN = 0 - RETURN = 13 # '\r' - ESCAPE = 27 # '\033' - BACKSPACE = 8 # '\b' - TAB = 9 # '\t' - SPACE = 32 # ' ' - EXCLAIM = 33 # '!' - QUOTEDBL = 34 # '"' - HASH = 35 #'#' - PERCENT = 37 # '%' - DOLLAR = 38 # '$' - AMPERSAND = 38 # '&' - QUOTE = 39 # '\'' - LEFTPAREN = 40 # '(' + RETURN = 13 # '\r' + ESCAPE = 27 # '\033' + BACKSPACE = 8 # '\b' + TAB = 9 # '\t' + SPACE = 32 # ' ' + EXCLAIM = 33 # '!' + QUOTEDBL = 34 # '"' + HASH = 35 # '#' + PERCENT = 37 # '%' + DOLLAR = 38 # '$' + AMPERSAND = 38 # '&' + QUOTE = 39 # '\'' + LEFTPAREN = 40 # '(' RIGHTPAREN = 41 # ')' - ASTERISK = 42 # '*' - PLUS = 43 # '+' - COMMA = 44 # ',' - MINUS = 45 # '-' - PERIOD = 46 # '.' - SLASH = 47 # '/' - KEY_0 = 48 # '0' - KEY_1 = 49 # '1' - KEY_2 = 50 # '2' - KEY_3 = 51 # '3' - KEY_4 = 52 # '4' - KEY_5 = 53 # '5' - KEY_6 = 54 # '6' - KEY_7 = 55 # '7' - KEY_8 = 56 # '8' - KEY_9 = 57 # '9' - COLON = 58 # ':' - SEMICOLON = 59 # ';' - LESS = 60 # '<' - EQUALS = 61 # '=' - GREATER = 62 # '>' - QUESTION = 63 # '?' - AT = 64 # '@' + ASTERISK = 42 # '*' + PLUS = 43 # '+' + COMMA = 44 # ',' + MINUS = 45 # '-' + PERIOD = 46 # '.' + SLASH = 47 # '/' + KEY_0 = 48 # '0' + KEY_1 = 49 # '1' + KEY_2 = 50 # '2' + KEY_3 = 51 # '3' + KEY_4 = 52 # '4' + KEY_5 = 53 # '5' + KEY_6 = 54 # '6' + KEY_7 = 55 # '7' + KEY_8 = 56 # '8' + KEY_9 = 57 # '9' + COLON = 58 # ':' + SEMICOLON = 59 # ';' + LESS = 60 # '<' + EQUALS = 61 # '=' + GREATER = 62 # '>' + QUESTION = 63 # '?' + AT = 64 # '@' # skip uppercase letters - LEFTBRACKET = 91 # '[' - BACKSLASH = 92 # '\\' - RIGHTBRACKET = 93 # ']' - CARET = 94 # '^' - UNDERSCORE = 95 # '_' - BACKQUOTE = 96 # '`' - A = 97 # 'a' - B = 98 # 'b' - C = 99 # 'c' - D = 100 # 'd' - E = 101 # 'e' - F = 102 # 'f' - G = 103 # 'g' - H = 104 # 'h' - I = 105 # 'i' - J = 106 # 'j' - K = 107 # 'k' - L = 108 # 'l' - M = 109 # 'm' - N = 110 # 'n' - O = 111 # 'o' - P = 112 # 'p' - Q = 113 # 'q' - R = 114 # 'r' - S = 115 # 's' - T = 116 # 't' - U = 117 # 'u' - V = 118 # 'v' - W = 119 # 'w' - X = 120 # 'x' - Y = 121 # 'y' - Z = 122 # 'z' + LEFTBRACKET = 91 # '[' + BACKSLASH = 92 # '\\' + RIGHTBRACKET = 93 # ']' + CARET = 94 # '^' + UNDERSCORE = 95 # '_' + BACKQUOTE = 96 # '`' + A = 97 # 'a' + B = 98 # 'b' + C = 99 # 'c' + D = 100 # 'd' + E = 101 # 'e' + F = 102 # 'f' + G = 103 # 'g' + H = 104 # 'h' + I = 105 # 'i' + J = 106 # 'j' + K = 107 # 'k' + L = 108 # 'l' + M = 109 # 'm' + N = 110 # 'n' + O = 111 # 'o' + P = 112 # 'p' + Q = 113 # 'q' + R = 114 # 'r' + S = 115 # 's' + T = 116 # 't' + U = 117 # 'u' + V = 118 # 'v' + W = 119 # 'w' + X = 120 # 'x' + Y = 121 # 'y' + Z = 122 # 'z' CAPSLOCK = Scancode::CAPSLOCK | SDLK_SCANCODE_MASK - F1 = Scancode::F1 | SDLK_SCANCODE_MASK - F2 = Scancode::F2 | SDLK_SCANCODE_MASK - F3 = Scancode::F3 | SDLK_SCANCODE_MASK - F4 = Scancode::F4 | SDLK_SCANCODE_MASK - F5 = Scancode::F5 | SDLK_SCANCODE_MASK - F6 = Scancode::F6 | SDLK_SCANCODE_MASK - F7 = Scancode::F7 | SDLK_SCANCODE_MASK - F8 = Scancode::F8 | SDLK_SCANCODE_MASK - F9 = Scancode::F9 | SDLK_SCANCODE_MASK + F1 = Scancode::F1 | SDLK_SCANCODE_MASK + F2 = Scancode::F2 | SDLK_SCANCODE_MASK + F3 = Scancode::F3 | SDLK_SCANCODE_MASK + F4 = Scancode::F4 | SDLK_SCANCODE_MASK + F5 = Scancode::F5 | SDLK_SCANCODE_MASK + F6 = Scancode::F6 | SDLK_SCANCODE_MASK + F7 = Scancode::F7 | SDLK_SCANCODE_MASK + F8 = Scancode::F8 | SDLK_SCANCODE_MASK + F9 = Scancode::F9 | SDLK_SCANCODE_MASK F10 = Scancode::F10 | SDLK_SCANCODE_MASK F11 = Scancode::F11 | SDLK_SCANCODE_MASK F12 = Scancode::F12 | SDLK_SCANCODE_MASK PRINTSCREEN = Scancode::PRINTSCREEN | SDLK_SCANCODE_MASK - SCROLLLOCK = Scancode::SCROLLLOCK | SDLK_SCANCODE_MASK - PAUSE = Scancode::PAUSE | SDLK_SCANCODE_MASK - INSERT = Scancode::INSERT | SDLK_SCANCODE_MASK - HOME = Scancode::HOME | SDLK_SCANCODE_MASK - PAGEUP = Scancode::PAGEUP | SDLK_SCANCODE_MASK - DELETE = 127 #'\177' - END = Scancode::END | SDLK_SCANCODE_MASK - PAGEDOWN = Scancode::PAGEDOWN | SDLK_SCANCODE_MASK - RIGHT = Scancode::RIGHT | SDLK_SCANCODE_MASK - LEFT = Scancode::LEFT | SDLK_SCANCODE_MASK - DOWN = Scancode::DOWN | SDLK_SCANCODE_MASK - UP = Scancode::UP | SDLK_SCANCODE_MASK + SCROLLLOCK = Scancode::SCROLLLOCK | SDLK_SCANCODE_MASK + PAUSE = Scancode::PAUSE | SDLK_SCANCODE_MASK + INSERT = Scancode::INSERT | SDLK_SCANCODE_MASK + HOME = Scancode::HOME | SDLK_SCANCODE_MASK + PAGEUP = Scancode::PAGEUP | SDLK_SCANCODE_MASK + DELETE = 127 # '\177' + END = Scancode::END | SDLK_SCANCODE_MASK + PAGEDOWN = Scancode::PAGEDOWN | SDLK_SCANCODE_MASK + RIGHT = Scancode::RIGHT | SDLK_SCANCODE_MASK + LEFT = Scancode::LEFT | SDLK_SCANCODE_MASK + DOWN = Scancode::DOWN | SDLK_SCANCODE_MASK + UP = Scancode::UP | SDLK_SCANCODE_MASK NUMLOCKCLEAR = Scancode::NUMLOCKCLEAR | SDLK_SCANCODE_MASK - KP_DIVIDE = Scancode::KP_DIVIDE | SDLK_SCANCODE_MASK - KP_MULTIPLY = Scancode::KP_MULTIPLY | SDLK_SCANCODE_MASK - KP_MINUS = Scancode::KP_MINUS | SDLK_SCANCODE_MASK - KP_PLUS = Scancode::KP_PLUS | SDLK_SCANCODE_MASK - KP_ENTER = Scancode::KP_ENTER | SDLK_SCANCODE_MASK - KP_1 = Scancode::KP_1 | SDLK_SCANCODE_MASK - KP_2 = Scancode::KP_2 | SDLK_SCANCODE_MASK - KP_3 = Scancode::KP_3 | SDLK_SCANCODE_MASK - KP_4 = Scancode::KP_4 | SDLK_SCANCODE_MASK - KP_5 = Scancode::KP_5 | SDLK_SCANCODE_MASK - KP_6 = Scancode::KP_6 | SDLK_SCANCODE_MASK - KP_7 = Scancode::KP_7 | SDLK_SCANCODE_MASK - KP_8 = Scancode::KP_8 | SDLK_SCANCODE_MASK - KP_9 = Scancode::KP_9 | SDLK_SCANCODE_MASK - KP_0 = Scancode::KP_0 | SDLK_SCANCODE_MASK - KP_PERIOD = Scancode::KP_PERIOD | SDLK_SCANCODE_MASK + KP_DIVIDE = Scancode::KP_DIVIDE | SDLK_SCANCODE_MASK + KP_MULTIPLY = Scancode::KP_MULTIPLY | SDLK_SCANCODE_MASK + KP_MINUS = Scancode::KP_MINUS | SDLK_SCANCODE_MASK + KP_PLUS = Scancode::KP_PLUS | SDLK_SCANCODE_MASK + KP_ENTER = Scancode::KP_ENTER | SDLK_SCANCODE_MASK + KP_1 = Scancode::KP_1 | SDLK_SCANCODE_MASK + KP_2 = Scancode::KP_2 | SDLK_SCANCODE_MASK + KP_3 = Scancode::KP_3 | SDLK_SCANCODE_MASK + KP_4 = Scancode::KP_4 | SDLK_SCANCODE_MASK + KP_5 = Scancode::KP_5 | SDLK_SCANCODE_MASK + KP_6 = Scancode::KP_6 | SDLK_SCANCODE_MASK + KP_7 = Scancode::KP_7 | SDLK_SCANCODE_MASK + KP_8 = Scancode::KP_8 | SDLK_SCANCODE_MASK + KP_9 = Scancode::KP_9 | SDLK_SCANCODE_MASK + KP_0 = Scancode::KP_0 | SDLK_SCANCODE_MASK + KP_PERIOD = Scancode::KP_PERIOD | SDLK_SCANCODE_MASK - APPLICATION = Scancode::APPLICATION | SDLK_SCANCODE_MASK - POWER = Scancode::POWER | SDLK_SCANCODE_MASK - KP_EQUALS = Scancode::KP_EQUALS | SDLK_SCANCODE_MASK - F13 = Scancode::F13 | SDLK_SCANCODE_MASK - F14 = Scancode::F14 | SDLK_SCANCODE_MASK - F15 = Scancode::F15 | SDLK_SCANCODE_MASK - F16 = Scancode::F16 | SDLK_SCANCODE_MASK - F17 = Scancode::F17 | SDLK_SCANCODE_MASK - F18 = Scancode::F18 | SDLK_SCANCODE_MASK - F19 = Scancode::F19 | SDLK_SCANCODE_MASK - F20 = Scancode::F20 | SDLK_SCANCODE_MASK - F21 = Scancode::F21 | SDLK_SCANCODE_MASK - F22 = Scancode::F22 | SDLK_SCANCODE_MASK - F23 = Scancode::F23 | SDLK_SCANCODE_MASK - F24 = Scancode::F24 | SDLK_SCANCODE_MASK - EXECUTE = Scancode::EXECUTE | SDLK_SCANCODE_MASK - HELP = Scancode::HELP | SDLK_SCANCODE_MASK - MENU = Scancode::MENU | SDLK_SCANCODE_MASK - SELECT = Scancode::SELECT | SDLK_SCANCODE_MASK - STOP = Scancode::STOP | SDLK_SCANCODE_MASK - AGAIN = Scancode::AGAIN | SDLK_SCANCODE_MASK - UNDO = Scancode::UNDO | SDLK_SCANCODE_MASK - CUT = Scancode::CUT | SDLK_SCANCODE_MASK - COPY = Scancode::COPY | SDLK_SCANCODE_MASK - PASTE = Scancode::PASTE | SDLK_SCANCODE_MASK - FIND = Scancode::FIND | SDLK_SCANCODE_MASK - MUTE = Scancode::MUTE | SDLK_SCANCODE_MASK - VOLUMEUP = Scancode::VOLUMEUP | SDLK_SCANCODE_MASK - VOLUMEDOWN = Scancode::VOLUMEDOWN | SDLK_SCANCODE_MASK - KP_COMMA = Scancode::KP_COMMA | SDLK_SCANCODE_MASK + APPLICATION = Scancode::APPLICATION | SDLK_SCANCODE_MASK + POWER = Scancode::POWER | SDLK_SCANCODE_MASK + KP_EQUALS = Scancode::KP_EQUALS | SDLK_SCANCODE_MASK + F13 = Scancode::F13 | SDLK_SCANCODE_MASK + F14 = Scancode::F14 | SDLK_SCANCODE_MASK + F15 = Scancode::F15 | SDLK_SCANCODE_MASK + F16 = Scancode::F16 | SDLK_SCANCODE_MASK + F17 = Scancode::F17 | SDLK_SCANCODE_MASK + F18 = Scancode::F18 | SDLK_SCANCODE_MASK + F19 = Scancode::F19 | SDLK_SCANCODE_MASK + F20 = Scancode::F20 | SDLK_SCANCODE_MASK + F21 = Scancode::F21 | SDLK_SCANCODE_MASK + F22 = Scancode::F22 | SDLK_SCANCODE_MASK + F23 = Scancode::F23 | SDLK_SCANCODE_MASK + F24 = Scancode::F24 | SDLK_SCANCODE_MASK + EXECUTE = Scancode::EXECUTE | SDLK_SCANCODE_MASK + HELP = Scancode::HELP | SDLK_SCANCODE_MASK + MENU = Scancode::MENU | SDLK_SCANCODE_MASK + SELECT = Scancode::SELECT | SDLK_SCANCODE_MASK + STOP = Scancode::STOP | SDLK_SCANCODE_MASK + AGAIN = Scancode::AGAIN | SDLK_SCANCODE_MASK + UNDO = Scancode::UNDO | SDLK_SCANCODE_MASK + CUT = Scancode::CUT | SDLK_SCANCODE_MASK + COPY = Scancode::COPY | SDLK_SCANCODE_MASK + PASTE = Scancode::PASTE | SDLK_SCANCODE_MASK + FIND = Scancode::FIND | SDLK_SCANCODE_MASK + MUTE = Scancode::MUTE | SDLK_SCANCODE_MASK + VOLUMEUP = Scancode::VOLUMEUP | SDLK_SCANCODE_MASK + VOLUMEDOWN = Scancode::VOLUMEDOWN | SDLK_SCANCODE_MASK + KP_COMMA = Scancode::KP_COMMA | SDLK_SCANCODE_MASK KP_EQUALSAS400 = Scancode::KP_EQUALSAS400 | SDLK_SCANCODE_MASK - ALTERASE = Scancode::ALTERASE | SDLK_SCANCODE_MASK - SYSREQ = Scancode::SYSREQ | SDLK_SCANCODE_MASK - CANCEL = Scancode::CANCEL | SDLK_SCANCODE_MASK - CLEAR = Scancode::CLEAR | SDLK_SCANCODE_MASK - PRIOR = Scancode::PRIOR | SDLK_SCANCODE_MASK - RETURN2 = Scancode::RETURN2 | SDLK_SCANCODE_MASK - SEPARATOR = Scancode::SEPARATOR | SDLK_SCANCODE_MASK - OUT = Scancode::OUT | SDLK_SCANCODE_MASK - OPER = Scancode::OPER | SDLK_SCANCODE_MASK + ALTERASE = Scancode::ALTERASE | SDLK_SCANCODE_MASK + SYSREQ = Scancode::SYSREQ | SDLK_SCANCODE_MASK + CANCEL = Scancode::CANCEL | SDLK_SCANCODE_MASK + CLEAR = Scancode::CLEAR | SDLK_SCANCODE_MASK + PRIOR = Scancode::PRIOR | SDLK_SCANCODE_MASK + RETURN2 = Scancode::RETURN2 | SDLK_SCANCODE_MASK + SEPARATOR = Scancode::SEPARATOR | SDLK_SCANCODE_MASK + OUT = Scancode::OUT | SDLK_SCANCODE_MASK + OPER = Scancode::OPER | SDLK_SCANCODE_MASK CLEARAGAIN = Scancode::CLEARAGAIN | SDLK_SCANCODE_MASK - CRSEL = Scancode::CRSEL | SDLK_SCANCODE_MASK - EXSEL = Scancode::EXSEL | SDLK_SCANCODE_MASK + CRSEL = Scancode::CRSEL | SDLK_SCANCODE_MASK + EXSEL = Scancode::EXSEL | SDLK_SCANCODE_MASK - KP_00 = Scancode::KP_00 | SDLK_SCANCODE_MASK - KP_000 = Scancode::KP_000 | SDLK_SCANCODE_MASK + KP_00 = Scancode::KP_00 | SDLK_SCANCODE_MASK + KP_000 = Scancode::KP_000 | SDLK_SCANCODE_MASK THOUSANDSSEPARATOR = Scancode::THOUSANDSSEPARATOR | SDLK_SCANCODE_MASK - DECIMALSEPARATOR = Scancode::DECIMALSEPARATOR | SDLK_SCANCODE_MASK - CURRENCYUNIT = Scancode::CURRENCYUNIT | SDLK_SCANCODE_MASK - CURRENCYSUBUNIT = Scancode::CURRENCYSUBUNIT | SDLK_SCANCODE_MASK - KP_LEFTPAREN = Scancode::KP_LEFTPAREN | SDLK_SCANCODE_MASK - KP_RIGHTPAREN = Scancode::KP_RIGHTPAREN | SDLK_SCANCODE_MASK - KP_LEFTBRACE = Scancode::KP_LEFTBRACE | SDLK_SCANCODE_MASK - KP_RIGHTBRACE = Scancode::KP_RIGHTBRACE | SDLK_SCANCODE_MASK - KP_TAB = Scancode::KP_TAB | SDLK_SCANCODE_MASK - KP_BACKSPACE = Scancode::KP_BACKSPACE | SDLK_SCANCODE_MASK - KP_A = Scancode::KP_A | SDLK_SCANCODE_MASK - KP_B = Scancode::KP_B | SDLK_SCANCODE_MASK - KP_C = Scancode::KP_C | SDLK_SCANCODE_MASK - KP_D = Scancode::KP_D | SDLK_SCANCODE_MASK - KP_E = Scancode::KP_E | SDLK_SCANCODE_MASK - KP_F = Scancode::KP_F | SDLK_SCANCODE_MASK - KP_XOR = Scancode::KP_XOR | SDLK_SCANCODE_MASK - KP_POWER = Scancode::KP_POWER | SDLK_SCANCODE_MASK - KP_PERCENT = Scancode::KP_PERCENT | SDLK_SCANCODE_MASK - KP_LESS = Scancode::KP_LESS | SDLK_SCANCODE_MASK - KP_GREATER = Scancode::KP_GREATER | SDLK_SCANCODE_MASK - KP_AMPERSAND = Scancode::KP_AMPERSAND | SDLK_SCANCODE_MASK - KP_DBLAMPERSAND = Scancode::KP_DBLAMPERSAND | SDLK_SCANCODE_MASK - KP_VERTICALBAR = Scancode::KP_VERTICALBAR | SDLK_SCANCODE_MASK - KP_DBLVERTICALBAR = Scancode::KP_DBLVERTICALBAR | SDLK_SCANCODE_MASK - KP_COLON = Scancode::KP_COLON | SDLK_SCANCODE_MASK - KP_HASH = Scancode::KP_HASH | SDLK_SCANCODE_MASK - KP_SPACE = Scancode::KP_SPACE | SDLK_SCANCODE_MASK - KP_AT = Scancode::KP_AT | SDLK_SCANCODE_MASK - KP_EXCLAM = Scancode::KP_EXCLAM | SDLK_SCANCODE_MASK - KP_MEMSTORE = Scancode::KP_MEMSTORE | SDLK_SCANCODE_MASK - KP_MEMRECALL = Scancode::KP_MEMRECALL | SDLK_SCANCODE_MASK - KP_MEMCLEAR = Scancode::KP_MEMCLEAR | SDLK_SCANCODE_MASK - KP_MEMADD = Scancode::KP_MEMADD | SDLK_SCANCODE_MASK - KP_MEMSUBTRACT = Scancode::KP_MEMSUBTRACT | SDLK_SCANCODE_MASK - KP_MEMMULTIPLY = Scancode::KP_MEMMULTIPLY | SDLK_SCANCODE_MASK - KP_MEMDIVIDE = Scancode::KP_MEMDIVIDE | SDLK_SCANCODE_MASK - KP_PLUSMINUS = Scancode::KP_PLUSMINUS | SDLK_SCANCODE_MASK - KP_CLEAR = Scancode::KP_CLEAR | SDLK_SCANCODE_MASK - KP_CLEARENTRY = Scancode::KP_CLEARENTRY | SDLK_SCANCODE_MASK - KP_BINARY = Scancode::KP_BINARY | SDLK_SCANCODE_MASK - KP_OCTAL = Scancode::KP_OCTAL | SDLK_SCANCODE_MASK - KP_DECIMAL = Scancode::KP_DECIMAL | SDLK_SCANCODE_MASK - KP_HEXADECIMAL = Scancode::KP_HEXADECIMAL | SDLK_SCANCODE_MASK + DECIMALSEPARATOR = Scancode::DECIMALSEPARATOR | SDLK_SCANCODE_MASK + CURRENCYUNIT = Scancode::CURRENCYUNIT | SDLK_SCANCODE_MASK + CURRENCYSUBUNIT = Scancode::CURRENCYSUBUNIT | SDLK_SCANCODE_MASK + KP_LEFTPAREN = Scancode::KP_LEFTPAREN | SDLK_SCANCODE_MASK + KP_RIGHTPAREN = Scancode::KP_RIGHTPAREN | SDLK_SCANCODE_MASK + KP_LEFTBRACE = Scancode::KP_LEFTBRACE | SDLK_SCANCODE_MASK + KP_RIGHTBRACE = Scancode::KP_RIGHTBRACE | SDLK_SCANCODE_MASK + KP_TAB = Scancode::KP_TAB | SDLK_SCANCODE_MASK + KP_BACKSPACE = Scancode::KP_BACKSPACE | SDLK_SCANCODE_MASK + KP_A = Scancode::KP_A | SDLK_SCANCODE_MASK + KP_B = Scancode::KP_B | SDLK_SCANCODE_MASK + KP_C = Scancode::KP_C | SDLK_SCANCODE_MASK + KP_D = Scancode::KP_D | SDLK_SCANCODE_MASK + KP_E = Scancode::KP_E | SDLK_SCANCODE_MASK + KP_F = Scancode::KP_F | SDLK_SCANCODE_MASK + KP_XOR = Scancode::KP_XOR | SDLK_SCANCODE_MASK + KP_POWER = Scancode::KP_POWER | SDLK_SCANCODE_MASK + KP_PERCENT = Scancode::KP_PERCENT | SDLK_SCANCODE_MASK + KP_LESS = Scancode::KP_LESS | SDLK_SCANCODE_MASK + KP_GREATER = Scancode::KP_GREATER | SDLK_SCANCODE_MASK + KP_AMPERSAND = Scancode::KP_AMPERSAND | SDLK_SCANCODE_MASK + KP_DBLAMPERSAND = Scancode::KP_DBLAMPERSAND | SDLK_SCANCODE_MASK + KP_VERTICALBAR = Scancode::KP_VERTICALBAR | SDLK_SCANCODE_MASK + KP_DBLVERTICALBAR = Scancode::KP_DBLVERTICALBAR | SDLK_SCANCODE_MASK + KP_COLON = Scancode::KP_COLON | SDLK_SCANCODE_MASK + KP_HASH = Scancode::KP_HASH | SDLK_SCANCODE_MASK + KP_SPACE = Scancode::KP_SPACE | SDLK_SCANCODE_MASK + KP_AT = Scancode::KP_AT | SDLK_SCANCODE_MASK + KP_EXCLAM = Scancode::KP_EXCLAM | SDLK_SCANCODE_MASK + KP_MEMSTORE = Scancode::KP_MEMSTORE | SDLK_SCANCODE_MASK + KP_MEMRECALL = Scancode::KP_MEMRECALL | SDLK_SCANCODE_MASK + KP_MEMCLEAR = Scancode::KP_MEMCLEAR | SDLK_SCANCODE_MASK + KP_MEMADD = Scancode::KP_MEMADD | SDLK_SCANCODE_MASK + KP_MEMSUBTRACT = Scancode::KP_MEMSUBTRACT | SDLK_SCANCODE_MASK + KP_MEMMULTIPLY = Scancode::KP_MEMMULTIPLY | SDLK_SCANCODE_MASK + KP_MEMDIVIDE = Scancode::KP_MEMDIVIDE | SDLK_SCANCODE_MASK + KP_PLUSMINUS = Scancode::KP_PLUSMINUS | SDLK_SCANCODE_MASK + KP_CLEAR = Scancode::KP_CLEAR | SDLK_SCANCODE_MASK + KP_CLEARENTRY = Scancode::KP_CLEARENTRY | SDLK_SCANCODE_MASK + KP_BINARY = Scancode::KP_BINARY | SDLK_SCANCODE_MASK + KP_OCTAL = Scancode::KP_OCTAL | SDLK_SCANCODE_MASK + KP_DECIMAL = Scancode::KP_DECIMAL | SDLK_SCANCODE_MASK + KP_HEXADECIMAL = Scancode::KP_HEXADECIMAL | SDLK_SCANCODE_MASK - LCTRL = Scancode::LCTRL | SDLK_SCANCODE_MASK + LCTRL = Scancode::LCTRL | SDLK_SCANCODE_MASK LSHIFT = Scancode::LSHIFT | SDLK_SCANCODE_MASK - LALT = Scancode::LALT | SDLK_SCANCODE_MASK - LGUI = Scancode::LGUI | SDLK_SCANCODE_MASK - RCTRL = Scancode::RCTRL | SDLK_SCANCODE_MASK + LALT = Scancode::LALT | SDLK_SCANCODE_MASK + LGUI = Scancode::LGUI | SDLK_SCANCODE_MASK + RCTRL = Scancode::RCTRL | SDLK_SCANCODE_MASK RSHIFT = Scancode::RSHIFT | SDLK_SCANCODE_MASK - RALT = Scancode::RALT | SDLK_SCANCODE_MASK - RGUI = Scancode::RGUI | SDLK_SCANCODE_MASK + RALT = Scancode::RALT | SDLK_SCANCODE_MASK + RGUI = Scancode::RGUI | SDLK_SCANCODE_MASK MODE = Scancode::MODE | SDLK_SCANCODE_MASK - AUDIONEXT = Scancode::AUDIONEXT | SDLK_SCANCODE_MASK - AUDIOPREV = Scancode::AUDIOPREV | SDLK_SCANCODE_MASK - AUDIOSTOP = Scancode::AUDIOSTOP | SDLK_SCANCODE_MASK - AUDIOPLAY = Scancode::AUDIOPLAY | SDLK_SCANCODE_MASK - AUDIOMUTE = Scancode::AUDIOMUTE | SDLK_SCANCODE_MASK - MEDIASELECT = Scancode::MEDIASELECT | SDLK_SCANCODE_MASK - WWW = Scancode::WWW | SDLK_SCANCODE_MASK - MAIL = Scancode::MAIL | SDLK_SCANCODE_MASK - CALCULATOR = Scancode::CALCULATOR | SDLK_SCANCODE_MASK - COMPUTER = Scancode::COMPUTER | SDLK_SCANCODE_MASK - AC_SEARCH = Scancode::AC_SEARCH | SDLK_SCANCODE_MASK - AC_HOME = Scancode::AC_HOME | SDLK_SCANCODE_MASK - AC_BACK = Scancode::AC_BACK | SDLK_SCANCODE_MASK - AC_FORWARD = Scancode::AC_FORWARD | SDLK_SCANCODE_MASK - AC_STOP = Scancode::AC_STOP | SDLK_SCANCODE_MASK - AC_REFRESH = Scancode::AC_REFRESH | SDLK_SCANCODE_MASK + AUDIONEXT = Scancode::AUDIONEXT | SDLK_SCANCODE_MASK + AUDIOPREV = Scancode::AUDIOPREV | SDLK_SCANCODE_MASK + AUDIOSTOP = Scancode::AUDIOSTOP | SDLK_SCANCODE_MASK + AUDIOPLAY = Scancode::AUDIOPLAY | SDLK_SCANCODE_MASK + AUDIOMUTE = Scancode::AUDIOMUTE | SDLK_SCANCODE_MASK + MEDIASELECT = Scancode::MEDIASELECT | SDLK_SCANCODE_MASK + WWW = Scancode::WWW | SDLK_SCANCODE_MASK + MAIL = Scancode::MAIL | SDLK_SCANCODE_MASK + CALCULATOR = Scancode::CALCULATOR | SDLK_SCANCODE_MASK + COMPUTER = Scancode::COMPUTER | SDLK_SCANCODE_MASK + AC_SEARCH = Scancode::AC_SEARCH | SDLK_SCANCODE_MASK + AC_HOME = Scancode::AC_HOME | SDLK_SCANCODE_MASK + AC_BACK = Scancode::AC_BACK | SDLK_SCANCODE_MASK + AC_FORWARD = Scancode::AC_FORWARD | SDLK_SCANCODE_MASK + AC_STOP = Scancode::AC_STOP | SDLK_SCANCODE_MASK + AC_REFRESH = Scancode::AC_REFRESH | SDLK_SCANCODE_MASK AC_BOOKMARKS = Scancode::AC_BOOKMARKS | SDLK_SCANCODE_MASK BRIGHTNESSDOWN = Scancode::BRIGHTNESSDOWN | SDLK_SCANCODE_MASK - BRIGHTNESSUP = Scancode::BRIGHTNESSUP | SDLK_SCANCODE_MASK - DISPLAYSWITCH = Scancode::DISPLAYSWITCH | SDLK_SCANCODE_MASK + BRIGHTNESSUP = Scancode::BRIGHTNESSUP | SDLK_SCANCODE_MASK + DISPLAYSWITCH = Scancode::DISPLAYSWITCH | SDLK_SCANCODE_MASK KBDILLUMTOGGLE = Scancode::KBDILLUMTOGGLE | SDLK_SCANCODE_MASK - KBDILLUMDOWN = Scancode::KBDILLUMDOWN | SDLK_SCANCODE_MASK - KBDILLUMUP = Scancode::KBDILLUMUP | SDLK_SCANCODE_MASK - EJECT = Scancode::EJECT | SDLK_SCANCODE_MASK - SLEEP = Scancode::SLEEP | SDLK_SCANCODE_MASK + KBDILLUMDOWN = Scancode::KBDILLUMDOWN | SDLK_SCANCODE_MASK + KBDILLUMUP = Scancode::KBDILLUMUP | SDLK_SCANCODE_MASK + EJECT = Scancode::EJECT | SDLK_SCANCODE_MASK + SLEEP = Scancode::SLEEP | SDLK_SCANCODE_MASK end enum Keymod : UInt16 - NONE = 0x0000 - LSHIFT = 0x0001 - RSHIFT = 0x0002 - LCTRL = 0x0040 - RCTRL = 0x0080 - LALT = 0x0100 - RALT = 0x0200 - LGUI = 0x0400 - RGUI = 0x0800 - NUM = 0x1000 - CAPS = 0x2000 - MODE = 0x4000 + NONE = 0x0000 + LSHIFT = 0x0001 + RSHIFT = 0x0002 + LCTRL = 0x0040 + RCTRL = 0x0080 + LALT = 0x0100 + RALT = 0x0200 + LGUI = 0x0400 + RGUI = 0x0800 + NUM = 0x1000 + CAPS = 0x2000 + MODE = 0x4000 RESERVED = 0x8000 CTRL = LCTRL | RCTRL diff --git a/src/lib_sdl/main.cr b/src/lib_sdl/main.cr index 267c121..a06cf95 100644 --- a/src/lib_sdl/main.cr +++ b/src/lib_sdl/main.cr @@ -7,7 +7,7 @@ lib LibSDL end {% end %} - fun set_main_ready = SDL_SetMainReady() + fun set_main_ready = SDL_SetMainReady {% if flag?(:windows) %} fun SDL_RegisterApp(name : Char*, style : UInt32, hInst : Void*) : Int diff --git a/src/lib_sdl/messagebox.cr b/src/lib_sdl/messagebox.cr index 8a20df3..3994c00 100644 --- a/src/lib_sdl/messagebox.cr +++ b/src/lib_sdl/messagebox.cr @@ -1,8 +1,8 @@ lib LibSDL enum MessageBoxFlags : UInt32 - ERROR = 0x00000010 - WARNING = 0x00000020 - INFORMATION = 0x00000040 + ERROR = 0x00000010 + WARNING = 0x00000020 + INFORMATION = 0x00000040 end enum MessageBoxButtonFlags : UInt32 @@ -16,7 +16,7 @@ lib LibSDL text : Char* end - struct MessageBoxColor + struct MessageBoxColor r : UInt8 g : UInt8 b : UInt8 diff --git a/src/lib_sdl/mouse.cr b/src/lib_sdl/mouse.cr index 5c2993d..443c629 100644 --- a/src/lib_sdl/mouse.cr +++ b/src/lib_sdl/mouse.cr @@ -29,18 +29,18 @@ lib LibSDL BUTTON_X1MASK = 1 << (BUTTON_X1 - 1) BUTTON_X2MASK = 1 << (BUTTON_X2 - 1) - fun get_mouse_focus = SDL_GetMouseFocus() : Window* + fun get_mouse_focus = SDL_GetMouseFocus : Window* fun get_mouse_state = SDL_GetMouseState(x : Int, y : Int) : UInt32 fun get_relative_mouse_state = SDL_GetRelativeMouseState(x : Int*, y : Int*) : UInt32 fun warp_mouse_in_window = SDL_WarpMouseInWindow(window : Window*, x : Int, y : Int) fun set_relative_mouse_mode = SDL_SetRelativeMouseMode(enabled : Bool) : Int - fun get_relative_mouse_mode = SDL_GetRelativeMouseMode() : Bool + fun get_relative_mouse_mode = SDL_GetRelativeMouseMode : Bool fun create_cursor = SDL_CreateCursor(data : UInt8*, mask : UInt8*, w : Int, h : Int, hot_x : Int, hot_y : Int) : Cursor* fun create_color_cursor = SDL_CreateColorCursor(surface : Surface*, hot_x : Int, hot_y : Int) : Cursor* fun create_system_cursor = SDL_CreateSystemCursor(id : SystemCursor) : Cursor* fun set_cursor = SDL_SetCursor(cursor : Cursor*) - fun get_cursor = SDL_GetCursor() : Cursor* - fun get_default_cursor = SDL_GetDefaultCursor() : Cursor* + fun get_cursor = SDL_GetCursor : Cursor* + fun get_default_cursor = SDL_GetDefaultCursor : Cursor* fun free_cursor = SDL_FreeCursor(cursor : Cursor*) fun show_cursor = SDL_ShowCursor(toggle : Int) : Int end diff --git a/src/lib_sdl/pixels.cr b/src/lib_sdl/pixels.cr index 8dda498..fdfc3ec 100644 --- a/src/lib_sdl/pixels.cr +++ b/src/lib_sdl/pixels.cr @@ -1,6 +1,6 @@ lib LibSDL - ALPHA_OPAQUE = 255 - ALPHA_TRANSPARENT = 0 + ALPHA_OPAQUE = 255 + ALPHA_TRANSPARENT = 0 enum PixelType UNKNOWN @@ -57,18 +57,18 @@ lib LibSDL L1010102 end - #macro DEFINE_PIXELFOURCC(A, B, C, D) + # macro DEFINE_PIXELFOURCC(A, B, C, D) # {{A}}.to_u32 << 0 | # {{B}}.to_u32 << 8 | # {{C}}.to_u32 << 16 | # {{D}}.to_u32 << 24 - #end + # end - #macro DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) + # macro DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) # ((1 << 28) | ({{type}} << 24) | ({{order}} << 20) | ({{layout}} << 16) | ({{bits}} << 8) | ({{bytes}} << 0)) - #end + # end - #enum PixelFormatEnum : UInt32 + # enum PixelFormatEnum : UInt32 # UNKNOWN # INDEX1LSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0, 1, 0) # INDEX1MSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0, 1, 0) @@ -105,7 +105,7 @@ lib LibSDL # YUY2 = SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2') # UYVY = SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y') # YVYU = SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U') - #end + # end alias Color = SDL::Color @@ -126,10 +126,10 @@ lib LibSDL g_mask : UInt32 b_mask : UInt32 a_mask : UInt32 - r_loss : UInt8 - g_loss : UInt8 - b_loss : UInt8 - a_loss : UInt8 + r_loss : UInt8 + g_loss : UInt8 + b_loss : UInt8 + a_loss : UInt8 r_shift : UInt8 g_shift : UInt8 b_shift : UInt8 diff --git a/src/lib_sdl/render.cr b/src/lib_sdl/render.cr index a241e28..ba9927c 100644 --- a/src/lib_sdl/render.cr +++ b/src/lib_sdl/render.cr @@ -4,9 +4,9 @@ require "./blend_mode" lib LibSDL enum RendererFlags : UInt32 - SOFTWARE = 0x00000001 - ACCELERATED = 0x00000002 - PRESENTVSYNC = 0x00000004 + SOFTWARE = 0x00000001 + ACCELERATED = 0x00000002 + PRESENTVSYNC = 0x00000004 TARGETTEXTURE = 0x00000008 end @@ -26,21 +26,21 @@ lib LibSDL end enum TextureModulate : UInt32 - NONE = 0x00000000 + NONE = 0x00000000 COLOR = 0x00000001 ALPHA = 0x00000002 end enum RendererFlip : UInt32 - NONE = 0x00000000 + NONE = 0x00000000 HORIZONTAL = 0x00000001 - VERTICAL = 0x00000002 + VERTICAL = 0x00000002 end type Renderer = Void type Texture = Void - fun get_num_render_drivers = SDL_GetNumRenderDrivers() : Int + fun get_num_render_drivers = SDL_GetNumRenderDrivers : Int fun get_render_driver_info = SDL_GetRenderDriverInfo(index : Int, info : RendererInfo*) : Int fun create_window_and_renderer = SDL_CreateWindowAndRenderer(width : Int, height : Int, window_flags : UInt32, window : Window**, renderer : Renderer**) : Int fun create_renderer = SDL_CreateRenderer(window : Window*, index : Int, flags : UInt32) : Renderer* @@ -80,7 +80,7 @@ lib LibSDL fun render_draw_point = SDL_RenderDrawPoint(renderer : Renderer*, x : Int, y : Int) : Int fun render_draw_points = SDL_RenderDrawPoints(renderer : Renderer*, points : Point*, count : Int) : Int fun render_draw_line = SDL_RenderDrawLine(renderer : Renderer*, x1 : Int, y1 : Int, x2 : Int, y2 : Int) : Int - fun render_draw_lines = SDL_RenderDrawLines(renderer : Renderer*, points : Point*, count : Int): Int + fun render_draw_lines = SDL_RenderDrawLines(renderer : Renderer*, points : Point*, count : Int) : Int fun render_draw_rect = SDL_RenderDrawRect(renderer : Renderer*, rect : Rect*) : Int fun render_draw_rects = SDL_RenderDrawRects(renderer : Renderer*, rects : Rect*, count : Int) : Int fun render_fill_rect = SDL_RenderFillRect(renderer : Renderer*, rect : Rect*) : Int diff --git a/src/lib_sdl/rwops.cr b/src/lib_sdl/rwops.cr index 7f6cbe8..92d8af1 100644 --- a/src/lib_sdl/rwops.cr +++ b/src/lib_sdl/rwops.cr @@ -10,7 +10,7 @@ lib LibSDL RW_SEEK_CUR = 1 # Seek relative to current read point RW_SEEK_END = 2 # Seek relative to the end of data - #{% if flag?(:android) %} + # {% if flag?(:android) %} # struct RWops_androidio # fileNameRef : Void* # inputStreamRef : Void* @@ -21,9 +21,9 @@ lib LibSDL # offset : Long* # fd : Int # end - #{% end %} + # {% end %} - #{% if flag?(:windows) %} + # {% if flag?(:windows) %} # struct RWops_windowsio # append : Int # h : Void* @@ -31,12 +31,12 @@ lib LibSDL # buffer_size : Int # buffer_left : Int # end - #{% else %} + # {% else %} # struct RWops_stdio # autoclose : Int # fp : Void* # FILE* # end - #{% end %} + # {% end %} struct RWops_mem base : UInt8* @@ -50,15 +50,15 @@ lib LibSDL end union RWops_hidden - #{% if flag?(:android) %} + # {% if flag?(:android) %} # androidio : RWops_androidio - #{% end %} + # {% end %} - #{% if flag?(:windows) %} + # {% if flag?(:windows) %} # windowsio : RWops_windowsio - #{% else %} + # {% else %} # stdio : RWops_stdio - #{% end %} + # {% end %} mem : RWops_mem unknown : RWops_unknown @@ -85,7 +85,7 @@ lib LibSDL fun rw_from_mem = SDL_RWFromMem(mem : Void*, size : Int) : RWops* fun rw_from_const_mem = SDL_RWFromConstMem(mem : Void*, size : Int) : RWops* - fun alloc_rw = SDL_AllocRW() : RWops* + fun alloc_rw = SDL_AllocRW : RWops* fun free_rw = SDL_FreeRW(area : RWops*) # SDL_RWsize(ctx) (ctx)->size(ctx) @@ -95,12 +95,12 @@ lib LibSDL # SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) # SDL_RWclose(ctx) (ctx)->close(ctx) - fun read_le16 = SDL_ReadLE16(src : RWops*); - fun read_be16 = SDL_ReadBE16(src : RWops*); - fun read_le32 = SDL_ReadLE32(src : RWops*); - fun read_be32 = SDL_ReadBE32(src : RWops*); - fun read_le64 = SDL_ReadLE64(src : RWops*); - fun read_be64 = SDL_ReadBE64(src : RWops*); + fun read_le16 = SDL_ReadLE16(src : RWops*) + fun read_be16 = SDL_ReadBE16(src : RWops*) + fun read_le32 = SDL_ReadLE32(src : RWops*) + fun read_be32 = SDL_ReadBE32(src : RWops*) + fun read_le64 = SDL_ReadLE64(src : RWops*) + fun read_be64 = SDL_ReadBE64(src : RWops*) fun write_le16 = SDL_WriteLE16(dst : RWops*, value : UInt16) fun write_be16 = SDL_WriteBE16(dst : RWops*, value : UInt16) diff --git a/src/lib_sdl/scancode.cr b/src/lib_sdl/scancode.cr index dfd03fa..8ded0d2 100644 --- a/src/lib_sdl/scancode.cr +++ b/src/lib_sdl/scancode.cr @@ -4,12 +4,12 @@ lib LibSDL # Usage page 0x07 - A = 4 - B = 5 - C = 6 - D = 7 - E = 8 - F = 9 + A = 4 + B = 5 + C = 6 + D = 7 + E = 8 + F = 9 G = 10 H = 11 I = 12 @@ -42,106 +42,106 @@ lib LibSDL KEY_9 = 38 KEY_0 = 39 - RETURN = 40 - ESCAPE = 41 + RETURN = 40 + ESCAPE = 41 BACKSPACE = 42 - TAB = 43 - SPACE = 44 + TAB = 43 + SPACE = 44 - MINUS = 45 - EQUALS = 46 - LEFTBRACKET = 47 + MINUS = 45 + EQUALS = 46 + LEFTBRACKET = 47 RIGHTBRACKET = 48 - BACKSLASH = 49 - NONUSHASH = 50 - SEMICOLON = 51 - APOSTROPHE = 52 - GRAVE = 53 - COMMA = 54 - PERIOD = 55 - SLASH = 56 + BACKSLASH = 49 + NONUSHASH = 50 + SEMICOLON = 51 + APOSTROPHE = 52 + GRAVE = 53 + COMMA = 54 + PERIOD = 55 + SLASH = 56 CAPSLOCK = 57 - F1 = 58 - F2 = 59 - F3 = 60 - F4 = 61 - F5 = 62 - F6 = 63 - F7 = 64 - F8 = 65 - F9 = 66 + F1 = 58 + F2 = 59 + F3 = 60 + F4 = 61 + F5 = 62 + F6 = 63 + F7 = 64 + F8 = 65 + F9 = 66 F10 = 67 F11 = 68 F12 = 69 PRINTSCREEN = 70 - SCROLLLOCK = 71 - PAUSE = 72 - INSERT = 73 - HOME = 74 - PAGEUP = 75 - DELETE = 76 - END = 77 - PAGEDOWN = 78 - RIGHT = 79 - LEFT = 80 - DOWN = 81 - UP = 82 + SCROLLLOCK = 71 + PAUSE = 72 + INSERT = 73 + HOME = 74 + PAGEUP = 75 + DELETE = 76 + END = 77 + PAGEDOWN = 78 + RIGHT = 79 + LEFT = 80 + DOWN = 81 + UP = 82 NUMLOCKCLEAR = 83 - KP_DIVIDE = 84 - KP_MULTIPLY = 85 - KP_MINUS = 86 - KP_PLUS = 87 - KP_ENTER = 88 - KP_1 = 89 - KP_2 = 90 - KP_3 = 91 - KP_4 = 92 - KP_5 = 93 - KP_6 = 94 - KP_7 = 95 - KP_8 = 96 - KP_9 = 97 - KP_0 = 98 - KP_PERIOD = 99 + KP_DIVIDE = 84 + KP_MULTIPLY = 85 + KP_MINUS = 86 + KP_PLUS = 87 + KP_ENTER = 88 + KP_1 = 89 + KP_2 = 90 + KP_3 = 91 + KP_4 = 92 + KP_5 = 93 + KP_6 = 94 + KP_7 = 95 + KP_8 = 96 + KP_9 = 97 + KP_0 = 98 + KP_PERIOD = 99 NONUSBACKSLASH = 100 - APPLICATION = 101 - POWER = 102 - KP_EQUALS = 103 - F13 = 104 - F14 = 105 - F15 = 106 - F16 = 107 - F17 = 108 - F18 = 109 - F19 = 110 - F20 = 111 - F21 = 112 - F22 = 113 - F23 = 114 - F24 = 115 - EXECUTE = 116 - HELP = 117 - MENU = 118 - SELECT = 119 - STOP = 120 - AGAIN = 121 - UNDO = 122 - CUT = 123 - COPY = 124 - PASTE = 125 - FIND = 126 - MUTE = 127 - VOLUMEUP = 128 - VOLUMEDOWN = 129 + APPLICATION = 101 + POWER = 102 + KP_EQUALS = 103 + F13 = 104 + F14 = 105 + F15 = 106 + F16 = 107 + F17 = 108 + F18 = 109 + F19 = 110 + F20 = 111 + F21 = 112 + F22 = 113 + F23 = 114 + F24 = 115 + EXECUTE = 116 + HELP = 117 + MENU = 118 + SELECT = 119 + STOP = 120 + AGAIN = 121 + UNDO = 122 + CUT = 123 + COPY = 124 + PASTE = 125 + FIND = 126 + MUTE = 127 + VOLUMEUP = 128 + VOLUMEDOWN = 129 # LOCKINGCAPSLOCK = 130 # LOCKINGNUMLOCK = 131 # LOCKINGSCROLLLOCK = 132 - KP_COMMA = 133 + KP_COMMA = 133 KP_EQUALSAS400 = 134 INTERNATIONAL1 = 135 @@ -153,117 +153,117 @@ lib LibSDL INTERNATIONAL7 = 141 INTERNATIONAL8 = 142 INTERNATIONAL9 = 143 - LANG1 = 144 - LANG2 = 145 - LANG3 = 146 - LANG4 = 147 - LANG5 = 148 - LANG6 = 149 - LANG7 = 150 - LANG8 = 151 - LANG9 = 152 + LANG1 = 144 + LANG2 = 145 + LANG3 = 146 + LANG4 = 147 + LANG5 = 148 + LANG6 = 149 + LANG7 = 150 + LANG8 = 151 + LANG9 = 152 - ALTERASE = 153 - SYSREQ = 154 - CANCEL = 155 - CLEAR = 156 - PRIOR = 157 - RETURN2 = 158 - SEPARATOR = 159 - OUT = 160 - OPER = 161 + ALTERASE = 153 + SYSREQ = 154 + CANCEL = 155 + CLEAR = 156 + PRIOR = 157 + RETURN2 = 158 + SEPARATOR = 159 + OUT = 160 + OPER = 161 CLEARAGAIN = 162 - CRSEL = 163 - EXSEL = 164 + CRSEL = 163 + EXSEL = 164 - KP_00 = 176 - KP_000 = 177 + KP_00 = 176 + KP_000 = 177 THOUSANDSSEPARATOR = 178 - DECIMALSEPARATOR = 179 - CURRENCYUNIT = 180 - CURRENCYSUBUNIT = 181 - KP_LEFTPAREN = 182 - KP_RIGHTPAREN = 183 - KP_LEFTBRACE = 184 - KP_RIGHTBRACE = 185 - KP_TAB = 186 - KP_BACKSPACE = 187 - KP_A = 188 - KP_B = 189 - KP_C = 190 - KP_D = 191 - KP_E = 192 - KP_F = 193 - KP_XOR = 194 - KP_POWER = 195 - KP_PERCENT = 196 - KP_LESS = 197 - KP_GREATER = 198 - KP_AMPERSAND = 199 - KP_DBLAMPERSAND = 200 - KP_VERTICALBAR = 201 - KP_DBLVERTICALBAR = 202 - KP_COLON = 203 - KP_HASH = 204 - KP_SPACE = 205 - KP_AT = 206 - KP_EXCLAM = 207 - KP_MEMSTORE = 208 - KP_MEMRECALL = 209 - KP_MEMCLEAR = 210 - KP_MEMADD = 211 - KP_MEMSUBTRACT = 212 - KP_MEMMULTIPLY = 213 - KP_MEMDIVIDE = 214 - KP_PLUSMINUS = 215 - KP_CLEAR = 216 - KP_CLEARENTRY = 217 - KP_BINARY = 218 - KP_OCTAL = 219 - KP_DECIMAL = 220 - KP_HEXADECIMAL = 221 + DECIMALSEPARATOR = 179 + CURRENCYUNIT = 180 + CURRENCYSUBUNIT = 181 + KP_LEFTPAREN = 182 + KP_RIGHTPAREN = 183 + KP_LEFTBRACE = 184 + KP_RIGHTBRACE = 185 + KP_TAB = 186 + KP_BACKSPACE = 187 + KP_A = 188 + KP_B = 189 + KP_C = 190 + KP_D = 191 + KP_E = 192 + KP_F = 193 + KP_XOR = 194 + KP_POWER = 195 + KP_PERCENT = 196 + KP_LESS = 197 + KP_GREATER = 198 + KP_AMPERSAND = 199 + KP_DBLAMPERSAND = 200 + KP_VERTICALBAR = 201 + KP_DBLVERTICALBAR = 202 + KP_COLON = 203 + KP_HASH = 204 + KP_SPACE = 205 + KP_AT = 206 + KP_EXCLAM = 207 + KP_MEMSTORE = 208 + KP_MEMRECALL = 209 + KP_MEMCLEAR = 210 + KP_MEMADD = 211 + KP_MEMSUBTRACT = 212 + KP_MEMMULTIPLY = 213 + KP_MEMDIVIDE = 214 + KP_PLUSMINUS = 215 + KP_CLEAR = 216 + KP_CLEARENTRY = 217 + KP_BINARY = 218 + KP_OCTAL = 219 + KP_DECIMAL = 220 + KP_HEXADECIMAL = 221 - LCTRL = 224 + LCTRL = 224 LSHIFT = 225 - LALT = 226 - LGUI = 227 - RCTRL = 228 + LALT = 226 + LGUI = 227 + RCTRL = 228 RSHIFT = 229 - RALT = 230 - RGUI = 231 + RALT = 230 + RGUI = 231 MODE = 257 # Usage page 0x0C - AUDIONEXT = 258 - AUDIOPREV = 259 - AUDIOSTOP = 260 - AUDIOPLAY = 261 - AUDIOMUTE = 262 - MEDIASELECT = 263 - WWW = 264 - MAIL = 265 - CALCULATOR = 266 - COMPUTER = 267 - AC_SEARCH = 268 - AC_HOME = 269 - AC_BACK = 270 - AC_FORWARD = 271 - AC_STOP = 272 - AC_REFRESH = 273 + AUDIONEXT = 258 + AUDIOPREV = 259 + AUDIOSTOP = 260 + AUDIOPLAY = 261 + AUDIOMUTE = 262 + MEDIASELECT = 263 + WWW = 264 + MAIL = 265 + CALCULATOR = 266 + COMPUTER = 267 + AC_SEARCH = 268 + AC_HOME = 269 + AC_BACK = 270 + AC_FORWARD = 271 + AC_STOP = 272 + AC_REFRESH = 273 AC_BOOKMARKS = 274 - # Walther keys + # Walther keys BRIGHTNESSDOWN = 275 - BRIGHTNESSUP = 276 - DISPLAYSWITCH = 277 + BRIGHTNESSUP = 276 + DISPLAYSWITCH = 277 KBDILLUMTOGGLE = 278 - KBDILLUMDOWN = 279 - KBDILLUMUP = 280 - EJECT = 281 - SLEEP = 282 + KBDILLUMDOWN = 279 + KBDILLUMUP = 280 + EJECT = 281 + SLEEP = 282 APP1 = 283 APP2 = 284 diff --git a/src/lib_sdl/shape.cr b/src/lib_sdl/shape.cr index cb019ac..489a022 100644 --- a/src/lib_sdl/shape.cr +++ b/src/lib_sdl/shape.cr @@ -1,7 +1,7 @@ lib LibSDL - NONSHAPEABLE_WINDOW = -1 + NONSHAPEABLE_WINDOW = -1 INVALID_SHAPE_ARGUMENT = -2 - WINDOW_LACKS_SHAPE = -3 + WINDOW_LACKS_SHAPE = -3 enum ShapeMode Default diff --git a/src/lib_sdl/surface.cr b/src/lib_sdl/surface.cr index 004cece..c07946e 100644 --- a/src/lib_sdl/surface.cr +++ b/src/lib_sdl/surface.cr @@ -1,5 +1,5 @@ lib LibSDL - SWSURFACE = 0 + SWSURFACE = 0 PREALLOC = 0x00000001 RLEACCEL = 0x00000002 DONTFREE = 0x00000004 @@ -31,7 +31,7 @@ lib LibSDL fun unlock_surface = SDL_UnlockSurface(surface : Surface*) fun load_bmp_rw = SDL_LoadBMP_RW(src : RWops*, freesrc : Int) : Surface* - fun save_bmp_rw = SDL_SaveBMP_RW (surface : Surface*, dst : RWops*, freedst : Int) : Int + fun save_bmp_rw = SDL_SaveBMP_RW(surface : Surface*, dst : RWops*, freedst : Int) : Int fun set_color_key = SDL_SetColorKey(surface : Surface*, flag : Int, key : UInt32) : Int fun get_color_key = SDL_GetColorKey(surface : Surface*, key : UInt32*) : Int @@ -51,12 +51,12 @@ lib LibSDL fun fill_rect = SDL_FillRect(dst : Surface*, rect : Rect*, color : UInt32) : Int fun fill_rects = SDL_FillRects(dst : Surface*, rects : Rect*, count : Int, color : UInt32) : Int - #alias blit_surface = SDL_UpperBlit + # alias blit_surface = SDL_UpperBlit fun upper_blit = SDL_UpperBlit(src : Surface*, srcrect : Rect*, dst : Surface*, dstrect : Rect*) : Int fun lower_blit = SDL_LowerBlit(src : Surface*, srcrect : Rect*, dst : Surface*, dstrect : Rect*) : Int fun soft_stretch = SDL_SoftStretch(src : Surface*, srcrect : Rect*, dst : Surface*, dstrect : Rect*) : Int - #alias blit_scaled = SDL_UpperBlitScaled + # alias blit_scaled = SDL_UpperBlitScaled fun upper_blit_scaled = SDL_UpperBlitScaled(src : Surface*, srcrect : Rect*, dst : Surface*, dstrect : Rect*) : Int fun lower_blit_scaled = SDL_LowerBlitScaled(src : Surface*, srcrect : Rect*, dst : Surface*, dstrect : Rect*) : Int end diff --git a/src/lib_sdl/touch.cr b/src/lib_sdl/touch.cr index ce1c8d1..8503802 100644 --- a/src/lib_sdl/touch.cr +++ b/src/lib_sdl/touch.cr @@ -9,7 +9,7 @@ lib LibSDL pressure : Float end - fun get_num_touch_devices = SDL_GetNumTouchDevices() : Int + fun get_num_touch_devices = SDL_GetNumTouchDevices : Int fun get_touch_device = SDL_GetTouchDevice(index : Int) : TouchID fun get_num_touch_fingers = SDL_GetNumTouchFingers(touchID : TouchID) : Int fun get_touch_finger = SDL_GetTouchFinger(touchID : TouchID, index : Int) : Finger* diff --git a/src/lib_sdl/video.cr b/src/lib_sdl/video.cr index 94cbcb8..6d1b2fa 100644 --- a/src/lib_sdl/video.cr +++ b/src/lib_sdl/video.cr @@ -14,20 +14,20 @@ lib LibSDL type Window = Void enum WindowFlags : UInt32 - FULLSCREEN = 0x00000001 - OPENGL = 0x00000002 - SHOWN = 0x00000004 - HIDDEN = 0x00000008 - BORDERLESS = 0x00000010 - RESIZABLE = 0x00000020 - MINIMIZED = 0x00000040 - MAXIMIZED = 0x00000080 - INPUT_GRABBED = 0x00000100 - INPUT_FOCUS = 0x00000200 - MOUSE_FOCUS = 0x00000400 + FULLSCREEN = 0x00000001 + OPENGL = 0x00000002 + SHOWN = 0x00000004 + HIDDEN = 0x00000008 + BORDERLESS = 0x00000010 + RESIZABLE = 0x00000020 + MINIMIZED = 0x00000040 + MAXIMIZED = 0x00000080 + INPUT_GRABBED = 0x00000100 + INPUT_FOCUS = 0x00000200 + MOUSE_FOCUS = 0x00000400 FULLSCREEN_DESKTOP = 0x00001001 # WINDOW_FULLSCREEN | 0x00001000 - FOREIGN = 0x00000800 - ALLOW_HIGHDPI = 0x00002000 + FOREIGN = 0x00000800 + ALLOW_HIGHDPI = 0x00002000 end enum WindowPosition @@ -83,9 +83,9 @@ lib LibSDL end enum GLprofile - PROFILE_CORE = 0x0001 - PROFILE_COMPATIBILITY = 0x0002 - PROFILE_ES = 0x0004 + PROFILE_CORE = 0x0001 + PROFILE_COMPATIBILITY = 0x0002 + PROFILE_ES = 0x0004 end enum GLcontextFlag @@ -95,12 +95,12 @@ lib LibSDL RESET_ISOLATION_FLAG = 0x0008 end - fun get_num_video_drivers = SDL_GetNumVideoDrivers() : Int + fun get_num_video_drivers = SDL_GetNumVideoDrivers : Int fun get_video_driver = SDL_GetVideoDriver(index : Int) : Char* fun video_init = SDL_VideoInit(driver_name : Char*) : Int - fun video_quit = SDL_VideoQuit() - fun get_current_video_driver = SDL_GetCurrentVideoDriver() : Char* - fun get_num_video_displays = SDL_GetNumVideoDisplays() : Int + fun video_quit = SDL_VideoQuit + fun get_current_video_driver = SDL_GetCurrentVideoDriver : Char* + fun get_num_video_displays = SDL_GetNumVideoDisplays : Int fun get_display_name = SDL_GetDisplayName(displayIndex : Int) : Char* fun get_display_bounds = SDL_GetDisplayBounds(displayIndex : Int, rect : Rect*) : Int fun get_num_display_modes = SDL_GetNumDisplayModes(displayIndex : Int) : Int @@ -150,26 +150,26 @@ lib LibSDL fun get_window_gamma_ramp = SDL_GetWindowGammaRamp(window : Window*, red : UInt16*, green : UInt16*, blue : UInt16*) : Int fun destroy_window = SDL_DestroyWindow(window : Window*) - fun is_screen_saver_enabled = SDL_IsScreenSaverEnabled() : Bool - fun enable_screen_saver = SDL_EnableScreenSaver() - fun disable_screen_saver = SDL_DisableScreenSaver() + fun is_screen_saver_enabled = SDL_IsScreenSaverEnabled : Bool + fun enable_screen_saver = SDL_EnableScreenSaver + fun disable_screen_saver = SDL_DisableScreenSaver # OpenGL support functions fun gl_load_library = SDL_GL_LoadLibrary(path : Char*) : Int fun gl_get_proc_address = SDL_GL_GetProcAddress(proc : Char*) : Void* - fun gl_unload_library = SDL_GL_UnloadLibrary() + fun gl_unload_library = SDL_GL_UnloadLibrary fun gl_extension_supported = SDL_GL_ExtensionSupported(extension : Char*) : Bool - fun gl_reset_attributes = SDL_GL_ResetAttributes() + fun gl_reset_attributes = SDL_GL_ResetAttributes fun gl_set_attribute = SDL_GL_SetAttribute(attr : GLattr, value : Int) : Int fun gl_get_attribute = SDL_GL_GetAttribute(attr : GLattr, value : Int*) : Int fun gl_create_context = SDL_GL_CreateContext(window : Window*) : GLContext fun gl_make_current = SDL_GL_MakeCurrent(window : Window*, context : GLContext) : Int - fun gl_get_current_window = SDL_GL_GetCurrentWindow() : Window* - fun gl_get_current_context = SDL_GL_GetCurrentContext() : GLContext + fun gl_get_current_window = SDL_GL_GetCurrentWindow : Window* + fun gl_get_current_context = SDL_GL_GetCurrentContext : GLContext fun gl_get_drawable_size = SDL_GL_GetDrawableSize(window : Window*, w : Int*, h : Int*) : Int fun gl_set_swap_interval = SDL_GL_SetSwapInterval(interval : Int) : Int - fun gl_get_swap_interval = SDL_GL_GetSwapInterval() : Int + fun gl_get_swap_interval = SDL_GL_GetSwapInterval : Int fun gl_swap_window = SDL_GL_SwapWindow(window : Window*) fun gl_delete_context = SDL_GL_DeleteContext(context : GLContext) end diff --git a/src/lib_ttf.cr b/src/lib_ttf.cr index 43f2315..fd51cc7 100644 --- a/src/lib_ttf.cr +++ b/src/lib_ttf.cr @@ -7,9 +7,9 @@ lib LibTTF alias Long = LibC::Long VERSION = {% `pkg-config SDL2_ttf --modversion`.strip %} - MAJOR = {% VERSION.split('.')[0] %} - MINOR = {% VERSION.split('.')[1] %} - PATCH = {% VERSION.split('.')[2] %} + MAJOR = {% VERSION.split('.')[0] %} + MINOR = {% VERSION.split('.')[1] %} + PATCH = {% VERSION.split('.')[2] %} enum Style NORMAL = 0x00 @@ -21,10 +21,10 @@ lib LibTTF type Font = Void - #fun linked_version = TTF_Linked_Version() : LibSDL::Version - fun init = TTF_Init() : Int - fun was_init = TTF_WasInit() : Int - fun quit = TTF_Quit() + # fun linked_version = TTF_Linked_Version() : LibSDL::Version + fun init = TTF_Init : Int + fun was_init = TTF_WasInit : Int + fun quit = TTF_Quit fun open_font = TTF_OpenFont(file : Char*, ptsize : Int) : Font* fun open_font_index = TTF_OpenFontIndex(file : Char*, ptsize : Int, index : Long) : Font* @@ -55,15 +55,15 @@ lib LibTTF fun render_text_solid = TTF_RenderText_Solid(font : Font*, text : Char*, fg : LibSDL::Color) : LibSDL::Surface* fun render_utf8_solid = TTF_RenderUTF8_Solid(font : Font*, text : Char*, fg : LibSDL::Color) : LibSDL::Surface* fun render_unicode_solid = TTF_RenderUNICODE_Solid(font : Font*, text : UInt16*, fg : LibSDL::Color) : LibSDL::Surface* - fun render_glyph_solid = TTF_RenderGlyph_Solid(font : Font*, ch : UInt16, fg : LibSDL::Color): LibSDL::Surface* + fun render_glyph_solid = TTF_RenderGlyph_Solid(font : Font*, ch : UInt16, fg : LibSDL::Color) : LibSDL::Surface* fun render_text_shaded = TTF_RenderText_Shaded(font : Font*, text : Char*, fg : LibSDL::Color, bg : LibSDL::Color) : LibSDL::Surface* fun render_utf8_shaded = TTF_RenderUTF8_Shaded(font : Font*, text : Char*, fg : LibSDL::Color, bg : LibSDL::Color) : LibSDL::Surface* fun render_unicode_shaded = TTF_RenderUNICODE_Shaded(font : Font*, text : UInt16*, fg : LibSDL::Color, bg : LibSDL::Color) : LibSDL::Surface* fun render_glyph_shaded = TTF_RenderGlyph_Shaded(font : Font*, ch : UInt16, fg : LibSDL::Color, bg : LibSDL::Color) : LibSDL::Surface* - fun render_text_blended = TTF_RenderText_Blended(font : Font*, text : Char*, fg : LibSDL::Color) : LibSDL::Surface* - fun render_utf8_blended = TTF_RenderUTF8_Blended(font : Font*, text : Char*, fg : LibSDL::Color) : LibSDL::Surface* + fun render_text_blended = TTF_RenderText_Blended(font : Font*, text : Char*, fg : LibSDL::Color) : LibSDL::Surface* + fun render_utf8_blended = TTF_RenderUTF8_Blended(font : Font*, text : Char*, fg : LibSDL::Color) : LibSDL::Surface* fun render_unicode_blended = TTF_RenderUNICODE_Blended(font : Font*, text : UInt16*, fg : LibSDL::Color) : LibSDL::Surface* fun render_glyph_blended = TTF_RenderGlyph_Blended(font : Font*, ch : UInt16, fg : LibSDL::Color) : LibSDL::Surface* diff --git a/src/mix.cr b/src/mix.cr index 687a99d..5739996 100644 --- a/src/mix.cr +++ b/src/mix.cr @@ -5,7 +5,7 @@ require "./mix/music" module SDL module Mix - MAX_VOLUME = LibMix::MIN_MAX_VOLUME + MAX_VOLUME = LibMix::MIN_MAX_VOLUME DEFAULT_FORMAT = LibMix::Mix_DEFAULT_FORMAT alias Init = LibMix::Init diff --git a/src/pixels.cr b/src/pixels.cr index 2068df3..52b5efc 100644 --- a/src/pixels.cr +++ b/src/pixels.cr @@ -17,9 +17,9 @@ module SDL @pixel_format.value.bitsPerPixel end - #def palette + # def palette # Palette.new(@pixel_format.value.palette) - #end + # end def to_unsafe @pixel_format diff --git a/src/renderer.cr b/src/renderer.cr index 529a141..9154cf7 100644 --- a/src/renderer.cr +++ b/src/renderer.cr @@ -15,8 +15,8 @@ module SDL end # TODO: Renderer::Info#texture_formats - #def texture_formats - #end + # def texture_formats + # end end alias Flags = LibSDL::RendererFlags diff --git a/src/rwops.cr b/src/rwops.cr index eae2696..8aff632 100644 --- a/src/rwops.cr +++ b/src/rwops.cr @@ -1,6 +1,5 @@ module SDL class RWops - @@rw_file = LibSDL.alloc_rw @@rw_file.value.size = ->(context : LibSDL::RWops*) { @@ -13,7 +12,7 @@ module SDL when LibSDL::RW_SEEK_SET then IO::Seek::Set when LibSDL::RW_SEEK_CUR then IO::Seek::Current when LibSDL::RW_SEEK_END then IO::Seek::End - else raise "can't seek: invalid whence value" + else raise "can't seek: invalid whence value" end file = Box(RWops).unbox(context.value.hidden.unknown.data1).file file.seek(offset.to_i32, wh).tell.to_i64 diff --git a/src/screensaver.cr b/src/screensaver.cr index 587b019..0bca667 100644 --- a/src/screensaver.cr +++ b/src/screensaver.cr @@ -1,15 +1,15 @@ module SDL module Screensaver def self.enabled? - LibSDL.is_screen_saver_enabled() == 1 + LibSDL.is_screen_saver_enabled == 1 end def self.enable - LibSDL.enable_screen_saver() + LibSDL.enable_screen_saver end def self.disable - LibSDL.disable_screen_saver() + LibSDL.disable_screen_saver end end end diff --git a/src/surface.cr b/src/surface.cr index 848a2cc..2c999f9 100644 --- a/src/surface.cr +++ b/src/surface.cr @@ -191,8 +191,8 @@ module SDL end # Requires `SDL_image`. - #def save_png(path) - #end + # def save_png(path) + # end private def surface @surface.value @@ -202,9 +202,9 @@ module SDL PixelFormat.new(surface.format) end - #protected def pixels + # protected def pixels # surface.pixels - #end + # end def to_unsafe @surface diff --git a/src/texture.cr b/src/texture.cr index 15e22c3..f930aef 100644 --- a/src/texture.cr +++ b/src/texture.cr @@ -62,17 +62,17 @@ module SDL blend_mode end - #def update - #end + # def update + # end - #def update_yuv - #end + # def update_yuv + # end - #def lock - #end + # def lock + # end - #def unlock - #end + # def unlock + # end # Binds an OpenGL/ES/ES2 texture to the current texture, for use with OpenGL # instructions when Rendering OpenGL primitives directly. diff --git a/src/ttf.cr b/src/ttf.cr index edb520c..e69b763 100644 --- a/src/ttf.cr +++ b/src/ttf.cr @@ -220,7 +220,7 @@ module SDL # Renders text using this font as an `SDL::Surface` using the blended # wrapped mode. - #def render_blended_wrapper(text : String, color, wrap_length, ascii = false) + # def render_blended_wrapper(text : String, color, wrap_length, ascii = false) # if ascii # surface = LibTTF.render_text_blended_wrapped(self, text, color, wrap_length) # raise Error.new("TTF_RenderText_Blended_Wrapped") unless surface @@ -229,7 +229,7 @@ module SDL # raise Error.new("TTF_RenderUTF8_Blended_Wrapped") unless surface # end # SDL::Surface.new(surface) - #end + # end def close @closed = true diff --git a/src/window.cr b/src/window.cr index d04f658..a582189 100644 --- a/src/window.cr +++ b/src/window.cr @@ -71,8 +71,8 @@ module SDL {% end %} enum Fullscreen - WINDOW = 0 - FULLSCREEN = LibSDL::WindowFlags::FULLSCREEN + WINDOW = 0 + FULLSCREEN = LibSDL::WindowFlags::FULLSCREEN FULLSCREEN_DESKTOP = LibSDL::WindowFlags::FULLSCREEN_DESKTOP end