multiSurface.cpp

00001 /*
00002   重ね合わせサーフェス
00003   Satofumi KAMIMURA
00004   $Id$
00005 */
00006 
00007 #include "multiSurface.h"
00008 
00009 
00010 MultiSurface::  MultiSurface(const VXV::Rect& size) {
00011   w = size.w;
00012   h = size.h;
00013 }
00014 
00015 
00016 MultiSurface::~MultiSurface(void) {
00017 }
00018 
00019 
00020 bool MultiSurface::draw(const VXV::Rect& size, const VXV::Grid& pos,
00021                         unsigned long ticks) {
00022 
00023   for (surface_t::iterator it = objs.begin();
00024        it != objs.end(); ++it) {
00025     it->surface->draw(it->range, pos + it->offset, ticks);
00026   }
00027   return true;
00028 }
00029 
00030 
00031 void MultiSurface::addSurface(SurfaceInterface* surface, char align,
00032                               const VXV::Grid& pos) {
00033   surfaceOffset_t surfaceInfo;
00034   surfaceInfo.surface = surface;
00035 
00036   // 表示位置の調整
00037   // !!! animationSurface.cpp, componentInterface.cpp との共通化をはかる
00038   surfaceInfo.offset.x = 0;
00039   if (align & VXV::Center) {
00040     surfaceInfo.offset.x = w/2 - surface->w/2;
00041   } else if (align & VXV::Right) {
00042     surfaceInfo.offset.x = w - surface->w;
00043   }
00044   surfaceInfo.offset.y = 0;
00045   if (align & VXV::Middle) {
00046     surfaceInfo.offset.y = h/2 - surface->h/2;
00047   } else if (align & VXV::Bottom) {
00048     surfaceInfo.offset.y = h - surface->h;
00049   }
00050 
00051   // !!! はみ出しについての計算 
00052   surfaceInfo.range = VXV::Rect(surface->w, surface->h);
00053 
00054   objs.push_back(surfaceInfo);
00055 }
00056 

Generated on Mon Apr 13 22:52:02 2009 by  doxygen 1.5.7.1