Book Image

Irrlicht 1.7 Realtime 3D Engine Beginner's Guide

By : Johannes Stein, Aung Sithu Kyaw
Book Image

Irrlicht 1.7 Realtime 3D Engine Beginner's Guide

By: Johannes Stein, Aung Sithu Kyaw

Overview of this book

<p>The Irrlicht Engine is a cross-platform high-performance real-time 3D engine written in C++. It features a powerful high-level API for creating complete 3D and 2D applications such as games or scientific visualizations.<br /><br />Irrlicht 1.7 Realtime 3D Engine Beginner's Guide will teach you to master all that is required to create 2D and 3D applications using Irrlicht, beginning right from installation and proceeding step-by-step to deployment.<br /><br />Beginning with installation, this book guides you through creating a basic template application, followed by meshes, overlays, and UI. You will then scan through data types, nodes, scenes, camera, lights, and particle systems. Finally, you will learn about some advanced concepts such as handling data, files, and shaders, followed by the last stage – deployment.</p>
Table of Contents (21 chapters)
Irrlicht 1.7 Realtime 3D Engine
Credits
About the Authors
Acknowledgement
About the Reviewer
www.PacktPub.com
Preface

Time for action - activating a particle effect on a mouse event


In the last part of this chapter, we'll extend the particle system we've created in previous tutorials to emit the particles only when you are pressing down the left mouse button. We'll cover how to receive mouse events, how to check the state of the particle system, and decide whether to start or stop the emission:

  1. 1. First, we need to create an event receiver class which extends from the IEventReceiver class. Following is a simple modification from Irrlicht's mouse and joystick example tutorial. We just removed the joystick part:

    class MyEventReceiver : public IEventReceiver
    {
    public:
    //We'll create a struct to record info on the mouse state
    struct SMouseState
    {
    bool LeftButtonDown;
    SMouseState() : LeftButtonDown(false) { }
    } MouseState;
    virtual bool OnEvent(const SEvent& event)
    {
    if (event.EventType == irr::EET_MOUSE_INPUT_EVENT)
    {
    switch(event.MouseInput.Event)
    {
    case EMIE_LMOUSE_PRESSED_DOWN:
    MouseState.LeftButtonDown...