GithubHelp home page GithubHelp logo

treeburner's Introduction

Introduction

libtcod is a free, fast, portable and uncomplicated API for roguelike developers providing a true color console, pathfinding, field-of-view, and a few other utilities frequently used in roguelikes.

Status

GitHub Workflow Status Documentation Status codecov GitHub commits since latest release (by date) Packaging status

How do I get set up?

Using Vcpkg

This is the easiest way to get the latest stable version of libtcod for any project.

Libtcod is included as a port in Vcpkg. You can install libtcod via Vcpkg and then link the library using a CMake script as you normally do for that package manager.

As a submodule

This is the best option for testing the development versions of libtcod.

You can include libtcod in a project by adding the libtcod repository as a submodule and then adding that directory to a CMake script. You will want to fork this template project if you plan on starting a project with this setup.

It is expected that Vcpkg will be used, but libtcod's CMake script can be configured to compile without using Vcpkg for dependencies. See CONTRIBUTING.md for details on configuring dependencies.

Using one of our downloads

This is not recommend as these releases are unwieldy, are more difficult to update, and are less cross-platform. Do not upload binary files to your projects source repository.

If you are programming in C or C++ then Windows and MacOS binaries are available from the GitHub Releases page.

Various C/C++ sample projects are included within the repository which can be used as examples of various features.

Keep in mind that as a C++ library, you may need to distribute the appropriate runtime with your program such as the Visual Studio 2015 runtimes or else the program will fail to run.

For those who wish to program in Python you can install python-tcod using this installation guide. Once installed you can follow the Python 3 tutorial or you can find Python example scripts on the python-tcod repository.

A alternative version of the Python library (libtcodpy) exists in the binary downloads, but you should avoid using this version as it is not as well maintained.

Compiling from source

This is only recommended for libtcod developers. See CONTRIBUTING.md.

Getting Started

The latest documentation is here. Currently it's very incomplete, so most people will want to read the 1.6.4 documentation instead. Python users should use the python-tcod documentation.

libtcod comes with a sample application, implementations of which are provided in each of C (samples_c.c), C++ (samples_cpp.cpp), and Python (samples_py.py). This provides a decent overview of the basic features, in an interactive fashion. Each should be identical for the most part, so if you are using Windows, downloading the pre-compiled binaries and running the included samples.exe which is compiled from the C source code, should be representative of the other versions.

Contact / Community

For reporting bugs or requesting features you should use the GitHub Issues page. For smaller questions or help with a tutorial or project you can join #libtcod on the Roguelikes Discord or on the Libera.​Chat IRC.

Sponsors

Sponsors donating $25 or more per month will have their names or logos listed here.

treeburner's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

odiminox

treeburner's Issues

Move screen::Screen into Umbra as UmbraScreen

A useful generic helper class. The only treeburner specific code relates to method TCODImage* loadChapterPicture(bool big = false); and is only used by screen/end.cpp where it can be moved into

Event system refactors.

Currently events are mainly handled by overriding UmbraModule::keyboard and UmbraModule::mouse. These are using libtcod's event system which has known issues. Mostly input lag or silently dropping events depending on how it's being used.

Several classes capture these events and handle them later in their update function. I think is a poor way of handing events and it makes it very hard to refactor them. Some of these might be replaceable with SDL_GetKeyboardState or SDL_GetMouseState.

The latest revision of Umbra adds UmbraModule::onEvent which handles SDL events, but due to how sensitive libtcod's event handing is combined with how the current code relies on several side effects, the event handing will be broken by updating to this version. Which means updating the code to use SDL for events will be a struggle.

Another thing is that SDL provides pixel coordinates which need to be converted by a libtcod function to tile coords for things like window management.

The plan is to remove all overrides of UmbraModule::keyboard and UmbraModule::mouse, and any other calls to libtcod's event system using whatever means possible.

General refactors.

Making a list of various changes to make this code more up-to-date. Most of these are easy on their own. It will just take time to do them all. I've already finished most of these kinds of changes to Umbra.

  • TCODList should be replaced with std::vector in all cases.
  • Remove new/delete from libtcod types. These can be treated as values without major issues. Any exceptions can use smart pointers instead of new.
  • Pointer types should express ownership, ideally with std::unique_ptr, but also std::shared_ptr if necessary. Non-owning pointers would still be raw of course.
  • Class attributes should be initialized. Just put {}; at the end of simple types rather than = nullptr; or = 0;. Any defaults should be moved from the class constructor code to the class itself.
  • Pointers to strings should be replaced with std::string in many cases. Mostly in non-contexpr cases such as class attributes or local variables. In some cases null strings should be replaced with empty strings. Always replace strdup.
  • #define X Y constants should generally be replaced with static constexpr auto X{Y};/static constexpr auto X = Y; constants.
  • #define macros should all be replaced with constexpr functions.
  • Low level calls such as memcpy and strcmp should generally be replaced with high level operations.
  • C-style arrays like int foo[2] should be replaced with std::array<int, 2> foo{}, etc.
  • File operations should use C++17 <filesystem>.
  • For-loops over containers should prefer ranged-based loops. for (auto& x : y);
  • Many class methods are missing const, noexecpt, and [[nodiscard]] qualifiers.
  • Empty constructors and destructors should use = default;, they should not have an empty function in the source.
  • Small functions with few or no dependencies should be moved inline.
  • Functions which take pointers, but don't handle nullptr, should be changed to take references.
  • Macros such as MIN or CLAMP should be replaced by their C++ functions.
  • Virtual class overrides are missing the override qualifier.
  • String formatting functions should use fmt.
  • Temporary local variables which don't change should be qualified with const.
  • Unions should be replaced with std::variant.

In general follow the C++ Core Guidelines.

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.