MXVK Vulkan Framework 0.24.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
point.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 <array>
#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>

Go to the source code of this file.

Classes

class  example::PointSpriteWindow
struct  anonymous_namespace{point.cpp}::TuxSprite

Namespaces

namespace  anonymous_namespace{point.cpp}
namespace  example

Functions

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

Variables

constexpr int anonymous_namespace{point.cpp}::DEFAULT_TUXES = 8
constexpr int anonymous_namespace{point.cpp}::FRAME_COUNT = 16
constexpr int anonymous_namespace{point.cpp}::INITIAL_PLACEMENT_ATTEMPTS = 200
constexpr float anonymous_namespace{point.cpp}::MAX_SIZE = 450.0f
constexpr float anonymous_namespace{point.cpp}::MAX_SIZE_SCALE = 2.0f
constexpr int anonymous_namespace{point.cpp}::MAX_TUXES = 1000
constexpr float anonymous_namespace{point.cpp}::MIN_SIZE = 306.0f
constexpr float anonymous_namespace{point.cpp}::MIN_SIZE_SCALE = 0.6f
constexpr float anonymous_namespace{point.cpp}::POPULATION_GROWTH_INTERVAL = 0.18f
constexpr float anonymous_namespace{point.cpp}::SIZE_SCALE_STEP = 1.12f
constexpr float anonymous_namespace{point.cpp}::SPRITE_COLLISION_SCALE = 0.44f
constexpr int anonymous_namespace{point.cpp}::TUXES_PER_SPACE_PRESS = 25
constexpr float anonymous_namespace{point.cpp}::WORLD_HALF_HEIGHT = 4.5f

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 381 of file point.cpp.

381 {
382 try {
383 const Arguments args = proc_args(argc, argv);
384 const std::string root = args.path.empty() ? std::string(POINTSPRITE_ASSET_DIR) : args.path;
385 example::PointSpriteWindow window(root + "/data", args.width, args.height, args.fullscreen, args.enable_vsync);
386 window.loop();
387 } catch (mxvk::Exception &e) {
388 std::cerr << std::format("mxvk: Exception: {}\n", e.text());
389 return EXIT_FAILURE;
390 } catch (ArgException<std::string> &e) {
391 std::cerr << std::format("mxvk: Argument Exception: {}\n", e.text());
392 return EXIT_FAILURE;
393 }
394
395 return EXIT_SUCCESS;
396}
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