WOWCube Docs logo
WOWCube Docs
Mission Control
Section Shortcuts
APIExamplesSourceWOWConnectChangelog
Filters
SDK and language defaults persist in cookies.
SDK version
Navigation Tree
Collapsed by default, focused on the active path.
Made byMcKay Seamons
GitHub
  1. Home
  2. Docs
  3. Source
  4. QRCode.cpp
Mission NodeSDK 6.1C++gfx

QRCode.cpp

SDK Source File: QRCode.cpp

Source / SDK 6.1 / C++ / gfx

QRCode.cpp

QRCode.cpp
CPP
1/* Copyright Statement:
2 *
3 * (C) 2021-2024 Cubios Inc. All rights reserved.
4 */
5#include "QRCode.h"
6#include "Screen.h"
7#include "Colors.h"
8
9namespace Cubios
10{
11namespace Gfx
12{
13u32_t QRCode::rtc = 0;
14
15QRCode::QRCode(std::string data, const Cubios::Math::Transform& t):ColorZeros(Cubios::Gfx::Colors::black),ColorOnes(Cubios::Gfx::Colors::white),Size(8)
16{
17 this->Transform = t;
18
19 if(data.size()<256)
20 this->data = data;
21 else
22 this->data = "";
23
24 this->resourceId = this->getNextID();
25}
26
27QRCode::QRCode(std::string data, float x, float y):ColorZeros(Cubios::Gfx::Colors::black),ColorOnes(Cubios::Gfx::Colors::white),Size(8)
28{
29 this->Transform.Position.X = x;
30 this->Transform.Position.Y = y;
31
32 if(data.size()<256)
33 this->data = data;
34 else
35 this->data = "";
36
37 this->resourceId = this->getNextID();
38}
39
40QRCode::QRCode(std::string data, const Cubios::Math::Transform& t, u32_t size):ColorZeros(Cubios::Gfx::Colors::black),ColorOnes(Cubios::Gfx::Colors::white),Size(size)
41{
42 this->Transform = t;
43
44 if(data.size()<256)
45 this->data = data;
46 else
47 this->data = "";
48
49 this->resourceId = this->getNextID();
50}
51
52QRCode::QRCode(std::string data, float x, float y, u32_t size):ColorZeros(Cubios::Gfx::Colors::black),ColorOnes(Cubios::Gfx::Colors::white),Size(size)
53{
54 this->Transform.Position.X = x;
55 this->Transform.Position.Y = y;
56
57 if(data.size()<256)
58 this->data = data;
59 else
60 this->data = "";
61
62 this->resourceId = this->getNextID();
63}
64
65QRCode::QRCode(const QRCode& qr)
66{
67 this->Transform = qr.Transform;
68 this->data = qr.data;
69 this->resourceId = qr.resourceId;
70 this->ColorZeros = qr.ColorZeros;
71 this->ColorOnes = qr.ColorOnes;
72 this->Size = qr.Size;
73}
74
75QRCode::~QRCode() {}
76
77Cubios::SceneObject* QRCode::SetSize(u32_t size)
78{
79 this->Size = size;
80 return this;
81}
82
83Cubios::SceneObject* QRCode::SetColor(const Math::Color& color)
84{
85 this->ColorOnes = color;
86 return this;
87}
88
89Cubios::SceneObject* QRCode::SetBackgroundColor(const Math::Color& color)
90{
91 this->ColorZeros = color;
92 return this;
93}
94
95Cubios::SceneObject* QRCode::SetData(std::string data)
96{
97 if(data.size()<256)
98 this->data = data;
99 else
100 this->data = "";
101
102 return this;
103}
104
105void QRCode::Render()
106{
107 Math::Vec2 pos = this->ScreenPosition();
108 Cubios::GFX_drawQRCode(pos.X, pos.Y, this->Size, this->ColorZeros.Value(),this->ColorOnes.Value(), Transform.SafeRotation()+ScreenAngle, this->resourceId, this->data.c_str());
109}
110}
111}
112
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.
Context Rail

Related nodes

AnimatedSprite.cpp
Source / SDK 6.1 / C++ / gfx
AnimatedSprite.h
Source / SDK 6.1 / C++ / gfx
Background.cpp
Source / SDK 6.1 / C++ / gfx
Background.h
Source / SDK 6.1 / C++ / gfx
Previous Node
OffscreenRenderTarget.h
Source / SDK 6.1 / C++ / gfx
Next Node
QRCode.h
Source / SDK 6.1 / C++ / gfx