Code Monkey home page Code Monkey logo

sdl3-cs's Introduction

SDL3#

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

GitHub contributors GitHub last commit Static Badge

Static Badge Static Badge Static Badge Static Badge

AboutDocumentationInstallationExamplesReadiness

Mobile platform supportFeedback and ContributionsAuthorsLicense

⭐ 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.

Also, in the future, I plan to add support for SDL_image, SDL_ttf and SDL_mixer

📚 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 In progress
Surface Creation and Simple Drawing SDL_surface.h In progress
Clipboard Handling SDL_clipboard.h Ready
Vulkan Support SDL_vulkan.h In progress
Metal Support SDL_metal.h Ready
Camera Support SDL_camera.h Not 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 Skipped
Storage Abstraction SDL_storage.h Not ready
I/O Streams SDL_iostream.h In progress

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 [email protected] 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.

sdl3-cs's People

Contributors

edwardgushchin avatar

Stargazers

BlueSharkPartners avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.