void playSound(unsigned char *sound, unsigned long len) { PWMPR = 0; PWMPC = 0; sdata = sound; slen = len; tval = 0; sact = 1; switchSound(SOUND_ON); }
void __loadds far mouseEvent(int event, int x, int y) { #pragma aux mouseEvent parm [EAX] [ECX] [EDX]; static left_button_hold_down = 0; if (event & MOUSE_MOVE) { if (left_button_hold_down) { recMouseBackground(); saveMouseBackground(x, y); } moveMouse(x, y); } else if (event & MOUSE_RIGHT_UP) { //gameState = GAME_QUIT; } else if (event & MOUSE_LEFT_DOWN) { left_button_hold_down = 1; /* 以下为鼠标单击按钮事件处理 */ if (inButton(x, y, &quitButton)) { gameState = GAME_QUIT; } if (inButton(x, y, &playButton)) { if (playButton.state == BUTTON_UP) { playButton.state = BUTTON_DOWN; } else { playButton.state = BUTTON_UP; } handlePause(); paintButton(&playButton); } if (inButton(x, y, &soundButton)) { switchSound(); } } else if (event & MOUSE_LEFT_UP) { left_button_hold_down = 0; } else if (event & MOUSE_RIGHT_DOWN) { } }
void stopSound(void) { switchSound(SOUND_OFF); PWMPR = 7; sact = 0; }