# coding: utf-8

require 'fiddle'
require 'fiddle/import'

module SDL2
	PATH = 'C:\Users\hyrious\Documents\GitHub\vcpkg\installed\x64-windows\bin\SDL2.dll'
	
	extend Fiddle::Importer
	dlload PATH
	extern 'int SDL_Init(uint flags)'
	extern 'void *SDL_CreateWindow(char *title, int x, int y, int w, int h, uint flags)'
	extern 'void SDL_Delay(uint ms)'
	extern 'void SDL_Quit()'
	extern 'char *SDL_GetError()'

	if SDL_Init(0xf231) < 0
		puts "error: #{SDL_GetError()}"
		exit 1
	end

	SDL_CreateWindow("SDL2 Demo", 0x2fff0000, 0x2fff0000, 544, 416, 4)
	SDL_Delay(2000)
	SDL_Quit()

end