kick
/Users/morten/Programmering/cpp/kick/src/kick/2d/component2d.cpp
00001 //
00002 // Created by morten on 26/07/14.
00003 //
00004 
00005 #include "component2d.h"
00006 #include "canvas.h"
00007 #include <iostream>
00008 
00009 using namespace std;
00010 
00011 namespace kick {
00012 
00013     Component2D::Component2D(GameObject *gameObject, std::shared_ptr<Canvas> canvas) : Component(gameObject), mCanvas(canvas) {
00014     }
00015 
00016     int Component2D::order() const {
00017         return mOrder;
00018     }
00019 
00020     void Component2D::setOrder(int order) {
00021         if (Component2D::mOrder != order) {
00022             Component2D::mOrder = order;
00023             if (mCanvas){
00024                 mCanvas->updateRenderOrder(dynamic_pointer_cast<Component2D>(shared_from_this()));
00025             }
00026         }
00027     }
00028 
00029     void Component2D::deactivated() {
00030         if (mCanvas) {
00031             mCanvas->deregisterComponent2D(dynamic_pointer_cast<Component2D>(shared_from_this()));
00032         }
00033     }
00034 }
 All Classes Functions Variables