AnoPlib - Animlets are not Particles library
 All Data Structures Namespaces Files Functions Variables
AnoPtentacle1.h
Go to the documentation of this file.
00001 /* *************************************************************************
00002    @file       AnoPtentacle1.h
00003    @project    AnoPlib
00004    @module     AnoPtentacle1
00005    @brief      Four moving tentacle arms
00006    @date       23.11.2010
00007    @copyright  Daniel Krajzewicz
00008    @licence    GPL
00009    @author     Daniel Krajzewicz
00010    @email      d.krajzewicz@googlemail.com
00011    ------------------------------------------------------------------
00012     AnoPlib - small "animlet" library, see http://sf.net/projects/anoplib
00013     Copyright (C) 2009-2010 Daniel Krajzewicz
00014 
00015     This program is free software: you can redistribute it and/or modify
00016     it under the terms of the GNU General Public License as published by
00017     the Free Software Foundation, either version 3 of the License, or
00018     (at your option) any later version.
00019 
00020     This program is distributed in the hope that it will be useful,
00021     but WITHOUT ANY WARRANTY; without even the implied warranty of
00022     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023     GNU General Public License for more details.
00024 
00025     You should have received a copy of the GNU General Public License
00026     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00027    ------------------------------------------------------------------
00028    Remarks:
00029    ------------------------------------------------------------------
00030    ToDo:
00031  * *********************************************************************** */
00032 #ifndef ANOP_TENTACLE1
00033 #define ANOP_TENTACLE1
00034 
00035 
00036 /* =========================================================================
00037  * included modules
00038  * ======================================================================= */
00039 #include <AnoP.h>
00040 #include <AnoPhelpers.h>
00041 #include <GL/gl.h>
00042 
00043 
00044 /* =========================================================================
00045  * class and struct definitions
00046  * ======================================================================= */
00050 class AnoPtentacle1 : public AnoP::AnoPsystem<int> {
00051 public:
00055     AnoPtentacle1(unsigned int bufSize=10) : AnoP::AnoPsystem<int>(bufSize) {
00056         pos = 0;
00057     }
00058 
00059 
00062     void preRender() throw() {
00063         glMatrixMode(GL_PROJECTION);
00064         glLoadIdentity();
00065         glMatrixMode(GL_MODELVIEW);
00066         glLoadIdentity();
00067         glScaled(1./10, 1./10, 1.);
00068         glPushMatrix();
00069         glEnable (GL_BLEND);
00070         glBlendFunc(GL_ONE, GL_ONE);
00071         glDepthMask(GL_FALSE);
00072         pos = pos + 1;
00073         if(pos>=360) {
00074             pos = pos - 360;
00075         }
00076         glPopMatrix();
00077     }
00078 
00079 
00085     bool render(int &s, unsigned int timeDiff, void * const something) throw() {
00086         if(s%10==0) {
00087             glPopMatrix();
00088             glRotated(90., 0, 0, 1);
00089             glPushMatrix();
00090         }
00091         glRotated(AnoPhelpers::sintab[pos]/16., 0, 0, 1);
00092         glTranslated(2.2, 0, 0);
00093         glScaled(.8,.8,.8);
00094         glColor3f(1,1,1);
00095         glBegin(GL_QUADS);
00096         glVertex3f(-1,-1,0);
00097         glVertex3f(-1,1,0);
00098         glVertex3f(1,1,0);
00099         glVertex3f(1,-1,0);
00100         glEnd();
00101         return true;
00102     }
00103 
00105     int pos;
00106 
00107 };
00108 
00109 #endif