Skip to content

This is SDL3#, a C# wrapper for SDL3.

License

Notifications You must be signed in to change notification settings

Cj-ira/SDL3-CS

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SDL3#

This is SDL3#, a C# wrapper for SDL3.

GitHub contributors GitHub last commit Static Badge

Static Badge Static Badge Static Badge Static Badge

About β€’ Documentation β€’ Installation β€’ Examples β€’ Readiness

Mobile platform support β€’ Feedback and Contributions β€’ Authors β€’ License

⭐ Star us on GitHub β€” it motivates us a lot!

πŸš€ About

SDL3 is still under active development, and the shell is currently under development as of this commit. For convenience, you can use this branch.

Once all the features are ready, I plan to bring the wrapper up to date with the original SDL and keep it up to date.

πŸ“š Documentation

For more information about SDL3, visit the SDL wiki.

πŸ“ Installation

git clone https://github.com/edwardgushchin/SDL3-CS
cd SDL3-CS
dotnet build -c Release

πŸŽ“ Examples

using SDL3;

namespace SDL3Test;

public static class Program
{
    private static void Main()
    {
        if (SDL.Init(SDL.InitFlags.Video) < 0)
        {
            Console.WriteLine($"SDL could not initialize! SDL Error: {SDL.GetError()}");
            return;
        }
        
        var window = SDL.CreateWindow("SDL3 Create Window", 800, 600, 0);
        
        if (window == null)
        {
            Console.WriteLine($"Window could not be created! SDL Error: {SDL.GetError()}");
            return;
        }
        
        var renderer = SDL.CreateRenderer(window, null);
        
        if (renderer == null)
        {
            Console.WriteLine($"Renderer could not be created! SDL Error: {SDL.GetError()}");
            return;
        }

        SDL.SetRenderDrawColor(renderer, 100, 149, 237, 0);
        
        var loop = true;
        
        while (loop)
        {
            
            while (SDL.PollEvent(out var sdlEvent))
            {
                if (sdlEvent.Type == SDL.EventType.Quit)
                {
                    loop = false;
                }
            }

            SDL.RenderClear(renderer);
            SDL.RenderPresent(renderer);
        }

        SDL.DestroyRenderer(renderer);
        SDL.DestroyWindow(window);
        
        SDL.Quit();
    }
}

More examples can be found here.

βœ… Readiness

Basics

View information and functions related to... View the header Stage
Application entry points SDL_main.h Skipped
Initialization and Shutdown SDL_init.h Ready
Configuration Variables SDL_hints.h Ready
Object Properties SDL_properties.h Ready
Error Handling SDL_error.h Ready
Log Handling SDL_log.h Ready
Assertions SDL_assert.h Skipped
Querying SDL Version SDL_version.h Ready

Video

View information and functions related to... View the header Stage
Display and Window Management SDL_video.h Ready
2D Accelerated Rendering SDL_render.h In progress
Pixel Formats and Conversion Routines SDL_pixels.h In progress
Blend modes SDL_blendmode.h Ready
Rectangle Functions SDL_rect.h Ready
Surface Creation and Simple Drawing SDL_surface.h In progress
Clipboard Handling SDL_clipboard.h Ready
Vulkan Support SDL_vulkan.h Ready
Metal Support SDL_metal.h Ready
Camera Support SDL_camera.h Ready

Input Events

View information and functions related to... View the header Stage
Event Handling SDL_events.h Ready
Keyboard Support SDL_keyboard.h Ready
Keyboard Keycodes SDL_keycode.h Ready
Keyboard Scancodes SDL_scancode.h Ready
Mouse Support SDL_mouse.h Ready
Joystick Support SDL_joystick.h Ready
Gamepad Support SDL_gamepad.h Ready
Touch Support SDL_touch.h Ready
Pen Support SDL_pen.h Ready
Sensors SDL_sensor.h Ready
HIDAPI SDL_hidapi.h Ready

Force Feedback ("Haptic")

View information and functions related to... View the header Stage
Force Feedback Support SDL_haptic.h Not ready

Audio

View information and functions related to... View the header Stage
Audio Playback, Recording, and Mixing SDL_audio.h Not ready

Threads

View information and functions related to... View the header Stage
Thread Management SDL_thread.h Skipped
Thread Synchronization Primitives SDL_mutex.h Skipped
Atomic Operations SDL_atomic.h Skipped

Time

View information and functions related to... View the header Stage
Timer Support SDL_timer.h Ready
Date and Time SDL_time.h Skipped

File and I/O Abstractions

View information and functions related to... View the header Stage
Filesystem Access SDL_filesystem.h Ready
Storage Abstraction SDL_storage.h Ready
I/O Streams SDL_iostream.h Ready

Platform and CPU Information

View information and functions related to... View the header Stage
Platform Detection SDL_platform.h Ready
CPU Feature Detection SDL_cpuinfo.h Ready
Byte Order and Byte Swapping SDL_endian.h Skipped
Bit Manipulation SDL_bits.h Skipped

Additional Functionality

View information and functions related to... View the header Stage
Shared Object/DLL Management SDL_loadso.h Ready
Power Management Status SDL_power.h Ready
Message Boxes SDL_messagebox.h Ready
File Dialogs SDL_dialog.h Ready
Locale Info SDL_locale.h Ready
Platform-specific Functionality SDL_system.h Ready
Standard Library Functionality SDL_stdinc.h Ready
GUIDs SDL_guid.h Ready
Miscellaneous SDL_misc.h Ready

πŸ“± Mobile platform support

In theory, there is no reason why this shell cannot run on Android and iOS, but I have never worked with these platforms and cannot guarantee 100% work. If you can add support for mobile platforms, I look forward to your Pull requests!

🀝 Feedback and Contributions

Do you have an idea or found a bug? Please open an issue or start a discussion.

Please note we have a code of conduct, please follow it in all your interactions with the project.

If you have any feedback, please reach out to us at eduardgushchin@yandex.ru or https://t.me/eduardgushchin

πŸ’» Authors

See also the list of contributors who participated in this project.

πŸ“ƒ License

SDL3 and SDL3# are released under the zlib license. See LICENSE for details.

About

This is SDL3#, a C# wrapper for SDL3.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%