Giter VIP home page Giter VIP logo

astardemo's Introduction

Update

Since the respective C++/WinRT ticket for C++20 support has been closed, there is no use waiting for C++20 modules support, thus this effort is now archived.

Introduction

This is a port from an old application that was original written in a mix of C++14, Java and C++/CX.

Originaly the goal was to use a simple implementation of the A* search algorithm as basis for experimenting with writing a portable C++ based application application between Android and Windows (UWP) mobile platforms, as learning process for what it would entail to make it without using relying on third party libraries.

Now with the desmise of C++/CX and my focus on Windows development, I have decided to port the application from C++/CX into C++/WinRT.

With the goal being to learn about how to write proper C++/WinRT, the application remains as bare bones as in the previous learning experience, and got thiner as I removed the Android related code.

Then in 2021, after Visual C++ support for C++20 modules in UWP finally became stable enough, I managed to modularize the code, and also did some modern C++ related improvements.

There are thousands of fancy demo samples with tile engines and A*, this is not one of them, the only goal was to play with C++ language features.

C++ 20 Modules, Visual C++ and C++/WinRT

Although I managed to make it work, there is still plenty of work to do from Microsoft side.

  • Using header units triggers endless amount of macro redefinition warnings
  • C++/WinRT and XAML compiler don't understand modules, hence the strange import statements done on header files
  • Also why several places header files are included via global module fragments
  • Intelisense gives up most of the time and ctrl+space does nothing, or shows plenty of reds while it compiles just fine
  • Static analysis doesn't understand modules and fails to process any code
  • You might need to kill Visual Studio when trying to navigate across modules as it occasionally hangs
  • Mixing modules with pre-compiled headers on the same project doesn't work, so either split into two projects or disable pre-compiled headers

Still all in all, it is quite remarkable that it is working, and it can only get better.

Code Structure

The code is written in C++/WinRT, targeting Visual 2019 or later, composed of the following projects:

AStarDemo - The Windows UWP applications using C++/WinRT;

AStarDemoLib - The A* search algorithm implemented in portable modern C++ code, using modules.

AStarDemoLibTests - The unit tests for the A* library written with help of Google Tests testing framework.

Building

It is only required to open the project solution located at AStarDemo/AStarDemo.sln and do a full build.

Requirements

  • Visual Studio 2019 16.11.15 or later;
  • Windows SDK, including UWP workload

References

The wonderful A* tutorials from Amit Patel.

Tilesets

The tiles were taken from http://opengameart.org/content/simple-tileset

License

This example application is under GPL2 (except for the code generated by the Visual C++ project wizard).

astardemo's People

Contributors

pjmlp avatar

Stargazers

Vasyl Vavrychuk avatar  avatar Valentin Milea avatar Media Explorer avatar Markus avatar Márk Bartos avatar Liu Ruoyang avatar  avatar hansi raber avatar  avatar

Watchers

 avatar

Forkers

gamezoo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.