Giter VIP home page Giter VIP logo

Comments (6)

audebert avatar audebert commented on August 15, 2024

Couldn't it be written as a template?

It would be quite helpful to specify in a comment in which corner of the screen is (0, 0) located to avoid the usual confusion.

Depending on the context "inside" may confuse the reader, I'd rename is_inside() to valid().

Also, s/custompos/name/ in the sample code.

from stechec2.

zopieux avatar zopieux commented on August 15, 2024

Yeah please don't use macros unless made absolutely necessary by lack of language support. Let alone 100 line macros ☹️ .

from stechec2.

Shaac avatar Shaac commented on August 15, 2024

This kind of feature is not possible with templates. At least not unless there is some reflexivity in the language, which may be possible with c++20.
If we were to do this in C++, the macro is the only way to go.

But since this is one ugly macro, we probably do not want to use it. I added it for reference. The best way to go is to generate a file with what would be the expansion of this macro. stechec2-generator could write the C++ file directly. Note that it is not very different to have it done by, ruby, python, or a C++ macro, but at least once the code is generated, we have some clean C++ code.

Also with c++20, we will be able to get rid of the comparison operators, but this is in a long time.

I have indeed forgotten to remove custompos for the macro, I’ll edit the post.

from stechec2.

seirl avatar seirl commented on August 15, 2024

So, what is the problem in simply copy pasting the file from year to year?

from stechec2.

Shaac avatar Shaac commented on August 15, 2024

It makes writing the rules slower. And copy/pasting is often a bad thing.

from stechec2.

seirl avatar seirl commented on August 15, 2024

From a discussion on IRC, I think we agree on the fact that this is like a third party dependency you would inline like a stackoverflow snippet etc, and it's game-specific so there's little need to generate that.

from stechec2.

Related Issues (20)

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.