mgradwohl / modernlife Goto Github PK
View Code? Open in Web Editor NEWConway's Game of Life in C++/WinRT/WinAppSDK/WinUI 3
Conway's Game of Life in C++/WinRT/WinAppSDK/WinUI 3
Some shapes work best without wrapping e.g. gliders should fall off the flat earth instead of circumnavigating.
Make it two canvases
Avoid partial construction by implementing copy/move assignment operators/constructors.
e.g. look at Board, Renderer, FPScounter, etc.
instead of constructing in mainwindow.h and then calling Attach(), Start() etc, which means the object isn't correctly initialized until those are called, see if you can implement this pattern.
MainWindow.h
fpscounter fps{nullptr_t}
MainWindow.cpp
fps = fps(foo, bar, blah);
For example Renderer.h has
Microsoft::Graphics::Canvas::CanvasRenderTarget _spritesheet{ nullptr };
Which isn't truly initialized until
Renderer.cpp
_spritesheet = Microsoft::Graphics::Canvas::CanvasRenderTarget(_canvasDevice, _spriteDipsPerRow, _spriteDipsPerRow, _dpi);
For example, DayAndNight should have a maxage of 10,000
Speed on some of the RuleSets should be slowed down
Etc.
Probably https://github.com/gabime/spdlog
Need a settings panel that lets users choose
Colors
ruleset
etc.
age is currenlty 4 bytes. 16 should be fine.
With life expectancy being defined by users
Each frame 8 std::threads are constructed, execute, and are destructed.
Investigate moving to Windows thread pool https://learn.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/concurrency-2
This should enable multiple board renderers to enable things like WireWorld, Langston's Ant, etc. and cleanup MainWindow
Allow users to Load shapes (that ship included)
Draw and Save their own shapes
On some machines, this code is correct, on others it is not.
// TODO doesn't work at all monitor DPIs http://microsoft.github.io/Win2D/WinUI3/html/DPI.htm
const int wndWidth = theCanvas().ConvertDipsToPixels(bestcanvassize + 240, CanvasDpiRounding::Ceiling);
const int wndHeight = theCanvas().ConvertDipsToPixels(bestcanvassize + 40, CanvasDpiRounding::Ceiling);
//const int wndWidth = bestcanvassize + 240;
//const int wndHeight = bestcanvassize + 40;
appWnd.ResizeClient(Windows::Graphics::SizeInt32{ wndWidth, wndHeight });
Make sure that each rectangle has no interior padding (no padding gets copied when it's drawn to the front buffer) but there is external padding in the background color. And use https://microsoft.github.io/Win2D/WinUI3/html/T_Microsoft_Graphics_Canvas_CanvasSpriteOptions.htm CanvasSpriteOptions::ClampToSourceRect so that no stray pixels are copied.
This may require saving a .modernlife alongside each .cells with the preview and any other preferences like should the edges wrap or not, speed, location to place shape (center, left, right, etc) and a canvas preview thumbnail (would not be great for huge shapes).
Let users
Load boards
Draw boards (including from a shapeset)
Save boards
Boards should include the ruleset used (Conway, Brian's brain, etc.)
float width = max(huge.Width, 5000);
float height = max(huge.Height, 5000);
Because the front buffer and back buffer are created at different DPI. I bet the cell is a delta of 96/_dpi from the mouse pointer. Either creat front buffer at same DPI or scale the points before they get sent to renderer method to find Grid
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.