This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
en:tutorials:orxscroll:introduction-orxscroll [2022/07/14 05:28 (3 years ago)] – [Before You Begin] sausage | en:tutorials:orxscroll:introduction-orxscroll [2024/05/04 18:46 (11 months ago)] (current) – Update to be closer to the latest version of Scroll and its integration with orx hcarty | ||
---|---|---|---|
Line 2: | Line 2: | ||
===== What is Scroll? ===== | ===== What is Scroll? ===== | ||
- | Scroll is a small set of C++ files that allow you to use the object-oriented features | + | Scroll is a C++ convenience layer built on top of orx. |
===== Features ===== | ===== Features ===== | ||
- | * Scroll supports “object binding” to custom classes. This means when a Scroll Object | + | * Scroll supports “object binding” to custom classes. This means when an orx object |
- | * Additionally, | + | * Additionally, |
- | * Scroll supports saving and loading of .map files for easier Scene management. Scroll includes an embedded [[en: | + | |
{{page> | {{page> | ||
Line 16: | Line 15: | ||
===== Trouble? ===== | ===== 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, | + | 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 '' |
- | If you have any trouble following this tutorial, | + | If you have trouble following this tutorial, |
===== Getting the Sources ===== | ===== Getting the Sources ===== | ||
- | Getting started with Scroll is easy. Scroll is maintained in a [[https:// | + | Getting started with Scroll is easy. Scroll is included |
- | + | ||
- | You can clone the latest version of Scroll | + | |
- | + | ||
- | < | + | |
- | + | ||
- | Otherwise, you can download the source code directly from GitHub here: https:// | + | |
===== Creating the Project ===== | ===== Creating the Project ===== | ||
- | You can find instructions for this here: [[en: | + | You can find instructions for creating a new project |
- | + | ||
- | Then, extract the Scroll files to their own directory. Add that directory to the include path of the Orx project. | + | |
===== About the Scroll class ===== | ===== About the Scroll class ===== | ||
- | The Scroll class is the main class in a Scroll project. It is contained in Scroll.h/ | + | The Scroll class is the main class in a Scroll project. It is contained in '' |
- | + | ||
- | ===== Deriving from the Scroll class ===== | + | |
- | + | ||
- | To derive from the Scroll class, first create the interface for the derived class. Add a new header file to the project called OrxScroll.h. Add the following code to it: | + | |
- | + | ||
- | <code c> | + | |
- | #ifndef __ORXSCROLL_H_ | + | |
- | #define __ORXSCROLL_H_ | + | |
- | + | ||
- | //! Includes | + | |
- | // The following define skips compilation of ScrollEd (map editor) for now | + | |
- | #define __NO_SCROLLED__ | + | |
- | #include " | + | |
- | + | ||
- | //! OrxScroll class | + | |
- | class OrxScroll : public Scroll< | + | |
- | { | + | |
- | public: | + | |
- | + | ||
- | private: | + | |
- | //! Initialize the program | + | |
- | virtual orxSTATUS Init (); | + | |
- | //! Callback called every frame | + | |
- | virtual orxSTATUS Run (); | + | |
- | //! Exit the program | + | |
- | virtual void Exit (); | + | |
- | }; | + | |
- | + | ||
- | #endif // __ORXSCROLL_H_ | + | |
- | </ | + | |
- | + | ||
- | This class interface should look familiar to anyone who has created a standalone application | + | |
- | + | ||
- | Now, let’s create the implementation. Add a new file called OrxScroll.cpp to your project and add the following code: | + | |
- | + | ||
- | <code c> | + | |
- | //! Includes | + | |
- | // The following define/ | + | |
- | // done before including the interface of the class deriving from | + | |
- | // Scroll (as follows). | + | |
- | #define __SCROLL_IMPL__ | + | |
- | #include " | + | |
- | #undef __SCROLL_IMPL__ | + | |
- | + | ||
- | orxSTATUS OrxScroll:: | + | |
- | { | + | |
- | orxSTATUS result = orxSTATUS_SUCCESS; | + | |
- | + | ||
- | return result; | + | |
- | } | + | |
- | + | ||
- | orxSTATUS OrxScroll:: | + | |
- | { | + | |
- | orxSTATUS result = orxSTATUS_SUCCESS; | + | |
- | + | ||
- | return result; | + | |
- | } | + | |
- | + | ||
- | void OrxScroll:: | + | |
- | { | + | |
- | } | + | |
- | + | ||
- | int main (int argc, char **argv) | + | |
- | { | + | |
- | // Executes game | + | |
- | OrxScroll:: | + | |
- | + | ||
- | // Done! | + | |
- | return EXIT_SUCCESS; | + | |
- | } | + | |
- | </ | + | |
===== Run It ===== | ===== 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. | + | You can now build and run your project. The '' |
===== What’s the Big Deal? ===== | ===== What’s the Big Deal? ===== | ||
Line 120: | Line 40: | ||
The [[en: | The [[en: | ||
+ |