Ejemplo n.º 1
0
void pressureTone(uint16_t duration) {
  elapsedMicros t(0);
  while (t < duration) {
    for (int i(1); i < 50; ++i) {
      dWrite(HIGH);
      delayMicroseconds((500 + random(log(touchRead(ditPin)))));
      dWrite(LOW);
      delayMicroseconds((500 + random(log(touchRead(ditPin)))));
    }
  }
}
Ejemplo n.º 2
0
void input(){		//Fonction de test des touches
	touchPosition touchXY;
	do{
		scanKeys();
		if(keysHeld() & KEY_A)
			iprintf("\x1b[4;0HAppui A");		//Bouton A
		else if(keysHeld() & KEY_B)
			iprintf("\x1b[5;0HAppui B");		//Bouton B
		else if(keysHeld() & KEY_X)
			iprintf("\x1b[6;0HAppui X");		//Bouton X
		else if(keysHeld() & KEY_Y)
			iprintf("\x1b[7;0HAppui Y");		//Bouton Y
		else if(keysHeld() & KEY_L)
			iprintf("\x1b[8;0HAppui L");		//Bouton L
		else if(keysHeld() & KEY_R)
			iprintf("\x1b[9;0HAppui R");		//Bouton R
		else if(keysHeld() & KEY_START)
			iprintf("\x1b[10;0HAppui START");	//Bouton START
		else if(keysHeld() & KEY_SELECT)
			iprintf("\x1b[11;0HAppui SELECT");	//Bouton SELECT
		else{
			int i;					//Effaçage zone
			for(i=4;i<=11;i++){
				iprintf("\x1b[%u;0H            ",i);
			}
		}
		touchRead(&touchXY);
	}while((touchXY.px>=0x00)&&(touchXY.py>=0x00)&&(touchXY.py<0xB4)&&(touchXY.py<0xFF));
}
Ejemplo n.º 3
0
void updateInput(touchPosition * touch) {
    // Update the key registers with current values.
    scanKeys();

    // Update the touch screen values.
    touchRead(touch);
}
Ejemplo n.º 4
0
LevelId LevelSelector::select_level() {
	touchPosition stylus;

	level.set_current_level(level.get_level(selected_button).id);
	level.load();
	draw();

	while (true) {
		scanKeys();
		touchRead(&stylus);

		if (button_ok.update(stylus) == BUTTON_CLICKED) {
			return level.get_level(selected_button).id;
		}

		for (u8 current_button = 0; current_button < num_buttons; current_button++) {
			if (buttons[current_button]->update(stylus) == BUTTON_CLICKED) {
				u8 last_selected_button = selected_button;

				set_selected_level(level.get_level(current_button).id);

				buttons[last_selected_button]->draw();
				buttons[selected_button]->draw();

				level.set_current_level(level.get_level(selected_button).id);
				level.load();
				level.draw(LEVEL_X, LEVEL_Y);
			}
		}

		swiWaitForVBlank();
	}
}
Ejemplo n.º 5
0
//---------------------------------------------------------------------------------
int main(void) {
//---------------------------------------------------------------------------------
	touchPosition touchXY;

	irqSet(IRQ_VBLANK, Vblank);

	consoleDemoInit();

	iprintf("      Hello DS dev'rs\n");
	iprintf("     \x1b[32mwww.devkitpro.org\n");
	iprintf("   \x1b[32;1mwww.drunkencoders.com\x1b[39m");
 
	while(1) {
	
		swiWaitForVBlank();
		touchRead(&touchXY);

		// print at using ansi escape sequence \x1b[line;columnH 
		iprintf("\x1b[10;0HFrame = %d",frame);
		iprintf("\x1b[16;0HTouch x = %04X, %04X\n", touchXY.rawx, touchXY.px);
		iprintf("Touch y = %04X, %04X\n", touchXY.rawy, touchXY.py);		
	
	}

	return 0;
}
Ejemplo n.º 6
0
static void get_pen_delta( int *dx, int *dy ) {

	static int prev_pen[2] = { 0x7FFFFFFF, 0x7FFFFFFF };
	touchPosition touchXY;
	
	u32 keys = keysHeld();

	if( keys & KEY_TOUCH ) {
		
		touchRead(&touchXY);

		if( prev_pen[0] != 0x7FFFFFFF ) {
			*dx = (prev_pen[0] - touchXY.rawx);
			*dy = (prev_pen[1] - touchXY.rawy);
		} else {
			*dx = *dy = 0;
		}

		prev_pen[0] = touchXY.rawx;
		prev_pen[1] = touchXY.rawy;
	} else {
		prev_pen[0] = prev_pen[1] = 0x7FFFFFFF;
		*dx = *dy = 0;
	}
}
Ejemplo n.º 7
0
bool InputManager::moveToPosition(Vector3<s16>* currentPosition, float32 speed, Vector3<s16>& destinationOut)
{
	s16 from_x = currentPosition->x();
	s16 from_y = currentPosition->y();

	touchPosition heldPosition;

	if(keysHeld() & KEY_TOUCH){
		touchRead(&heldPosition);
		s16 diff_x = (heldPosition.px - from_x);
		s16 diff_y = (heldPosition.py - from_y);

		u32 magnitude = sqrt32(diff_x * diff_x + diff_y * diff_y);

		if (magnitude < 2)
			return NULL;

		diff_x = round(diff_x * speed / magnitude);
		diff_y = round(diff_y * speed / magnitude);

		destinationOut.setX((u16)(from_x + diff_x));
		destinationOut.setY((u16)(from_y + diff_y));

		return true;
	}
	else
	{
		destinationOut = *currentPosition;
		return false;
	}
}
Ejemplo n.º 8
0
void Statue::update()
{
	// timeout
	Game::update();

	if (!finished)
	{
		if (keysDown() & KEY_TOUCH)
		{
			touchPosition touch;
			touchRead(&touch);

			SpriteEntry* statue = oamMain.oamMemory + STATUE_SPRITE;

			if (	touch.px > statue->x && touch.px < statue->x + 64 &&
				touch.py > statue->y && touch.py < statue->y + 64)
			{
				++counter;

				// play hit sfx with random pitch
				sfxhandle_statue_hit = mmEffect( SFX_STATUE_HIT );
				mmEffectRate( sfxhandle_statue_hit, 1024 + (rand() % 256 - 128) );

				if (counter >= 3)
				{
					mmEffect( SFX_STATUE_BREAK );
					game_end(true);
				}
			}
		}
	}
}
Ejemplo n.º 9
0
void
SymbolTreeBuilder::visit(VariableAccessNode& node)
{
    node.setScope(currentScope());
    const char* symbol_name = node.variableName();
    auto sym = _curScope->resolveSymbol(symbol_name);
    if (!sym)
    {
        std::stringstream stream;
        stream << "Symbol '" << symbol_name
               << "' is undefined"
               << std::endl;
        throw SemanticException(stream.str(), node);
    }

    if (!sym->isVariable())
    {
        std::stringstream stream;
        stream << "Symbol '" << symbol_name
               << "' is not a variable"
               << std::endl;
        throw SemanticException(stream.str(), node);
    }

    _expResult = ExpressionResult(sym->symbolType(), sym);
    node.setNodeType(_expResult.type);
    node.setExpressionResult(_expResult);
    sym->touchRead();
}
Ejemplo n.º 10
0
//---------------------------------------------------------------------------------
void VblankHandler(void) 
{
    static int lastbut = -1;
    
    uint16 but=0, x=0, y=0, xpx=0, ypx=0, z1=0, z2=0;
    uint16 batt=0, aux=0;

    but = REG_KEYXY;

    if (!( (but ^ lastbut) & (1<<6))) {
 
        tempPos = touchReadXY();

        if ( tempPos.x == 0 || tempPos.y == 0 ) {
            but |= (1 <<6);
            lastbut = but;
        } else {
            x = tempPos.x;
            y = tempPos.y;
            xpx = tempPos.px;
            ypx = tempPos.py;
            z1 = tempPos.z1;
            z2 = tempPos.z2;
        }
        
    } else {
        lastbut = but;
        but |= (1 <<6);
    }

    batt = touchRead(TSC_MEASURE_BATTERY);
    aux  = touchRead(TSC_MEASURE_AUX);

    IPC->touchX         = x;
    IPC->touchY         = y;
    IPC->touchXpx       = xpx;
    IPC->touchYpx       = ypx;
    IPC->touchZ1        = z1;
    IPC->touchZ2        = z2;
    IPC->buttons        = but;
    IPC->battery        = batt;
    IPC->aux            = aux;

#ifdef WIFI
	Wifi_Update(); // update wireless in vblank
#endif
}
Ejemplo n.º 11
0
int capacitanceRead(int pin, osctime_t *t)
{
    latchOscTime();
    int v =  touchRead(pin);
    
    *t = oscTime();
    return v;
}
Ejemplo n.º 12
0
touchPosition& InputHelper::TouchRead()
{
	touchRead(&mTouch);
	
	mTouch.px *= 2.5;
	mTouch.py *= 2.5;
	
	return mTouch;
}
void EventHandler::Update()
{
	scanKeys();

	touchRead(&m_touchPos);

	m_held = keysHeld();
	m_pressed = keysDown();
}
Ejemplo n.º 14
0
void update(){
	scanKeys();
	touchRead(&stylus);
	keyDown = keysDownRepeat();

	//Play::get_state()->run();
	
	swiWaitForVBlank();
}
Ejemplo n.º 15
0
Archivo: touch.c Proyecto: hl1itj/Team5
//---------------------------------------------------------------------------------
touchPosition touchReadXY() {
//---------------------------------------------------------------------------------
	
	touchPosition touchPos;

	touchRead(&touchPos);
	return touchPos;

}
Ejemplo n.º 16
0
void loop() {
    touch = touchRead(15) > 1000;
    if(touch != wasTouched){
      if(touch){ //check touch
        Serial.print("Touched! Total:");
        timesTouched++;
        Serial.println(timesTouched);
      }
    }
    wasTouched = touch;
}
Ejemplo n.º 17
0
bool InputManager::getCurrentTouchPosition(Vector3<s16>& posOut)
{
	touchPosition tap;
	if(keysDown() & KEY_TOUCH){
		touchRead(&tap);
		posOut.setX(tap.px);
		posOut.setY(tap.py);
		return true;
	}
	return false;
}
Ejemplo n.º 18
0
void midicctrack::flowpress(void) {

	if (keysDown() & KEY_START)
	{
		if (activepatterns[currenteditpattern] == 0)
		{
			activepatterns[currenteditpattern] = 1;
		}
		else if (activepatterns[currenteditpattern] == 1)
		{
			activepatterns[currenteditpattern] = 0;
		}
	}

	touchPosition touch;
	
	if ((keysDown() & KEY_TOUCH) || (keysHeld() & KEY_TOUCH)) {

		touchRead(&touch);
		
		int yval = touch.py;
		int xval = touch.px;

		if (yval < 128)
		{
			if (keysDown() & KEY_TOUCH) {
			
				prevx = xval;
				prevy = yval;
				
				patterns[currenteditpattern][xval] = (127 - yval);
						
			} else if (keysHeld() & KEY_TOUCH) {
			
				if ((xval != prevx) && (yval != prevy))
				{
					linealg(prevx, prevy, xval, yval);
					prevx = xval;
					prevy = yval;
				}
			
			}
			
			
		} else if ((yval > 127) && (yval < 160)) {
			
			
			xval = xval / 32;
			
			currenteditpattern = xval;
			
		}
	}
}
Ejemplo n.º 19
0
    bool yesNoBox::getResult( const char* p_text, bool p_textAtOnce ) {
        s16 x = 8 + 64 * !!_isNamed;
        s16 y = 8;
        if( p_text && !p_textAtOnce )
            regularFont->printStringD( p_text, x, y, true );
        else if( p_text )
            regularFont->printString( p_text, x, y, true );

        u8 selIdx = (u8) -1;
        draw( 2, selIdx );
        bool result;
        loop( ) {
            swiWaitForVBlank( );
            touchPosition t;
            touchRead( &t );
            scanKeys( );
            int pressed = keysCurrent( );

            if( GET_AND_WAIT( KEY_LEFT ) ) {
                selIdx = 0;
                draw( 2, selIdx );
            } else if( GET_AND_WAIT( KEY_RIGHT ) ) {
                selIdx = 1;
                draw( 2, selIdx );
            } else if( selIdx != (u8) -1 && GET_AND_WAIT( KEY_A ) ) {
                result = !selIdx;
                break;
            }

            if( t.px >= 28 && t.py >= 102 && t.px <= 122 && t.py <= 134 ) {
                draw( 0, selIdx );
                if( !waitForTouchUp( 28, 102, 122, 134 ) ) {
                    draw( 2, selIdx );
                    continue;
                }
                draw( 2, selIdx );
                swiWaitForVBlank( );
                result = true;
                break;
            } else if( t.px >= 134 && t.py >= 102 && t.px <= 228 && t.py <= 134 ) {
                draw( 1, selIdx );
                if( !waitForTouchUp( 134, 102, 228, 134 ) ) {
                    draw( 2, selIdx );
                    continue;
                }
                draw( 2, selIdx );
                swiWaitForVBlank( );
                result = false;
                break;
            }
        }
        return result;
    }
