main.c

来自「psp游戏机上的SDK的开发例子」· C语言 代码 · 共 59 行

C
59
字号
/* * PSP Software Development Kit - http://www.pspdev.org * ----------------------------------------------------------------------- * Licensed under the BSD license, see LICENSE in PSPSDK root for details. * * main.c - Simple Systimer example * * Copyright (c) 2007 Iaroslav Gaponenko <adrahil@gmail.com> * * $Id: main.c 2149 2007-01-25 20:46:21Z tyranid $ * $HeadURL: svn://svn.pspdev.org/psp/trunk/pspsdk/src/samples/kernel/systimer/main.c $ */#include <pspkernel.h>#include <pspdebug.h>#include <pspdisplay.h>#include <pspctrl.h>#include "pspsystimer.h"#define printf pspDebugScreenPrintf/* Define the module info section */PSP_MODULE_INFO("systimer", 0x1000, 1, 1);/* Define the main thread's attribute value (optional) */PSP_MAIN_THREAD_ATTR(THREAD_ATTR_VFPU);SceSysTimerId timer;int tic = 0;int my_tick_handler(void){  static int div;  div++;  //arrange to get more or less seconds...  if(div > 12){    div = 0;    if(tic){      pspDebugScreenPrintf("Tac!\n");    }else{      pspDebugScreenPrintf("Tic!\n");    }    tic = ~tic;  }  return -1;}int main(int argc, char *argv[]) {  pspDebugScreenInit();  pspDebugScreenPrintf("SysTimer sample by Adrahil.\n");  timer = sceSTimerAlloc();  sceSTimerStartCount(timer);  sceSTimerSetHandler(timer, 4194303, my_tick_handler, 0);  sceKernelSleepThreadCB();  return 0;} 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?