diff options
Diffstat (limited to 'src/lzr.h')
-rw-r--r-- | src/lzr.h | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/src/lzr.h b/src/lzr.h deleted file mode 100644 index 497bd52..0000000 --- a/src/lzr.h +++ /dev/null @@ -1,129 +0,0 @@ -/* Licensing informations can be found at the end of the file. */ -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdbool.h> -#include <stdint.h> - -#ifndef LZR_DISABLE_IMAGE -# define LZR_ENABLE_IMAGE -#endif -#ifndef LZR_DISABLE_MIXER -# define LZR_ENABLE_MIXER -#endif -#ifndef LZR_DISABLE_GFX -# define LZR_ENABLE_GFX -#endif - -/* devmode tracks and autoreloads ressources on change */ -#ifndef LZR_DISABLE_DEVMODE -# define LZR_ENABLE_DEVMODE -#endif - -#define LZR_MAX_IMAGES 64 -#define LZR_MAX_SOUNDS 64 -#define LZR_BUTTON(btn) LZR_ButtonDown(LZR_BUTTON_##btn) -#define LZR_IMAGE(img) LZR_ImageLoad(img) - -typedef struct LZR_Config { - unsigned int display_width; - unsigned int display_height; - unsigned int target_fps; - unsigned int tile_size; - const char *title; - double ratio; - bool disable_bind_menu; - bool hide_cursor; -} LZR_Config; - -typedef enum LZR_EventType { - LZR_EVENT_QUIT, - LZR_EVENT_BUTTON_DOWN, - LZR_EVENT_BUTTON_UP, - LZR_EVENT_MOUSE_MOVE -} LZR_EventType; - -typedef enum LZR_Button { - LZR_BUTTON_LEFT, - LZR_BUTTON_RIGHT, - LZR_BUTTON_UP, - LZR_BUTTON_DOWN, - LZR_BUTTON_O, - LZR_BUTTON_X, - LZR_BUTTON_MOUSE_L, - LZR_BUTTON_MOUSE_M, - LZR_BUTTON_MOUSE_R, - LZR_BUTTON_COUNT -} LZR_Button; - -typedef struct LZR_Event { - LZR_EventType type; - LZR_Button button; - int x, y; -} LZR_Event; - -typedef struct LZR_ImageDrawSettings { - int ix, iy, width, height; - double scale_x, scale_y, angle; - bool center, flip_h, flip_v; -} LZR_ImageDrawSettings; - -int LZR_Init(LZR_Config cfg); -void LZR_Quit(void); -bool LZR_ShouldQuit(void); -bool LZR_PollEvent(LZR_Event *e); -void LZR_CycleEvents(void); -bool LZR_ButtonDown(LZR_Button btn); -void LZR_ButtonBind(LZR_Button btn, unsigned int code); -char *LZR_PathPrefix(const char *path); -int LZR_ImageLoad(const char *path); -int LZR_SoundLoad(const char *path, float volume); -int LZR_DrawBegin(void); -int LZR_DrawEnd(void); -int LZR_DrawSetColor(float r, float g, float b, float a); -int LZR_DrawClear(void); -int LZR_DrawPoint(int x, int y); -int LZR_DrawPoints(int *x, int *y, int n); -int LZR_DrawLine(int x0, int y0, int x1, int y1); -int LZR_DrawRectangle(bool fill, int x, int y, int w, int h); -int LZR_DrawCircle(bool fill, int x, int y, int radius); -int LZR_DrawPolygon(bool fill, int *vx, int *vy, int n); -int LZR_DrawImage(int id, int x, int y); -int LZR_DrawImageEx(int id, int x, int y, LZR_ImageDrawSettings stg); -int LZR_DrawTile(int id, int tile, int x, int y, double rot, int flip); -int LZR_PlaySound(int id); -int LZR_SetMusicVolume(float volume); -int LZR_PlayMusic(const char *path, int loops); -void LZR_StopMusic(void); -void LZR_ToggleFullscreen(void); -uint64_t LZR_GetTick(void); -void LZR_ScreenTransform(int *x, int *y); -void LZR_MousePosition(int *x, int *y); - -#ifdef __cplusplus -} -#endif - -/* -** Copyright (c) 2022, 2023 kdx -** -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and associated documentation files (the "Software"), to -** deal in the Software without restriction, including without limitation the -** rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -** sell copies of the Software, and to permit persons to whom the Software is -** furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -** FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -** IN THE SOFTWARE. -*/ |