Ejemplo n.º 20
0
void PA_VBL(void){
//  static int heartbeat = 0;
   s32 batt=0;// aux=0;
    int t1=0, t2=0;
    uint32 temp=0;
    uint8 ct[sizeof(IPC->time.curtime)];

    // Update the heartbeat
 //   heartbeat++;
 
    // Read the X/Y buttons and the /PENIRQ line
 /*   but = REG_KEYXY;
    if (!(but & 0x40)) {   //
		PA_UpdateStylus();  // If IPC set correctly
    }*/

    batt = touchRead(TSC_MEASURE_BATTERY);
    
    // Read the time
    rtcGetTimeAndDate((uint8 *)ct);
    //BCDToInteger((uint8 *)&(ct[1]), 7);
    memmove(ct+1, ct, 7);
 
    // Read the temperature
    temp = touchReadTemperature(&t1, &t2);
//    IPC->heartbeat = heartbeat;
  //  IPC->buttons   = but;
    IPC->battery   = batt;
    
    u32 i;
    for(i=0; i<sizeof(ct); i++) {
      IPC->time.curtime[i] = ct[i];
    }

    IPC->temperature = temp;
    IPC->tdiode1 = t1;
    IPC->tdiode2 = t2;
	
	if (PA_NewSPI != (IPC->aux)){
		PA_NewSPI = IPC->aux;
		PA_ScreenLight(); // Update the screen lights...
		//IPC->aux = touchRead(TSC_MEASURE_AUX); // update IPC with new values
	}
			
	SndVblIrq();	// DekuTree64's version
	
	
	PA_IPCManage(); // PAlib IPC functions (sound busy, panning, etc...)
	
	Wifi_Update();
}
Ejemplo n.º 21
0
void Manager_Input::process_inputs()
{
    int i = 0;
    scanKeys();         //Refresh snapshot of inputs

    this->keys = keysHeld();  //Get the snapshot of inputs

    while(this->lst_keys[i]!=0)
    {
        if (this->keys & this->lst_keys[i]) //some button dragged
        {

            if ( !(this->keys_bak & this->lst_keys[i]) ) //some button just pressed
            {

                this->button_pressed(this->lst_keys[i]);

            }

            this->button_dragged(this->lst_keys[i]);

        } else if (this->keys_bak & this->lst_keys[i]) {

            this->button_unpressed(this->lst_keys[i]);

        }
        i++;
    }

    if (this->keys & KEY_TOUCH) {

        //this->tp = touchReadXY();
        touchRead(&this->tp);

        if ( !(this->keys_bak & KEY_TOUCH) ){
            this->tp_bak = this->tp;
            
            this->touchscreen_pressed();
        }

        this->touchscreen_dragged();

    } else if (this->keys_bak & KEY_TOUCH) {
        this->touchscreen_unpressed();
    }

    keys_bak = keys;

}
Ejemplo n.º 22
0
void Aim::update()
{
	// timeout
	Game::update();

	if (!finished)
	{
		if (keysDown() & KEY_TOUCH)
		{
			touchPosition touch;
			touchRead(&touch);

			SpriteEntry* capitalist = oamMain.oamMemory + SOVIET_SPRITE + capitalist_sprite;

			if (	touch.px > capitalist->x && touch.px < capitalist->x + 64 &&
				touch.py > capitalist->y && touch.py < capitalist->y + 64)
			{
				mmEffect( SFX_YEEHAW );
				game_end(true);
				capitalist->gfxIndex = SOVIET_TILE + anim[capitalist_sprite]*SOVIET_TILE_COUNT;
				capitalist->palette = 1;
				capitalist_sprite = -1;
			}
		}
	}

	for (int i = 0; i <= NUM_SOVIET; ++i)
	{
		++frame[i];
		if (frame[i] == 8)
		{
			frame[i] = 0;
			anim[i] = (anim[i] + 1) % 2;

			if (i == capitalist_sprite)
			{
				(oamMain.oamMemory + SOVIET_SPRITE + i)->gfxIndex = CAPITALIST_TILE + anim[i]*CAPITALIST_TILE_COUNT;
			}
			else
			{
				(oamMain.oamMemory + SOVIET_SPRITE + i)->gfxIndex = SOVIET_TILE + anim[i]*SOVIET_TILE_COUNT;
			}
		}
	}
}
Ejemplo n.º 23
0
void UIManager::ProcessInput()
{
    touchPosition disp_point;
	scanKeys();
	uint16_t keyData = keysHeld();
	touchRead(&disp_point);
	if(!(mLastButtonState & KEY_TOUCH) && (keyData & KEY_TOUCH))//PenDown
	{
		PointerListEntry* sliceNode = mSliceList;
		while (sliceNode != NULL)
		{
			if(((UISlice*)sliceNode->ptr)->OnPenDown(mContext, disp_point.px, disp_point.py))
				break;
			sliceNode = sliceNode->next;
		}
		if(sliceNode == NULL && mOnPenDownFunc != NULL) //no slice has done anything, let's pass the event through
			mOnPenDownFunc(mContext, disp_point.px, disp_point.py);
	}
	else if((mLastButtonState & KEY_TOUCH) && (keyData & KEY_TOUCH) && (mLastTouchState.px != disp_point.px || mLastTouchState.py != disp_point.py))//PenMove
	{
		PointerListEntry* sliceNode = mSliceList;
		while (sliceNode != NULL)
		{
			if(((UISlice*)sliceNode->ptr)->OnPenMove(mContext, disp_point.px, disp_point.py))
				break;
			sliceNode = sliceNode->next;
		}
		if(sliceNode == NULL && mOnPenMoveFunc != NULL) //no slice has done anything, let's pass the event through
			mOnPenMoveFunc(mContext, disp_point.px, disp_point.py);
	}
	else if((mLastButtonState & KEY_TOUCH) && !(keyData & KEY_TOUCH))//PenUp
	{
		PointerListEntry* sliceNode = mSliceList;
		while (sliceNode != NULL)
		{
			if(((UISlice*)sliceNode->ptr)->OnPenUp(mContext, mLastTouchState.px, mLastTouchState.py)) 
				break;
			sliceNode = sliceNode->next;
		}
		if(sliceNode == NULL && mOnPenUpFunc != NULL) //no slice has done anything, let's pass the event through
			mOnPenUpFunc(mContext, mLastTouchState.px, mLastTouchState.py);
	}
	mLastTouchState = disp_point;
	mLastButtonState = keyData;
}
Ejemplo n.º 24
0
void ReadTouchPad()
{
    scanKeys();

    // Update the touch screen values.
	touchPosition touch;
	touchRead(&touch);

		iprintf("\x1b[6;5HTouch x = %04X, %04X\n", touch.rawx, touch.px);
		iprintf("\x1b[7;5HTouch y = %04X, %04X\n", touch.rawy, touch.py);	

	
	bool validY = touch.py > 87 && touch.py < 3240;
	bool topY = validY && touch.py < 1600;
	bool botY = validY && touch.py > 1710;
	bool downButtonX = touch.px > 280 && touch.px < 1000;
	bool strafeButtonX = touch.px > 1078 && touch.px < 1834;
	bool rotateButtonX = touch.px > 1918 && touch.px < 2660;
	
    if( validY && downButtonX )
    {
        if(touchpadUsed == 0)
            Gameplay_handleInput(SELECT); 
            
        touchpadUsed = 1;
    }
    else if( validY && strafeButtonX )
    {
        if(touchpadUsed == 0 && (topY || botY))
            Gameplay_handleInput(topY?LEFT:RIGHT); 
            
        touchpadUsed = 1;
    }
	else if( validY && rotateButtonX )
    {
        if(touchpadUsed == 0 && (topY || botY))
            Gameplay_handleInput(topY?UP:DOWN); 
            
        touchpadUsed = 1;
    }
	else
	{
    	touchpadUsed = 0;
	}
}
Ejemplo n.º 25
0
void initRoomEdition(void)
{
	initLights();
	initBlocks();
	initEntities();
	initInterface();
	initEditorRoom(&editorRoom);
	initContextButtons();
	initSelection(NULL);
	initCamera(&editorCamera);
	// initProjectionMatrixOrtho(&editorCamera, inttof32(-128), inttof32(127),inttof32(-96), inttof32(95), inttof32(-1000), inttof32(1000));
	initProjectionMatrix(&editorCamera, 70*90, inttof32(4)/3, inttof32(1)/10, inttof32(1000)); //TEMP?
	editorCamera.position=vect(0,0,0);
	editorTranslation=vect(0,0,inttof32(-1));
	editorScale=inttof32(1);
	lineOfTouchOrigin=vect(0,0,0);
	lineOfTouchVector=vect(0,0,0);
	currentScreen=false;

	//initial camera setup
	rotateMatrixY(editorCamera.transformationMatrix, 2048+384, true);
	rotateMatrixX(editorCamera.transformationMatrix, 1024+128, false);
	editorScale=inttof32(8*20);

	//controls stuff
	touchRead(&currentTouch);
	oldTouch=currentTouch;

	//cosmetics
	glSetOutlineColor(0,RGB15(0,0,0));
	glSetOutlineColor(1,RGB15(29,15,3));

	glMaterialf(GL_AMBIENT, RGB15(8,8,8));
	glMaterialf(GL_DIFFUSE, RGB15(24,24,24));
	glMaterialf(GL_SPECULAR, RGB15(0,0,0));
	glMaterialf(GL_EMISSION, RGB15(0,0,0));

	glSetToonTableRange(0, 2, RGB15(8,8,8));
	glSetToonTableRange(3, 31, RGB15(24,24,24));

	glLight(0, RGB15(31,31,31), cosLerp(4096)>>3, 0, sinLerp(4096)>>3);
}
Ejemplo n.º 26
0
void touch(){		//Fonction de test de l'écran tactile
	touchPosition touchXY;
	int l,c;
	for(l=8;l<=10;l++){
			iprintf("\x1b[%u;14H|",l);
			iprintf("\x1b[%u;0H|",l);
		}
	for(c=0;c<=14;c++){
		iprintf("\x1b[7;%uH-",c);
		iprintf("\x1b[11;%uH-",c);
	}
	do{	
		touchRead(&touchXY);
		iprintf("\x1b[18;2Hx=%04X,%04X", touchXY.rawx, touchXY.px);
		iprintf("\x1b[19;2Hy=%04X,%04X", touchXY.rawy, touchXY.py);
		if ((touchXY.px>0x7F)&&(touchXY.px!=0x00)) iprintf("\x1b[10;5H -->");
		if ((touchXY.px<0x7F)&&(touchXY.px!=0x00)) iprintf("\x1b[10;5H <--");
		if ((touchXY.px==0x00)&&(touchXY.py==0x00)) iprintf("\x1b[10;5H    ");
	}while((touchXY.px>=0x00)&&(touchXY.py>=0x00)&&(touchXY.py<0xB4)&&(touchXY.py<0xFF));//B4,BF
}
Ejemplo n.º 27
0
int splashScreen::events()
{
	touchRead(&touch);
	scanKeys();
	int pressed = keysDown(); 
	if((pressed & KEY_TOUCH)) return MAINMENU;
	int keys = keysHeld();
			if(keys & KEY_START)
		{
			timer = 301;
		}
	if(timer<300)
	{
		return SPLASHSCREEN;
	}
	bgHide(bg3);
	bgHide(bg2);
	vramDefault();
	initiated = false;
	return MAINMENU;
}
Ejemplo n.º 28
0
void updateRoomEditor(void)
{
	touchRead(&currentTouch);
	
	if(!currentScreen)
	{
		updateLineOfTouch(currentTouch.px-128, currentTouch.py-96);
		updateEditorCamera();
		if(!updateContextButtons(&currentTouch))
		{
			roomEditorCursor(NULL);
		}
		updateSelection(NULL);
	}else{
		updateInterfaceButtons(oldTouch.px,oldTouch.py); //TEMP
	}

	roomEditorControls();

	oldTouch=currentTouch;
}
Ejemplo n.º 29
0
void inputUpdateVBlank() {
    scanKeys();
    touchRead(&touchData);

    lastKeysPressed = keysPressed;
    keysPressed = keysHeld();
    for (int i=0; i<16; i++) {
        if (keysForceReleased & (1<<i)) {
            if (!(keysPressed & (1<<i)))
                keysForceReleased &= ~(1<<i);
        }
    }
    keysPressed &= ~keysForceReleased;

    if (dsFrameCounter != readKeysLastFrameCounter) { // Double-check that it's been 1/60th of a second
        if (repeatStartTimer > 0)
            repeatStartTimer--;
        if (repeatTimer > 0)
            repeatTimer--;
        readKeysLastFrameCounter = dsFrameCounter;
    }
}
Ejemplo n.º 30
0
int main(int argc, char ** argv) {

	fatInitDefault();
	InitMaxmod();
	initGui();
	
	while(1) {

		scanKeys();
		touchRead(&touch);
		updateBrowser();

		if(playing) {
			mmStreamUpdate();
			updateProgress(&musik);
			if(needsClosing) {
				needsClosing = false;
				closeDecoder();
			}
		}
		glFlush(0);
		swiWaitForVBlank();
	}
}