shithub: npe

ref: 979ae53cfee913c2d303ab0f95aaa65dace1c7b5
dir: /libnpe_sdl3/_sdl.h/

View raw version
#include <SDL3/SDL.h>
#include <sys/stat.h>
#include <stdint.h>
#include <string.h>
#include <tos.h>
#include <thread.h>
#include <draw.h>
#include <memdraw.h>
#include <mouse.h>
#include <cursor.h>
#include <plumb.h>
#include "_npe.h"
#undef waitpid

struct SDL_Texture {
	Memimage *m;
	Memimage *mod;
	SDL_BlendMode blend;
};
struct SDL_Renderer {
	int logiw;
	int logih;
};

struct npe_sdl {
	Mousectl *mctl;
	Rectangle grabout;
	Point center;
	int mgrab;
	Mouse m, om;
	Point Δ;
	int hints;
	int mredraw;
	int fullredraw;
	int textinput;
	int physw, physh;
	float scale;
	struct {
		Uint32 r, g, b, a;
	} defmask;
	Memimage *back;
	Memimage *rendcol;
	SDL_Texture *target;
};

enum {
	Altf4noclose = 1<<0,
};

extern struct npe_sdl npe_sdl;

int	npe_sdl_init_input(void);
int	npe_sdl_init_draw(void);
int	npe_sdl_init_audio(void);
int	npe_sdl_init_tex(void);
int	npe_sdl_init_gamepad(void);
void	npe_sdl_kill_audio(void);
void	npe_sdl_kill_draw(void);
void	npe_sdl_kill_gamepad(void);
void	npe_sdl_kill_input(void);
void*	npe_sdl_scale(u32int*, int, int, u32int*, int, int);
void	npe_draw_cursor(void);

ulong	mask2chan(int, Uint32, Uint32, Uint32, Uint32);
int	chan2mask(Uint32, int*, Uint32*, Uint32*, Uint32*, Uint32*);
Uint32	chan2pixel(ulong);
ulong	pixel2chan(Uint32);