JacksEscape/render_util.h

82 lines
1.9 KiB
C
Raw Permalink Normal View History

#pragma once
2024-03-19 11:59:09 +08:00
#include "types.h"
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
2024-04-16 20:29:38 +08:00
#define TEXTHEIGHT 24
// Draws text at the given on-screen position.
//
// unlike outtext(), this function takes consideration
// for newlines.
void render_DrawText(int x, int y, const char *str);
2024-04-23 15:20:02 +08:00
// A warpper around drawtext().
void render_DrawTextEx(const char *str, Box2 rect, unsigned int flags);
2024-03-19 11:59:09 +08:00
// Fill modes.
typedef struct {
// Most often it's:
// R2_COPYPEN (Output = Pen color)
// R2_BLACK (Output = Black)
// R2_WHITE (Output = White)
// R2_NOT (Output = NOT Screen color)
//
// https://docs.easyx.cn/zh-cn/setrop2
int rop2;
// Style & hatch passed into setfillstyle()
//
// https://docs.easyx.cn/zh-cn/setfillstyle
int style;
long hatch;
// Rotates in /-\| every this amount of time, if not 0
// Overrides style & hatch
Duration rotate;
// Dissolve the entire screen in an animation in this
// amount of time. Overrides rotate, style & hatch
Duration dissolve;
2024-03-19 15:14:23 +08:00
bool fadein; // Fade Into being full for true, fade out of otherwise
uint32_t bg, fg; // Background & foreground colors
2024-03-19 11:59:09 +08:00
} FillMode;
// Default fill mode.
// rop2 = R2_COPYPEN,
// style = BS_SOLID,
// others = 0
2024-03-25 14:59:00 +08:00
extern const FillMode render_ModeDefault;
// Fill mode that inverses the screen.
// rop2 = R2_NOT,
// style = BS_SOLID,
// others = 0
extern const FillMode render_ModeInverse;
2024-03-26 16:55:28 +08:00
// Fill mode that rotates.
extern const FillMode render_ModeRotate;
2024-03-19 11:59:09 +08:00
typedef struct _App App;
// Calls the required setfillstyle/setrop2 calls for the struct.
void render_SetModes(FillMode mode, TimePoint since);
// Fills the entire screen
2024-03-19 15:14:23 +08:00
void render_FillScreen();
2024-03-19 11:59:09 +08:00
// Fills a rectangle in world coordinates
2024-03-19 15:14:23 +08:00
void render_FillRectW(App *app, Box2 rect);
2024-03-19 11:59:09 +08:00
// Fills a circle in world coordinates
2024-03-19 15:14:23 +08:00
void render_FillCircleW(App *app, Vec2 center, double radius);
2024-03-19 11:59:09 +08:00
#ifdef __cplusplus
}
#endif