MCPcopy Create free account
hub / github.com/WinDurango/WinDurango / AddVisual

Method AddVisual

projects/WinDurango.Testing/App.cpp:124–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122 }
123
124 void AddVisual(float2 const point)
125 {
126 Compositor compositor = m_visuals.Compositor();
127 SpriteVisual visual = compositor.CreateSpriteVisual();
128
129 static Color colors[] = {
130 {0xDC, 0x5B, 0x9B, 0xD5}, {0xDC, 0xED, 0x7D, 0x31}, {0xDC, 0x70, 0xAD, 0x47}, {0xDC, 0xFF, 0xC0, 0x00}};
131
132 static unsigned last = 0;
133 unsigned const next = ++last % _countof(colors);
134 visual.Brush(compositor.CreateColorBrush(colors[next]));
135
136 float const BlockSize = 100.0f;
137
138 visual.Size({BlockSize, BlockSize});
139
140 visual.Offset({
141 point.x - BlockSize / 2.0f,
142 point.y - BlockSize / 2.0f,
143 0.0f,
144 });
145
146 m_visuals.InsertAtTop(visual);
147
148 m_selected = visual;
149 m_offset.x = -BlockSize / 2.0f;
150 m_offset.y = -BlockSize / 2.0f;
151 }
152};
153
154int __stdcall main()

Callers

nothing calls this directly

Calls 1

SizeMethod · 0.45

Tested by

no test coverage detected