Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

PosterScroller.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net)
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  */
00009 #include "PosterScroller.h"
00010 
00011 #include "Picture.h"
00012 #include "OptionAgent.h"
00013 #include "minmax.h"
00014 
00015 //-----------------------------------------------------------------
00016 PosterScroller::PosterScroller(const Path &picture)
00017     : PosterState(picture)
00018 {
00019     m_shift = 0;
00020     m_screenH = 0;
00021 }
00022 //-----------------------------------------------------------------
00023 void
00024 PosterScroller::own_initState()
00025 {
00026     m_screenH = OptionAgent::agent()->getAsInt("screen_height");
00027     m_shift = -m_screenH + SHIFT_SPEED;
00028 }
00029 //-----------------------------------------------------------------
00030 void
00031 PosterScroller::own_updateState()
00032 {
00033     int maxShift = min(m_shift, m_bg->getH() - m_screenH/3);
00034 
00035     m_bg->setLoc(V2(0, -maxShift));
00036     m_shift += SHIFT_SPEED;
00037     if (m_shift > m_bg->getH()) {
00038         quitState();
00039     }
00040 }
00041 

Generated on Wed Jun 1 09:54:31 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2