cocos2d-x學習筆記

來源:互聯網
上載者:User

標籤:style   blog   http   color   os   io   html   代碼   

cocos2d-x是一個很好的跨平台遊戲引擎,更多介紹可查看中文官網,裡面有很多教程,但是排版的不是很好,不方便查看全部,寫了個指令碼抓了一下,產生簡單的網頁,全域查看比較方便,代碼如下

# -*- coding: utf-8 -*-import urllib2firsturl="http://cn.cocos2d-x.org/"def main():    file = open("index.html","w")    writehead(file)    writetable(file)    writeend(file)    file.close()def writetable(file):    file.write(‘<table width="100%" border="2" cellpadding="2" cellspaceing="0">‘)    result = urllib2.urlopen(firsturl+"tutorial/index")    line = result.readline()    while line:        if ‘<a href="/tutorial/lists?id=‘ in line and ‘<img‘ not in line:            file.write("<tr><td>")            file.write(line.replace("/tutorial",firsturl+"/tutorial"))            cuturl = firsturl+line.split("href")[1].split(‘"‘)[1]            result2 = urllib2.urlopen(cuturl)            line2 = result2.readline()            file.write("</td><td><ul>")            while line2:                if ‘<a href="/tutorial/show?id‘ in line2 and ‘<img‘ not in line2:                    file.write("<li>")                    file.write(line2.replace("/tutorial",firsturl+"/tutorial"))                    file.write("</li>")                if ‘<a href="/tutorial/lists?id=‘ in line2 and ‘>&gt;<‘ in  line2:                    tempurl2 =firsturl+line2.split(‘&gt‘)[0].split(‘"‘)[-2][1:].replace("amp;","")                    print tempurl2                    result2 = urllib2.urlopen(tempurl2)                line2 = result2.readline()            file.write("</ul></td></tr>")        if ‘<a href="/tutorial/index?level=0&type=cocos2d-x&amp;per_page=‘ in line and ‘>&gt;<‘ in line:            tempurl = firsturl+line.split(‘&gt‘)[0].split(‘"‘)[-2][1:].replace("amp;","")            result = urllib2.urlopen(tempurl)            #print tempurl        line =result.readline()    file.write("</table>")def writehead(file):    file.write(‘‘‘<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta></head><body>‘‘‘)def writeend(file):    file.write(‘‘‘</body></html>‘‘‘)main()

簡單粗暴的爬了下來之後,覺得類之間的關係要能弄清楚就好了,於是發現了個好東西叫doxygen,非常好用,從源碼產生html文檔。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.