Код: Выделить всё
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);
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... n-a-window