User Tools

Site Tools


en:tutorials:orxscroll:introduction-orxscroll

An Introduction to Scroll

What is Scroll?

Scroll is a C++ convenience layer built on top of orx.

Features

  • Scroll supports “object binding” to custom classes. This means when an orx object is created, it can automatically be set to use a C++ class choice for its implementation. This makes it easy to implement behavior that is specific to certain object types.
  • Additionally, binding object types to classes makes it easy to handle events on an object-specific basis. For example, each type of game object can have its own OnCreate function which is called whenever an object of that type is created.

Create a new orx/Scroll Project

Create a new orx/Scroll project by following the steps here.

You should also be familiar with the concepts of inheritance and polymorphism and how to use them in C++.

Trouble?

If you encounter trouble at runtime, check the console log output or debug assertions for error messages. Make sure your Orx config .ini file is loading at runtime and is complete. At a minimum, the config file must define the Display, MainViewport, and MainCamera sections.

If you have trouble following this tutorial, please reach out in the #support channel on Discord.

Getting the Sources

Getting started with Scroll is easy. Scroll is included with orx and included by default when initializing a new project.

Creating the Project

You can find instructions for creating a new project here: creating a new Orx project.

About the Scroll class

The Scroll class is the main class in a Scroll project. It is contained in Scroll.h/Scroll.inl. This class is where the game is initialized and the “main loop” runs. You don’t use the Scroll class directly, though. Instead, init creates a class deriving from it in new projects.

Run It

You can now build and run your project. The Init, Run, and Exit functions will work in the normal way and you can apply all your knowledge of Orx in this class.

What’s the Big Deal?

This is just the same class as the standalone tutorial, you might be thinking. So far, you’re correct. What we’ve created in this tutorial is the bare minimum running Scroll project. The advantages of Scroll come in all the other functions available in the Scroll classes. Look into the header files to see what is available in the Scroll code; these features will be covered in future tutorials.

The next tutorial will introduce object creation (the Scroll way) and object binding.

en/tutorials/orxscroll/introduction-orxscroll.txt · Last modified: 2024/05/04 18:46 (6 months ago) by hcarty