MCPcopy Create free account
hub / github.com/MethanePowered/MethaneKit / Present

Method Present

Apps/08-ConsoleCompute/ConsoleComputeApp.cpp:230–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230void ConsoleComputeApp::Present(ftxui::Canvas& canvas)
231{
232 META_FUNCTION_TASK();
233 const data::FrameSize& field_size = GetFieldSize();
234 const data::FrameRect& frame_rect = GetVisibleFrameRect();
235 const uint8_t* cells = m_frame_data.GetDataPtr<uint8_t>();
236 m_visible_cells_count = 0U;
237
238 for (uint32_t y = 0; y < frame_rect.size.GetHeight(); y++)
239 {
240 const uint32_t cell_y = frame_rect.origin.GetY() + y;
241 const uint32_t cell_shift = cell_y * field_size.GetWidth();
242 for (uint32_t x = 0; x < frame_rect.size.GetWidth(); x++)
243 {
244 const uint32_t cell_x = frame_rect.origin.GetX() + x;
245 if (cells[cell_shift + cell_x])
246 {
247 canvas.DrawBlockOn(static_cast<int>(x), static_cast<int>(y));
248 m_visible_cells_count++;
249 }
250 }
251 }
252 m_fps_counter.OnCpuFramePresented();
253}
254
255void ConsoleComputeApp::Restart()
256{

Callers 8

RenderMethod · 0.45
RenderMethod · 0.45
RenderMethod · 0.45
RenderMethod · 0.45
RenderMethod · 0.45
RenderMethod · 0.45
RenderMethod · 0.45

Calls 5

OnCpuFramePresentedMethod · 0.80
GetHeightMethod · 0.45
GetYMethod · 0.45
GetWidthMethod · 0.45
GetXMethod · 0.45

Tested by

no test coverage detected