All pastes #360717 Raw Edit

Stle

public cpp v1 · immutable
·published 2007-02-17 18:15 UTC
rendered paste body
#include <iostream>#include <zengine.hpp>void on_event(Zen::Event);int main(int argc, char* argv[]){        try {                Zen::Display display(450, 350, Zen::HARDWARE);                Zen::Input input;                // Connect the event signal to a function                input.signal_event.connect(sigc::ptr_fun(&on_event));                // Here we create an instance of Zen::Object and loads and image to it                // Set the colorkey                // And set the coordinates                Zen::Object image("gfx/image.jpg");                image.set_colorkey(Zen::Color(0, 0, 255));                image.set_coordinate(Zen::Coord(display.width()/2-image.width()/2,                                                                                display.height()/2-image.height()/2));                // We create another object...                 Zen::Object object("gfx/object.gif");                object.set_colorkey(Zen::Color(255, 255, 255));                object.set_coordinate(Zen::Coord(image.width()/2-object.width()/2,                                                                                image.height()/2-object.height()/2));                // Here we blit the second object to the first object                object.blit_to(&image);                // Register image to the display                display.register_object(&image);                // The main game loop...                while(true) {                        input.read();                        display.show();                }        } catch(Zen::Exception& e) {                std::cout << e.what() << std::endl;        }        return 0;}void on_event(Zen::Event ee){        if(ee.keydown() == 'q')                std::exit(0);}