MXVK Vulkan Framework 0.24.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
fireworks.cpp File Reference
#include "mxvk/argz.hpp"
#include "mxvk/mxvk.hpp"
#include "mxvk/mxvk_exception.hpp"
#include "mxvk/mxvk_point_sprite_batch.hpp"
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <format>
#include <iostream>
#include <random>
#include <string>
#include <vector>
#include <glm/ext/matrix_clip_space.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/glm.hpp>
#include <glm/gtc/random.hpp>

Go to the source code of this file.

Classes

struct  anonymous_namespace{fireworks.cpp}::Explosion
class  example::FireworksWindow
struct  anonymous_namespace{fireworks.cpp}::Particle

Namespaces

namespace  anonymous_namespace{fireworks.cpp}
namespace  example

Functions

int main (int argc, char **argv)
float anonymous_namespace{fireworks.cpp}::random_float (float min, float max)

Variables

constexpr std::size_t anonymous_namespace{fireworks.cpp}::MAX_EXPLOSIONS = 256
constexpr float anonymous_namespace{fireworks.cpp}::MAX_LIFETIME = 2.0f
constexpr std::size_t anonymous_namespace{fireworks.cpp}::MAX_PARTICLES = PARTICLES_PER_EXPLOSION * MAX_EXPLOSIONS
constexpr float anonymous_namespace{fireworks.cpp}::MIN_LIFETIME = 0.5f
constexpr float anonymous_namespace{fireworks.cpp}::PARTICLE_SIZE = 25.0f
constexpr float anonymous_namespace{fireworks.cpp}::PARTICLE_SPEED = 1.0f
constexpr std::size_t anonymous_namespace{fireworks.cpp}::PARTICLES_PER_EXPLOSION = 250

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 222 of file fireworks.cpp.

222 {
223 try {
224 const Arguments args = proc_args(argc, argv);
225 const std::string root = args.path.empty() ? std::string(FIREWORKS_ASSET_DIR) : args.path;
226 example::FireworksWindow window(root + "/data", args.width, args.height, args.fullscreen, args.enable_vsync);
227 window.loop();
228 } catch (mxvk::Exception &e) {
229 std::cerr << std::format("mxvk: Exception: {}\n", e.text());
230 return EXIT_FAILURE;
231 } catch (ArgException<std::string> &e) {
232 std::cerr << std::format("mxvk: Argument Exception: {}\n", e.text());
233 return EXIT_FAILURE;
234 }
235
236 return EXIT_SUCCESS;
237}
Arguments proc_args(int &argc, char **argv)
Parse standard libmx2 command-line options from main()'s argv.
Definition argz.hpp:872
Exception thrown by Argz::proc() on unrecognised or malformed options.
Definition argz.hpp:178
String text() const
Definition argz.hpp:182
std::string text() const
Plain data structure returned by proc_args() with all common libmx2 CLI options.
Definition argz.hpp:730
bool fullscreen
Whether fullscreen mode was requested.
Definition argz.hpp:736
bool enable_vsync
Enable FIFO present mode / v-sync (--enable-vsync).
Definition argz.hpp:750
int height
Viewport height in pixels (default: 720).
Definition argz.hpp:733
std::string path
Asset root; proc_args() defaults it to the executable directory.
Definition argz.hpp:735
int width
Viewport width in pixels (default: 1280).
Definition argz.hpp:732