14 FireWindow(
const std::string &path,
int width,
int height,
bool fullscreen,
bool enable_vsync)
16 shader_root((path.empty() ? std::string(FIRE_ASSET_DIR) : path) +
"/data") {
23 void event(SDL_Event &e)
override {
24 if (e.type == SDL_EVENT_KEY_DOWN && e.key.key == SDLK_ESCAPE) {
26 }
else if (e.type == SDL_EVENT_MOUSE_WHEEL) {
27 zoom = std::clamp(zoom + e.wheel.y * 0.16f, 0.25f, 4.40f);
40 std::string shader_root;
45int main(
int argc,
char **argv) {
51 std::cerr << std::format(
"mxvk: Exception: {}\n", e.
text());
54 std::cerr << std::format(
"mxvk: Argument Exception: {}\n", e.
text());
Lightweight, header-only, template command-line argument parser.
Arguments proc_args(int &argc, char **argv)
Parse standard libmx2 command-line options from main()'s argv.
Exception thrown by Argz::proc() on unrecognised or malformed options.
void event(SDL_Event &e) override
Handle one SDL event.
void proc() override
Execute one processing/update step.
FireWindow(const std::string &path, int width, int height, bool fullscreen, bool enable_vsync)
Main Vulkan window wrapper for MXVK.
void loop()
Run the main event/render loop.
void setClearColor(float r, float g, float b, float a=1.0f)
Set the per-frame color attachment clear color.
void exit()
Request loop termination.
VK_Sprite * attachPostProcessingShader(const std::string &fragmentShaderPath, float p1=0.0f, float p2=0.0f, float p3=0.0f, float p4=0.0f)
Attach a full-screen post-processing fragment shader.
VK_Window()=default
Construct an empty window object.
void setPostProcessingEnabled(bool enabled)
void setPostProcessingShaderParams(float p1=0.0f, float p2=0.0f, float p3=0.0f, float p4=0.0f)
Set the post-processing shader params passed as a vec4 push constant.
void setPostProcessingShaderTimeEnabled(bool enabled)
Keep shader param 1 updated with elapsed render time in seconds.
Utilities for loading and saving PNG images.
Plain data structure returned by proc_args() with all common libmx2 CLI options.
bool fullscreen
Whether fullscreen mode was requested.
bool enable_vsync
Enable FIFO present mode / v-sync (--enable-vsync).
int height
Viewport height in pixels (default: 720).
std::string path
Asset root; proc_args() defaults it to the executable directory.
int width
Viewport width in pixels (default: 1280).