Esempio n. 1
0
void World::InitWorldObjects() {
	InitTextures();
	InitImages();
	InitSounds();
	InitObjects();
	InitSprites();
}
bool HighscoreScreen::init()
{
    if (!Layer::init())
    {
        return false;
    }

    _rootNode = CSLoader::createNode("Screens/HighscoreScreen.csb");
    addChild(_rootNode);
    this->scheduleUpdate();

    _myDictionary = __Dictionary::create();

    ReadHighscore();

    if (_scores[1]->length() == 0)
    {
        WriteDefaultHighscore();
        ReadHighscore();
    }

    //SPRITES
    InitSprites();
    //Animated Santa Sprite
    InitAnimation();
    //LABELS
    InitLabels();
    //TOUCHES
    InitControls();
    //BUTTONS
    InitButtons();

    return true;
}
Esempio n. 3
0
bool RankUp::init()
{
    if (!CCLayer::init())
    {
        return false;
    }

    idx = -1;
    isTouched = true;
    isBoasted = true;

    // make depth tree
    Depth::AddCurDepth("RankUp", this);

    this->setKeypadEnabled(true);
    this->setTouchEnabled(true);
    this->setTouchPriority(0);
    //CCLog("RankUp : touch prio = %d", this->getTouchPriority());

    // notification observer
    CCNotificationCenter::sharedNotificationCenter()->addObserver(this, callfuncO_selector(RankUp::Notification), Depth::GetCurName(), NULL);

    Common::AddSpriteFramesWithFile("rankup");
    CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("images/popup.plist");
    //CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("images/rankup.plist");

    spriteClass = new SpriteClass();

    winSize = CCDirector::sharedDirector()->getWinSize();

    InitSprites();

    return true;
}
bool CocoRoomTodayCandy::init()
{
    if (!CCLayer::init())
    {
        return false;
    }

    isTouched = true;
    isScrollViewTouched = true;
    isScrolling = true;

    // make depth tree
    Depth::AddCurDepth("CocoRoomTodayCandy", this);

    this->setTouchEnabled(true);
    this->setKeypadEnabled(true);
    this->setTouchPriority(Depth::GetCurPriority());
    //CCLog("CocoRoomTodayCandy : touch prio = %d", this->getTouchPriority());

    // notification observer
    CCNotificationCenter::sharedNotificationCenter()->addObserver(this, callfuncO_selector(CocoRoomTodayCandy::Notification), Depth::GetCurName(), NULL);

    // notification
    CCString* param = CCString::create("1");
    CCNotificationCenter::sharedNotificationCenter()->postNotification(Depth::GetParentName(), param);


    winSize = CCDirector::sharedDirector()->getWinSize();

    tLayer = CCLayer::create();
    tLayer->setAnchorPoint(ccp(0, 0));
    tLayer->setPosition(ccp(winSize.width/2, 0));
    tLayer->setScale(0);
    this->addChild(tLayer, 1);

    // scrollView 생성
    scrollView = CCScrollView::create();
    //scrollView->retain();
    scrollView->setDirection(kCCScrollViewDirectionVertical);
    scrollView->setViewSize(CCSizeMake(929, 904-80));
    scrollView->setAnchorPoint(ccp(0, 0));
    scrollView->setPosition(ccp(77, 492+40));
    scrollView->setDelegate(this);
    scrollView->setTouchPriority(Depth::GetCurPriority());
    tLayer->addChild(scrollView, 3);

    this->schedule(schedule_selector(CocoRoomTodayCandy::ProfileTimer), 1.0f);

    InitSprites();
    MakeScroll();
    for (int i = 0 ; i < spriteClass->spriteObj.size() ; i++)
        spriteClass->AddChild(i);

    spriteClassList = new SpriteClass();
    RefreshProfileList();

    return true;
}
int main(void){
	TExaS_Init(SSI0_Real_Nokia5110_Scope);  // set system clock to 80 MHz
	
	DisableInterrupts();
	
	
	Random_Init(1);
	
  Nokia5110_Init();
  Nokia5110_ClearBuffer();
	Nokia5110_DisplayBuffer();
	
	SysTick_Init();
	// initialize Timer2 after Nokia5110_Init because of
	// error-prone registers operations (old and new registers
	// are not working good together)
	// 80MHz/11,025 cycles, which is about 7256
	Timer2_Init(7256);
	Ports_Init();
	
	InitSprites(NumberOfEnemies);
	RestartGame();
	
	// Countdown, after which all interrupts are enabled!
	// print 3
	Nokia5110_ClearBuffer();
	Nokia5110_PrintBMP(28, 41, _my_Countdown_03, 0);
	Nokia5110_DisplayBuffer();
	Delay100ms(3);
	// print 2
	Nokia5110_ClearBuffer();
	Nokia5110_PrintBMP(28, 41, _my_Countdown_02, 0);
	Nokia5110_DisplayBuffer();
	Delay100ms(3);
	// print 1
	Nokia5110_ClearBuffer();
	Nokia5110_PrintBMP(28, 41, _my_Countdown_01, 0);
	Nokia5110_DisplayBuffer();
	Delay100ms(3);
	// print GO
	Nokia5110_ClearBuffer();
	Nokia5110_PrintBMP(28, 41, _my_Countdown_GO, 0);
	Nokia5110_DisplayBuffer();
	Delay100ms(3);
	
	
	EnableInterrupts();
	
  while(1){
		if (Flag == 1) {
			Nokia5110_DisplayBuffer();
			
			Flag = 0;
		}
	}
	
}
Esempio n. 6
0
//-----------------------------------------------------------------------------
// Name: WinMain()
// Desc: Creates/regisgters main window
//-----------------------------------------------------------------------------
int WINAPI WinMain(	HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	MSG		 msg;		// generic message
	WNDCLASS winclass;	// this will hold the class created
	bool bDone = true;
	
	// save the window handle and instance in a global
	main_window_handle = SetupWindow(&winclass, hInstance);
	main_instance      = hInstance;

	ShowWindow(main_window_handle,nCmdShow);
	UpdateWindow(main_window_handle);
	SetFocus(main_window_handle);
	ShowCursor(FALSE);
	if( (strcmp(lpCmdLine,"debug") == 0) || (strcmp(lpCmdLine,"Debug") == 0) )
		bDebugMode = true;

	// perform all game console specific initialization
	InitDD();
	InitSprites();
	gameTimer.StartTimer();
	gameTimer2.StartTimer();
	fFrameTime=0;
	frameTimer.StartTimer();

	// enter main event loop
	while(bDone)
	{
		if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
		{ 
			// test if this is a quit message
			if (msg.message == WM_QUIT)
				break;
	
			// translate any accelerator keys
			TranslateMessage(&msg);

			// send the message to the window proc
			DispatchMessage(&msg);
		} // end if
		
		if(bActiveApp)//only process frames if window is active
			bDone = main();
		else
			Sleep(10);
	
	} // end while

	ShutDown();

	// return to Windows like this
	return(msg.wParam);

} // end WinMain
Esempio n. 7
0
Prompt::Prompt(Player* player) : Sprite(player->x-8, player->y-TILE_SIZE+4), m_Visible(false), m_Source(player)
{
	m_imageSurface = g_resources->GetPromptImage();

	m_animationSpeed = 10;
	m_maxCycles = 4*m_animationSpeed;

	m_renderPriority = LAYER_UI;

	InitSprites();
}
bool RequestTopaz::init()
{
	if (!CCLayer::init())
	{
		return false;
	}
    
    isTouched = true;
    isScrolling = true;
    isScrollViewTouched = true;
    
    // make depth tree
    Depth::AddCurDepth("RequestTopaz", this);
    
    this->setTouchEnabled(true);
    this->setKeypadEnabled(true);
    this->setTouchPriority(Depth::GetCurPriority());
    //CCLog("RequestTopaz : touch prio = %d", this->getTouchPriority());
    
    // notification observer
    CCNotificationCenter::sharedNotificationCenter()->addObserver(this, callfuncO_selector(RequestTopaz::Notification), Depth::GetCurName(), NULL);
    
    // notification post
    CCString* param = CCString::create("1");
    CCNotificationCenter::sharedNotificationCenter()->postNotification(Depth::GetParentName(), param);
    

    winSize = CCDirector::sharedDirector()->getWinSize();
    
    tLayer = CCLayer::create();
    tLayer->setAnchorPoint(ccp(0, 0));
    tLayer->setPosition(ccp(winSize.width/2, 0));
    tLayer->setScale(0);
    this->addChild(tLayer, 1);
    
    scrollView = CCScrollView::create();
    scrollView->setDirection(kCCScrollViewDirectionVertical);
    scrollView->setViewSize(CCSizeMake(929, 904+243+45-100 + (487-630)));
    scrollView->setAnchorPoint(ccp(0, 0));
    scrollView->setPosition(ccp(77, 630));
    scrollView->setDelegate(this);
    scrollView->setTouchPriority(Depth::GetCurPriority());
    tLayer->addChild(scrollView, 3);
    
    this->schedule(schedule_selector(RequestTopaz::ProfileTimer), 1.0f);
    
    spriteClass = new SpriteClass();
    spriteClassScroll = new SpriteClass();
    InitSprites();
    MakeScroll();
    
    return true;
}
Esempio n. 9
0
bool T_NoImage::init()
{
	if (!CCLayer::init())
	{
		return false;
	}
    
    // make depth tree
    Depth::AddCurDepth("T_NoImage", this);
    
    this->setTouchEnabled(true);
    this->setKeypadEnabled(true);
    this->setTouchPriority(Depth::GetCurPriority());
    CCLog("NoImage : touch prio = %d", this->getTouchPriority());
    
    // notification observer
    CCNotificationCenter::sharedNotificationCenter()->addObserver(this, callfuncO_selector(T_NoImage::Notification), Depth::GetCurName(), NULL);
    
    // notification post
    CCString* param = CCString::create("1");
    CCNotificationCenter::sharedNotificationCenter()->postNotification(Depth::GetParentName(), param);
    
    winSize = CCDirector::sharedDirector()->getWinSize();
    
    InitSprites();
    
    ttrArrow = CCSprite::create("images/tutorial/tutorial_arrow.png");
    ttrPos = CCScale9Sprite::create("images/tutorial/tutorial_position.png");
    
    // ccp(717+5, 711+offset) (offset = 0)
    ttrArrow->setAnchorPoint(ccp(0.5, 0));
    ttrArrow->setPosition(ccp(722+233/2, 711+115+10));
    CCActionInterval* action = CCSequence::create( CCMoveBy::create(0.5f, ccp(0, -5)), CCMoveBy::create(0.5f, ccp(0, 5)), NULL);
    ttrArrow->runAction(CCRepeatForever::create(action));
    this->addChild(ttrArrow, 101);
    
    ttrPos->setAnchorPoint(ccp(0, 0));
    ttrPos->setPosition(ccp(722, 711));
    //ttrPos->setScaleX( (float)233 / (float)782 );
    //ttrPos->setScaleY( (float)115 / (float)177 );
    ttrPos->setContentSize(CCSize(233-5, 110));
    this->addChild(ttrPos, 101);
    
    isEnded = false;
    isTouched = false;
    
    return true;
}
Esempio n. 10
0
int main()
{
	

	
	InitGraphics();



	giftable.packet_count	= GIF_PACKET_MAX;
	giftable.packet			= &packets[0];



	

	InitSprites();

	

	

	while(1)
	{
		GsGifPacketsClear(&giftable);		// clear the area that we are going to put the sprites/triangles/....

		

		MoveSprites();
		DrawSprites(&giftable);				//add stuff to the packet area
	
		


		GsDrawSync(0);
		GsVSync(0);
		GsClearDrawEnv1(&draw_env);			// clear the draw environment before we draw stuff on it
		GsGifPacketsExecute(&giftable, 1);	// set to '1' becuse we want to wait for drawing to finish. if we dont wait we will write on packets that is currently writing to the gif
		
	}


	return 0;
}
Esempio n. 11
0
bool GameScreen::init()
{
	if (!Layer::init())
	{
		return false;
	}

	_rootNode = CSLoader::createNode("Screens/MainGame.csb");
	addChild(_rootNode);
	this->scheduleUpdate();

	_platform = (Platform*)_rootNode->getChildByName("platform");
	_platform = Platform::create();
	this->addChild(_platform);

	_powerUp = (PowerUp*)_rootNode->getChildByName("powerup");
	_powerUp = PowerUp::create();
	this->addChild(_powerUp);

	_menuBar = (MenuBar*)_rootNode->getChildByName("menuBar");
	_menuBar = MenuBar::create();
	this->addChild(_menuBar);

	//SPRITES
	InitSprites();
	//Animated Santa Sprite
	InitAnimation();
	//LABELS
	InitLabels();
	//TOUCHES
	InitControls();
	//BUTTONS
	InitButtons();


	// Game is not live until the start button is pressed.
	GameManager::sharedGameManager()->isGameLive = false;
	GameState();

	return true;
}
Esempio n. 12
0
PowerupMagnetism::PowerupMagnetism(int start_x, int start_y, int end_x, int end_y) : Powerup(start_x, start_y, end_x, end_y)
{
    // No effect to add, just modify current magnetism effect
    m_Effect = nullptr;
    InitSprites();
}