1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#pragma once
#include "rnd.h"
#include <string>
#include <vector>
#include <filesystem>
#include "SampleApp.hpp"
#define M_PIF 3.14159265359f /* float pi */
#define M_PIF_MULT_2 6.28318530718f
#ifndef M_PI
#define M_PI 3.14159265358979323846 /* pi */
#endif
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661923 /* pi/2 */
#endif
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
namespace fs = std::filesystem;
#define GET_PATH(fileName) (char*)(fs::path(SAMPLES_DATA_ROOT) / fileName).c_str()
typedef enum _shape_t {
SHAPE_LINE,
SHAPE_RECTANGLE,
SHAPE_ROUNDED_RECTANGLE,
SHAPE_CIRCLE,
SHAPE_TRIANGLE,
SHAPE_STAR,
SHAPE_RANDOM,
} shape_t;
class VkvgTest;
typedef void (*VkvgTestFunc) (VkvgTest* test);
class VkvgTest {
VkvgTestFunc testFunc;
public:
static std::vector<VkvgTest*> tests;
SampleApp* app;
std::string name;
VkvgTest(VkvgTestFunc testFunc, std::string _name);
VkvgDevice device;
VkvgSurface surf;
void initTest(SampleApp* app);
void performTest();
void cleanTest();
void draw_random_shape(VkvgContext ctx, shape_t shape, float sizeFact);
void draw_random_curve(VkvgContext ctx);
void draw_random_square(VkvgContext ctx, float s);
};
#define TEST(name) \
static void name(VkvgTest* test); \
static VkvgTest _##name(name, #name); \
static void name(VkvgTest* test)
void draw_growing_circles(VkvgContext ctx, float y, int count);
void randomize_color(VkvgContext ctx);
|