admin管理员组

文章数量:1130725

Im trying to open a sdl window using SDL2.Bindings(link) but its not working and nothing is happening and sometimes it says that initwin is static when i havent defined it as static

global using System;
global using System.Collections.Generic;
global using System.Text;
global using System.Threading.Tasks;
global using System.IO;
global using Vulkan;
global using SDL2.NET;
global using GlmNet;
global using sdl = SDL2.Bindings.SDL;
public static class albireo {
    public static int initwin(string name, int x, int y) {
        int r = 0;
        if(sdl.SDL_Init(sdl.SDL_INIT_VIDEO) < 0)
        {
            Console.WriteLine("Failed to initialize the SDL2 library");
            return -1;
        }

        IntPtr window = sdl.SDL_CreateWindow(name,
            sdl.SDL_WINDOWPOS_CENTERED,
            sdl.SDL_WINDOWPOS_CENTERED,
            x, y,
            0);

        if(window == IntPtr.Zero)
        {
            Console.WriteLine("Failed to create window");
            r = -1;
        }

        IntPtr window_surface = sdl.SDL_GetWindowSurface(window);

        if(window_surface == IntPtr.Zero)
        {
            Console.WriteLine("Failed to get the surface from the window");
            r = -1;
        }

        sdl.SDL_UpdateWindowSurface(window);
        return r;
    }
}
namespace thingy {
    class program {
        static void main() {
            albireo.initwin("window", 800, 600);
        }
    }
}

i was expecting a window to open but its not

本文标签: sdlHow do i use SDL2Bindings in c to open a windowStack Overflow