void Mouse::setBScared(bool bScared) { IW_CALLSTACK("Mouse::setBScared"); this->bScared = bScared; this->fShininess = 50; }
LevelNavigationButton::LevelNavigationButton(CIwSVec2 menuPosition, CIwSVec2 offset, CIwSVec2 size, bool mainMenu) : MenuButton() { IW_CALLSTACK("LevelNavigationButton::LevelNavigationButton"); this->i2Size = size; this->i2RegionSize = size; this->i2Offset = offset; this->i2Position = menuPosition + this->i2Offset; this->brBoundingBox = BoundingRectangle(this->i2Position, this->i2Size); this->sName = "levelnavigationbutton"; if(mainMenu == true) { this->tTextureList.push_back(ImageManager::getImage("kittyplay")); this->tTextureList.push_back(ImageManager::getImage("kittyplay2")); } else { this->tTextureList.push_back(ImageManager::getImage("kittysidebutton_levels")); this->tTextureList.push_back(ImageManager::getImage("kittysidebutton_levels2")); } this->sSoundList.push_back(SoundManager::getSound("menu2")); this->sSoundList.push_back(SoundManager::getSound("menu8")); ClassTracker::addUnit(this); }
bool Mouse::regularMove() { IW_CALLSTACK("Mouse::regularMove"); CIwFVec2 ftemp = this->f2AbsPosition; if(this->bScared == true) { } else { if(this->bMoveLeft == true) { this->f2AbsPosition.x -= this->f2Velocity.x * this->iTime * Screen::getMOVEMULTIPLIER().x; if(checkPosition()) this->i2Position.x = (int)this->f2AbsPosition.x; else this->f2AbsPosition = ftemp; } else { this->f2AbsPosition.x += this->f2Velocity.x * this->iTime * Screen::getMOVEMULTIPLIER().x; if(checkPosition()) this->i2Position.x = (int)this->f2AbsPosition.x; else this->f2AbsPosition = ftemp; } } return false; }
void Mouse::update(uint64 time) { IW_CALLSTACK("Mouse::update"); if(GameState::getState() != GameState::PLAY) { return; } this->iTime = time; this->iTimePassed += time; this->brBoundingBox.setPosition(this->getPosition(), true); if(this->bDead == false) { if(this->bUpdate == true) { this->iSoundIndex = IwRandMinMax(0, 4); this->bDead = true; this->bDrawn = true; this->bUpdate = false; this->setNotShiny(); for(int i = 0; i < (int)uAffectList.size(); ++i) { dynamic_cast<ShinyUnit*>(this->uAffectList[i])->setNotShiny(); dynamic_cast<Food*>(this->uAffectList[i])->bEmpty = true; } } } ShinyUnit::update(); }
void FontManager::ShutDown() { IW_CALLSTACK("FontManager::ShutDown"); tiFontLibrary.clear(); IwGxFontTerminate(); }
Mouse::Mouse(CIwSVec2 i2Position): ShinyUnit() { IW_CALLSTACK("Mouse::Mouse"); this->iAIHole = 10; this->bUpdate = false; this->bDead = false; this->bScared = false; this->f2Velocity = CIwFVec2(0.101f, 0); this->tTextureList.push_back(ImageManager::getImage("mouse")); this->tTextureList.push_back(ImageManager::getImage("mouseleft")); this->sSoundList.push_back(SoundManager::getSound("mouse1")); this->sSoundList.push_back(SoundManager::getSound("mouse2")); this->sSoundList.push_back(SoundManager::getSound("mouse3")); this->sSoundList.push_back(SoundManager::getSound("mouse4")); this->i2Position = i2Position; this->f2AbsPosition = CIwFVec2((float)this->i2Position.x, (float)this->i2Position.y); this->i2InitialPosition = i2Position; this->sName = "mouse"; this->fShininess = 6; this->bIsMoving = true; this->brBoundingBox = BoundingRectangle(this->getPosition(), this->getSize(), CIwSVec2((int)(this->i2Size.x * 0.3f), (int)(this->i2Size.y * 0.3f)), true); this->csPlayWith = CatState::MOUSEPLAYING; ClassTracker::addUnit(this); }
CCEGLView::CCEGLView() : m_bCaptured(false) , m_bAccelState(false) , m_Key(s3eKeyFirst) { IW_CALLSTACK("CCEGLView::CCEGLView"); IwGLInit(); setFrameSize((float)IwGLGetInt(IW_GL_WIDTH), (float)IwGLGetInt(IW_GL_HEIGHT)); // Determine if the device supports multi-touch m_isMultiTouch = s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE) ? true : false; // For multi-touch devices we handle touch and motion events using different callbacks if (m_isMultiTouch) { s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, &MultiTouchEventHandler, this); s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, &MultiMotionEventHandler, this); } else { // Register pointer touch button event handler s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, &TouchEventHandler, this); // Register pointer motion button event handler s3ePointerRegister(S3E_POINTER_MOTION_EVENT, &MotionEventHandler, this); } // Register keyboard event handler // s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, &KeyEventHandler, this); // s3eKeyboardRegister(S3E_KEYBOARD_CHAR_EVENT, &CharEventHandler, this); }
void CCEGLView::end() { IW_CALLSTACK("CCEGLView::end"); if (m_isMultiTouch) { s3ePointerUnRegister(S3E_POINTER_TOUCH_EVENT, &MultiTouchEventHandler); s3ePointerUnRegister(S3E_POINTER_TOUCH_MOTION_EVENT, &MultiMotionEventHandler); } else { s3ePointerUnRegister(S3E_POINTER_BUTTON_EVENT, &TouchEventHandler); s3ePointerUnRegister(S3E_POINTER_MOTION_EVENT, &MotionEventHandler); } // s3eKeyboardUnRegister(S3E_KEYBOARD_KEY_EVENT, &KeyEventHandler); // s3eKeyboardUnRegister(S3E_KEYBOARD_KEY_EVENT, &CharEventHandler); if (IwGLIsInitialised()) IwGLTerminate(); s3eDeviceRequestQuit() ; delete this; }
// maps pages number to its background for the levelnavigation // these values will eventually need to be changed void BackgroundManager::loadBackground(int pageNum) { IW_CALLSTACK("BackgroundManager::LoadBackground"); string backgroundName =""; CIwArray<string> extras = CIwArray<string>(); switch (pageNum) { case 0: backgroundName = "mountains"; extras.push_back("cloud"); extras.push_back("bird"); extras.push_back("bird"); extras.push_back("bird"); extras.push_back("bird"); break; case 1: backgroundName = "industrial"; extras.push_back("gear"); break; case 2: backgroundName = "demoneyes"; extras.push_back("spiral"); break; } this->loadBackground(backgroundName, extras); }
void LevelNavigationButton::update(uint64 time) { IW_CALLSTACK("LevelNavigationButton::update"); this->iTime = time; this->iTimePassed += time; if(this->bPressed == true) { this->iTextureIndex = 1; } else { this->iTextureIndex = 0; } if(this->bUpdate == true) { if(GameState::getState() == GameState::MAINMENU) { SoundManager::playSound(this->sSoundList[1]); } else { SoundManager::playSound(this->sSoundList[0]); } GameState::setState(GameState::LEVELNAVIGATION); this->bUpdate = false; } }
CCEGLView::CCEGLView() : m_pDelegate(NULL) , m_fScreenScaleFactor(1.0) , m_bNotHVGA(false) , m_bCaptured(false) , m_bAccelState(false) , m_Key(s3eKeyFirst) { IW_CALLSTACK("CCEGLView::CCEGLView"); IwGLInit(); m_sSizeInPixel.width = IwGLGetInt(IW_GL_WIDTH); m_sSizeInPixel.height = IwGLGetInt(IW_GL_HEIGHT); m_pSet = new CCSet; m_pTouch = new CCTouch; // Register pointer touch button event handler s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, &TouchEventHandler, this); // Register pointer motion button event handler s3ePointerRegister(S3E_POINTER_MOTION_EVENT, &MotionEventHandler, this); // Register keyboard event handler s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, &KeyEventHandler, this); }
//----------------------------------------------------------------------------- // CIwRenderSlotClear //----------------------------------------------------------------------------- void CIwRenderSlotClear::Render() { IW_CALLSTACK("CIwRenderSlotClear::Render") // Clear backbuffer IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); }
TransitionManager::~TransitionManager() { IW_CALLSTACK("TransitionManager::~TransitionManager"); IwGxClear(); IwGxFlush(); Destroy(); }
Scythe::Scythe(CIwSVec2 i2Position): LethalUnit() { IW_CALLSTACK("Scythe::Scythe"); this->tTextureList.push_back(ImageManager::getImage("scythe")); this->tTextureList.push_back(ImageManager::getImage("bloodyscythe")); this->sSoundList.push_back(SoundManager::getSound("scythe_kill")); this->sSoundList.push_back(SoundManager::getSound("swoosh3")); this->iSoundIndex = 5; this->i2Position = i2Position; this->sName="scythe"; this->brBoundingBox = BoundingRectangle(this->i2Position, this->i2Size, CIwSVec2((int)(this->i2Size.x * 0.7f), (int)(this->i2Size.y * 0.7f))); this->bUpdate = false; this->bIsMoving = true; this->bDrawn = false; this->mRot = CIwMat2D(); this->iLength = 0; this->fAngularAcceleration = 0; this->fAngularVel = 0; this->fAngle = 0; this->iCapDeathCount = 1000; this->DarkGreen.Set(46, 139, 87, 255); this->LightGreen.Set(0, 255, 127, 255); this->green = IwRandMinMax(0 , 255); this->up = true; ClassTracker::addUnit(this); }
//----------------------------------------------------------------------------- // Finished parsing the object //----------------------------------------------------------------------------- void GUIElement::ParseClose( CIwTextParserITX* apParser ) { #ifdef IW_BUILD_RESOURCES IW_CALLSTACK( "GUIElement::ParseClose" ); // Nesting level needs decreasing first s_FrameDepth--; // Get parent object from parser stack if we're still nested if( s_FrameDepth ) { GUIElement* lpParent = reinterpret_cast<GUIElement*>( apParser->GetObject( -1 ) ); IwAssertMsg( GUI, lpParent, ( "GUIElement %s declared without a parent", DebugGetName() ) ); if( lpParent ) { // Check parent really is a frame! IwAssertMsg( GUI, lpParent->TestFlags( GF_FRAME ), ( "GUIElement %s not declared within a GUIFrame", DebugGetName() ) ); m_pParent = reinterpret_cast<GUIFrame*>( lpParent ); m_pParent->AddChild( this ); } } else { // Top level object, add to resource manager if( !strcmp( GetClassName(), "GUITemplate" ) ) IwGetResManager()->AddRes( RESTYPE_GUITEMPLATE, this ); else IwGetResManager()->AddRes( RESTYPE_GUIELEMENT, this ); } #endif }
void StartBox::update(uint64 time) { IW_CALLSTACK("StartBox::update"); this->iTime = time; this->iTimePassed += time; }
//----------------------------------------------------------------------------- CIwRenderManager::~CIwRenderManager() { IW_CALLSTACK("CIwRenderManager::~CIwRenderManager") DestroySlots(); IW_SINGLETON_CLEAR(RenderManager); }
void Scythe::calculateMaxRotation() { IW_CALLSTACK("Scythe::calculateMaxRotation"); // calculate max rotation to the left float deltaY = this->i2Position.y; //this->uAttatchedToList[0]->i2Position.y - this->i2Position.y; float deltaX = (float)abs(this->uAttatchedToList[0]->i2Position.x - this->i2Position.x); float rads = atan(deltaX/deltaY); this->fMaxLeft = rads; // caculate max rotation to the right /*deltaY = this->i2Position.y; //abs(this->uAttatchedToList[1]->i2Position.y - this->i2Position.y); deltaX = (float)abs(this->uAttatchedToList[1]->i2Position.x - this->i2Position.x); rads = atan(deltaX/deltaY); this->fMaxRight = rads;*/ // swinging scythe this->rotAxis.x = this->i2RegionSize.x/2 + this->i2Position.x; //(this->uAttatchedToList[0]->i2Position.x + this->uAttatchedToList[1]->i2Position.x)/2; this->rotAxis.y = this->uAttatchedToList[0]->i2Position.y /*+ this->uAttatchedToList[1]->i2Position.y)/2*/ + Screen::getBOXSIZE().y; this->fAngle = this->fMaxLeft; //(this->fMaxLeft + this->fMaxRight)* 0.5f; this->iLength = (int)((this->i2Position.y - this->rotAxis.y) * 0.5f); // plus 2 to avoid divide by zero. if ( this->iLength == 0) { IwAssertMsg(MYAPP, false, ("scythe With length of zero, move more than one box lower than rotation point")); } this->fGDividedByLength = GRAVC/(float)this->iLength; //this->fperoid = 6.28 * sqrt((float)this->iLength/GRAV); this->mRot.SetRot(IW_ANGLE_FROM_RADIANS(this->fAngle), this->rotAxis); }
CCApplication::~CCApplication() { IW_CALLSTACK("CCApplication::~CCApplication"); CC_ASSERT(this == sm_pSharedApplication); sm_pSharedApplication = NULL; }
int CCApplication::Run() { IW_CALLSTACK("CCApplication::Run"); if ( ! initInstance() || !applicationDidFinishLaunching() ) { return 0; } int64 updateTime = s3eTimerGetMs(); while (!s3eDeviceCheckQuitRequest()) { int64 currentTime = s3eTimerGetMs(); if (currentTime - updateTime > m_nAnimationInterval) { updateTime = currentTime; s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); ccAccelerationUpdate(); CCDirector::sharedDirector()->mainLoop(); } else { s3eDeviceYield(0); } } return -1; }
unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* pszMode, unsigned long * pSize) { IW_CALLSTACK("CCFileUtils::getFileData"); s3eFile* pFile = s3eFileOpen(pszFileName, pszMode); if (! pFile && getIsPopupNotify()) { IwAssertMsg(GAME, pFile, ("Open file %s Failed. s3eFileError Code : %i", pszFileName, s3eFileGetError())); } if (! pFile) { *pSize = 0; return 0; } int32 fileSize = s3eFileGetSize(pFile); *pSize=fileSize; static int32* pDataToBeReadBinary; pDataToBeReadBinary = (int32*)s3eMallocBase(fileSize); memset(pDataToBeReadBinary, 0, fileSize); s3eFileRead(pDataToBeReadBinary, fileSize, 1, pFile); s3eFileClose(pFile); return (unsigned char*)pDataToBeReadBinary; }
void UserInterfaceManager::setWin(int e, int d, uint64 t) { IW_CALLSTACK("UserInterfaceManager::setWin"); this->emMenu->setWin(e,d,t); this->fmMenu->setWin(); }
void UserInterfaceManager::resetLevel() { IW_CALLSTACK("UserInterfaceManager::resetLevel"); //this->pmMenu = new PauseMenu(); //this->pbButton = new PauseButton(); }
//----------------------------------------------------------------------------- void CIwRenderManager::Render() { IW_CALLSTACK("CIwRenderManager::Render") // Render user slots RenderSlotList(m_Slots); }
void Chomper::setCap(int iC) { IW_CALLSTACK("Chomper::setCap"); this->iCapDeathCount = iC; this->iDefaultCap = iC; }
//----------------------------------------------------------------------------- // Serialise to/from binary file //----------------------------------------------------------------------------- void GUIColour::Serialise() { IW_CALLSTACK( "GUIColour::Serialise" ); CIwResource::Serialise(); IwSerialiseUInt32( m_Colour ); }
//----------------------------------------------------------------------------- CIwSoundManager::CIwSoundManager() { IW_CALLSTACK("CIwSoundManager::CIwSoundManager") IW_SINGLETON_SET(SoundManager); m_GroupIdentity = new CIwSoundGroup; m_ParamsIdentity = new CIwSoundParams; m_SoundInsts = NULL; m_SoundInstPtrs = NULL; m_NumActiveInsts = 0; m_Flags = ACTIVE_F; m_MasterVol = IW_GEOM_ONE; m_MasterPan = 0; m_MasterPitch = IW_GEOM_ONE; // Allocate our own channels so that they can be used to override Segundo // channels where necessary int cfgChannels = 8; s3eConfigGetInt("SOUND", "MaxChannels", &cfgChannels); int32 s3eChannels = s3eSoundGetInt(S3E_SOUND_NUM_CHANNELS); m_MaxInsts = MIN(cfgChannels, s3eChannels); s_ChannelsPCM8 = new CIwChannelPCM8[m_MaxInsts]; s_ChannelsPCM16 = new CIwChannelPCM16[m_MaxInsts]; s_ChannelsADPCM = new CIwChannelADPCM[m_MaxInsts]; m_SoundInsts = new CIwSoundInst[m_MaxInsts]; m_SoundInstPtrs = new CIwSoundInst*[m_MaxInsts]; for (uint32 i = 0; i < m_MaxInsts; i++) m_SoundInstPtrs[i] = &m_SoundInsts[i]; }
bool CCImage::_initWithPngData(void * pData, int nDatalen) { IW_CALLSTACK("CCImage::_initWithPngData"); bool bRet = false; s3eFile* pFile = s3eFileOpenFromMemory(pData, nDatalen); IwAssert(GAME, pFile); CIwImage *image = NULL; image = new CIwImage; image->ReadFile( pFile); s3eFileClose(pFile); // init image info m_bPreMulti = true; m_bHasAlpha = image->HasAlpha(); unsigned int bytesPerComponent = 3; if (m_bHasAlpha) { bytesPerComponent = 4; } m_nHeight = (unsigned int)image->GetHeight(); m_nWidth = (unsigned int)image->GetWidth(); m_nBitsPerComponent = (unsigned int)image->GetBitDepth()/bytesPerComponent; tImageSource imageSource; imageSource.data = (unsigned char*)pData; imageSource.size = nDatalen; imageSource.offset = 0; m_pData = new unsigned char[m_nHeight * m_nWidth * bytesPerComponent]; unsigned int bytesPerRow = m_nWidth * bytesPerComponent; if(m_bHasAlpha) { unsigned char *src = NULL; src = (unsigned char *)image->GetTexels(); unsigned char *tmp = (unsigned char *) m_pData; for(unsigned int i = 0; i < m_nHeight*bytesPerRow; i += bytesPerComponent) { *(tmp + i + 0) = (*(src + i + 0) * *(src + i + 3) + 1) >> 8; *(tmp + i + 1) = (*(src + i + 1) * *(src + i + 3) + 1) >> 8; *(tmp + i + 2) = (*(src + i + 2) * *(src + i + 3) + 1) >> 8; *(tmp + i + 3) = *(src + i + 3); } } else { for (int j = 0; j < (m_nHeight); ++j)
CCApplication::CCApplication() { IW_CALLSTACK("CCApplication::CCApplication"); m_nAnimationInterval = 0; CC_ASSERT(! sm_pSharedApplication); sm_pSharedApplication = this; }
//-------------------------------------------------------------------------------- void IwSoundTerminate() { IW_CALLSTACK("IwSoundTerminate") IwGetSoundManager()->StopAll(); delete IwGetSoundManager(); }