<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    李威 さぽている

    小說翻譯,日語相關轉(zhuǎn)移至http://blog.hjenglish.com/liwei

    PSP編程概述

    元旦準備買NDS,順帶關注了下PSP,其實是想,或許買PSP也不錯~
    PSP很像一個平臺,提供了很多東西,譬如官方的PS模擬器~在上面編程也是個不錯的想法。

    國外的一個網(wǎng)站提供了很多信息,PS2Dev Network (http://www.ps2dev.org),有教程http://ps2dev.org/psp/Tutorials,現(xiàn)在由于不久前的地震,基本無法登陸那個網(wǎng)站。更多的信息在http://wiki.ps2dev.org/
    要想進行PSP編程,需要學習C或C++。在windows下,需要安裝Cygwin http://www.cygwin.com/, 這其實是個模擬linux的環(huán)境。在Mac OS X或Linux下需要編譯PSPSDK和PSP 工具。這些東西都可以在http://ps2dev.org/psp/Projects找到。

    ScriptScribbler (http://www.scriptscribbler.com) 這個網(wǎng)站現(xiàn)在提供3篇教程,是由Brad Dwyer寫的。他也可能會增加教程。第一篇(http://www.scriptscribbler.com/psp/tutorials/lesson01.htm) 教你在windows上搭建開發(fā)環(huán)境。第二篇(http://www.scriptscribbler.com/psp/tutorials/lesson02.htm)教你寫一個簡單的“HelloWorld”程序。第三篇(http://www.scriptscribbler.com/psp/tutorials/lesson03.htm)最有用了,也就是“PSP編程速成”。

    如果你不想學C或C++,那你可以用LuaPlayer (http://www.luaplayer.org/),它也有教程http://www.luaplayer.org/tutorial/index.html教你編程。如果你想學這個,可以到http://forums.ps2dev.org/viewforum.php?f=21多逛逛。使用Lua,你可以在Windows上測試調(diào)試,不需要每次修改后都要放到PSP上運行看效果。關于Windows版的LuaPlayer 你可以到http://forums.ps2dev.org/viewtopic.php?p=22332#22332察看更多信息。
    這里有一個例子。

    ?

    -- ?starting?positions? for ?the?character
    ?x?
    = ? 200
    ?y?
    = ? 100

    ?
    -- ?A?nice?color
    ?color?
    = ?Color.new( 128 ,? 255 ,?0)

    ?
    -- ?this?flag?tells?whether?the?program?needs?to?draw
    ?draw_character?
    = ?true

    ?
    -- ?loop?forever
    ?
    while ?true?do

    ???
    if ?draw_character?then
    ?????
    -- ? print ?a?rogue?at?the?x / y?coordinates
    ?????screen:
    print (x,?y,? " @ " ,?color)
    ?????screen.flip()
    ???end

    ???
    -- ?check?whether?the?user?pressed?the?pad,? and ?move?accordingly
    ???pad?
    = ?Controls.read()
    ???draw_character?
    = ?true
    ???
    if ?pad:left()?then
    ?????x?
    = ?x? - ? 3
    ???elseif?pad:right()?then
    ?????x?
    = ?x? + ? 3
    ???elseif?pad:up()?then
    ?????y?
    = ?y? - ? 3
    ???elseif?pad:down()?then
    ?????y?
    = ?y? + ? 3
    ???
    else
    ?????draw_character?
    = ?false
    ???end

    ???
    -- ?wait? for ?the?next?vertical?blank
    ???screen.waitVblankStart()

    ?end




    ?
    你也可以使用HTML, CSS和JavaScript編寫程序在PSP的瀏覽器上運行。關于這方面的信息,網(wǎng)上已經(jīng)很多了,這里給一個例子。

    < html >
    ?
    < head >< title > Mandelbrot?Set </ title ></ head >
    ?
    < body? style ="width:?480px;?height:?272px;" >

    ?
    < script? language ="JavaScript" >

    ?colors?
    = ? new ?Array( " black " ,? " aqua " ,? " blue " ,? " fuchsia " ,? " gray " ,
    ?????
    " green " ,? " lime " ,? " maroon " ,? " navy " ,? " olive " ,? " purple " ,
    ?????
    " red " ,? " silver " ,? " teal " ,? " white " ,? " yellow " );

    ?
    function ?plot()? {

    ???height?
    = ? 20 ;
    ???width?
    = ? 150 ;
    ???max?
    = ? 17 ;? // ?maximum?number?of?iterations.

    ???document.write('
    < p?style = " font-size:?8px " > ');

    ???
    // ?imaginary?axis?from?-1.25?to?1.25
    ??? for ?(y? = ? - 1.25 ;?y? <= ? 1.25 ;?y? += ? 2.5 / height)? {

    ?????
    // ?real?axis?from?-2.25?to?.75
    ????? for ?(x? = ? - 2.25 ;?x? <= ?. 75 ;?x? += ? 3 / width)? {

    ???????a1?
    = ?x;
    ???????b1?
    = ?y;
    ???????
    for ?(cnt? = ? 1 ;?cnt? <= ?max;?cnt ++ )? {

    ?????????
    // ?If?the?square?magnitude?of?the?complex?number?exceeds
    ????????? // ?the?limit,?break?out?of?the?loop.?Otherwise,?calculate
    ????????? // ?and?loop?around?again.
    ????????? //
    ?????????a? = ?a1 * a1;
    ?????????b?
    = ?b1 * b1;
    ?????????
    if ?(a? + ?b? > ? 4.0 )? {
    ???????????
    break ;
    ?????????}
    ? else ? {
    ???????????b1?
    = ? 2 ? * ?a1? * ?b1? + ?y;? // ?imaginary?component
    ???????????a1? = ?a? - ?b? + ?x;? // ?real?component
    ?????????}

    ???????}

    ???????
    if ?(cnt? > ?max)? {
    ?????????
    // ?At?this?resolution,?the?point?does?not?appear?to?be
    ????????? // ?outside?the?Mandelbrot?set,?so?use?color?0?(black).
    ?????????cnt? = ? 0 ;
    ???????}

    ???????style?
    = ?'background - color:?'? + ?colors[?cnt? % ? 16 ?]? + ?';';
    ???????document.write('
    < span?style = " '?+?style?+?' " >& nbsp; </ span > ');

    ?????}

    ?????document.write('
    < br /> ');
    ???}

    ???document.write('
    </ p > ');
    ?}


    ?plot();

    ?
    </ script >

    ?
    </ body >
    ?
    </ html >



    你可以將其與Perl腳本語言結(jié)合,編寫功能更為強大的程序。
    (聲明:以上大部分翻譯自《PSP Hacks》的Hack 47. Develop for the PSP)

    不知道PSP是否支持Python這種腳本語言~大學里看過Python的書~
    Lua是linux下的一種編程語言,那另一中語言Ruby是否也可以呢?

    posted on 2006-12-30 14:11 李威 閱讀(2266) 評論(1)  編輯  收藏

    評論

    # re: PSP編程概述 2008-01-28 18:41 Evil

    《PSP Hacks》是網(wǎng)絡期刊嗎?還是實體書?
    另外,它是英文還是中文?若是英文,那它有中文版么?  回復  更多評論   


    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導航:
     
    主站蜘蛛池模板: 欧洲美女大片免费播放器视频| 亚洲一卡2卡4卡5卡6卡残暴在线| 国产区图片区小说区亚洲区| 噼里啪啦电影在线观看免费高清 | 亚洲同性男gay网站在线观看| 亚洲a一级免费视频| 亚洲视频.com| 亚洲网站免费观看| 亚洲国产精品一区二区久| 0588影视手机免费看片| 亚洲国产成人精品电影| 24小时日本在线www免费的| 亚洲精华液一二三产区| 全黄性性激高免费视频| www一区二区www免费| 亚洲AV无码专区电影在线观看| 69精品免费视频| 亚洲国产成a人v在线观看 | 0588影视手机免费看片| 亚洲heyzo专区无码综合| 亚洲国产日韩成人综合天堂| 在线观看人成视频免费无遮挡| 久久精品国产亚洲| 免费无码A片一区二三区| 理论亚洲区美一区二区三区| 亚洲综合色成在线播放| 一级毛片在线免费看| 亚洲中文字幕AV每天更新| 亚洲Av无码乱码在线znlu| 国产免费一区二区三区不卡 | 色欲A∨无码蜜臀AV免费播| 亚洲日本国产乱码va在线观看| 在线免费视频一区二区| 人妻18毛片a级毛片免费看| 老色鬼久久亚洲AV综合| 国产美女无遮挡免费视频网站 | 窝窝影视午夜看片免费| 亚洲嫩模在线观看| 免费在线观看毛片| 秋霞人成在线观看免费视频| 亚洲最大无码中文字幕|