﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-whitech</title><link>http://www.cppblog.com/whitech/</link><description /><language>zh-cn</language><lastBuildDate>Thu, 23 Apr 2026 10:14:33 GMT</lastBuildDate><pubDate>Thu, 23 Apr 2026 10:14:33 GMT</pubDate><ttl>60</ttl><item><title>BUG-01 脚本引擎部分 --词法分析&amp;语法树生成</title><link>http://www.cppblog.com/whitech/archive/2009/06/19/88084.html</link><dc:creator>whitech</dc:creator><author>whitech</author><pubDate>Fri, 19 Jun 2009 03:21:00 GMT</pubDate><guid>http://www.cppblog.com/whitech/archive/2009/06/19/88084.html</guid><wfw:comment>http://www.cppblog.com/whitech/comments/88084.html</wfw:comment><comments>http://www.cppblog.com/whitech/archive/2009/06/19/88084.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/whitech/comments/commentRss/88084.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/whitech/services/trackbacks/88084.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 感谢水王的大力支持感谢各位仁兄的支持下面入正题本脚本语言的上下无关文法如下：Script&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...&nbsp;&nbsp;<a href='http://www.cppblog.com/whitech/archive/2009/06/19/88084.html'>阅读全文</a><img src ="http://www.cppblog.com/whitech/aggbug/88084.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/whitech/" target="_blank">whitech</a> 2009-06-19 11:21 <a href="http://www.cppblog.com/whitech/archive/2009/06/19/88084.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>AMP, phplib template使用心得</title><link>http://www.cppblog.com/whitech/archive/2009/06/06/86924.html</link><dc:creator>whitech</dc:creator><author>whitech</author><pubDate>Sat, 06 Jun 2009 09:27:00 GMT</pubDate><guid>http://www.cppblog.com/whitech/archive/2009/06/06/86924.html</guid><wfw:comment>http://www.cppblog.com/whitech/comments/86924.html</wfw:comment><comments>http://www.cppblog.com/whitech/archive/2009/06/06/86924.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/whitech/comments/commentRss/86924.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/whitech/services/trackbacks/86924.html</trackback:ping><description><![CDATA[<p>主要讨论侧边栏<br><br>很多网站主体右侧，都会有一个侧边栏。譬如友情链接之类什么的，每个页面都有，而且重复。<br>这里讨论一个处理动态侧边栏的解决方法（动态就是会根据数据库更新的意思）。<br><br>主体方法如下：<br>&nbsp;$tpl-&gt;set_file("link_link","link_link.html");<br>&nbsp;$tpl-&gt;parse("link_area","link_link",true);<br>第一句是把侧边栏的页面读入，第二句是把侧边栏放到页面{link_area}处。<br><br>咋一看好像很简单，其实真的很简单。<br><br>这里贴一个刚做的网站的其中一个侧边栏的代码：<br><br><br>html页面最终侧边栏：</p>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">div&nbsp;</span><span style="COLOR: #ff0000">class</span><span style="COLOR: #0000ff">="cb_link"</span><span style="COLOR: #ff0000">&nbsp;align</span><span style="COLOR: #0000ff">="left"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">table&nbsp;</span><span style="COLOR: #ff0000">width</span><span style="COLOR: #0000ff">="100%"</span><span style="COLOR: #ff0000">&nbsp;cellspacing</span><span style="COLOR: #0000ff">="0"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{link_area}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">table</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">div</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span></div>
<p>配对的php页面最终关于侧边栏的所有代码：<br></p>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">setLinkBlock(</span><span style="COLOR: #800080">$tpl</span><span style="COLOR: #000000">);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>setMovieBlock(</span><span style="COLOR: #800080">$tpl</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #800080">$progid</span><span style="COLOR: #000000">);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>setMsgBlock(</span><span style="COLOR: #800080">$tpl</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #800080">$progid</span><span style="COLOR: #000000">);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span></div>
<p>这个页面的侧边栏共有三层，友情链接+movieblock+msgblock<br><br>经过服务器解析的侧边栏：<br></p>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">div&nbsp;</span><span style="COLOR: #ff0000">class</span><span style="COLOR: #0000ff">="cb_link"</span><span style="COLOR: #ff0000">&nbsp;align</span><span style="COLOR: #0000ff">="left"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">table&nbsp;</span><span style="COLOR: #ff0000">width</span><span style="COLOR: #0000ff">="100%"</span><span style="COLOR: #ff0000">&nbsp;cellspacing</span><span style="COLOR: #0000ff">="0"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr&nbsp;</span><span style="COLOR: #ff0000">height</span><span style="COLOR: #0000ff">="8"</span><span style="COLOR: #ff0000">&nbsp;bgcolor</span><span style="COLOR: #0000ff">="#a11f25"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">align</span><span style="COLOR: #0000ff">="left"</span><span style="COLOR: #ff0000">&nbsp;height</span><span style="COLOR: #0000ff">="28"</span><span style="COLOR: #ff0000">&nbsp;colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #000000">友情链接</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">align</span><span style="COLOR: #0000ff">="left"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="mt2"</span><span style="COLOR: #ff0000">&nbsp;colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #000000">1231321</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">align</span><span style="COLOR: #0000ff">="left"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="mt2"</span><span style="COLOR: #ff0000">&nbsp;colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #000000">那啥</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">align</span><span style="COLOR: #0000ff">="left"</span><span style="COLOR: #ff0000">&nbsp;class</span><span style="COLOR: #0000ff">="mt2"</span><span style="COLOR: #ff0000">&nbsp;colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #000000">还是那啥</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">last&nbsp;program&nbsp;block&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr&nbsp;</span><span style="COLOR: #ff0000">height</span><span style="COLOR: #0000ff">="8"</span><span style="COLOR: #ff0000">&nbsp;bgcolor</span><span style="COLOR: #0000ff">="#a11f25"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">align</span><span style="COLOR: #0000ff">="left"</span><span style="COLOR: #ff0000">&nbsp;height</span><span style="COLOR: #0000ff">="28"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #000000">近期节目</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">align</span><span style="COLOR: #0000ff">="right"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="prog_list.php"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">img&nbsp;</span><span style="COLOR: #ff0000">src</span><span style="COLOR: #0000ff">="./templates/images/more.png"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">class</span><span style="COLOR: #0000ff">="mt2"</span><span style="COLOR: #ff0000">&nbsp;align</span><span style="COLOR: #0000ff">="left"</span><span style="COLOR: #ff0000">&nbsp;colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="prog_article.php?issue=d9f17e4d8460bb463bddff33ad4075e0"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">[第3期]</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">fffffffffffffffffffffffffffff</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">class</span><span style="COLOR: #0000ff">="mt2"</span><span style="COLOR: #ff0000">&nbsp;align</span><span style="COLOR: #0000ff">="left"</span><span style="COLOR: #ff0000">&nbsp;colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="prog_article.php?issue=8f274cca46324ceeb141e30d67d42488"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">[第2期]</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">cccccccccccccccccccccccc</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">class</span><span style="COLOR: #0000ff">="mt2"</span><span style="COLOR: #ff0000">&nbsp;align</span><span style="COLOR: #0000ff">="left"</span><span style="COLOR: #ff0000">&nbsp;colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="prog_article.php?issue=f6cb2e20c5d965cefae00f52a44a6c27"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">[第1期]</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">那个那个那个</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">this&nbsp;is&nbsp;the&nbsp;message&nbsp;blob&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr&nbsp;</span><span style="COLOR: #ff0000">height</span><span style="COLOR: #0000ff">="8"</span><span style="COLOR: #ff0000">&nbsp;bgcolor</span><span style="COLOR: #0000ff">="#a11f25"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">align</span><span style="COLOR: #0000ff">="left"</span><span style="COLOR: #ff0000">&nbsp;height</span><span style="COLOR: #0000ff">="28"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #000000">最新留言</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">align</span><span style="COLOR: #0000ff">="right"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="message_list.php"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">img&nbsp;</span><span style="COLOR: #ff0000">src</span><span style="COLOR: #0000ff">="./templates/images/more.png"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">class</span><span style="COLOR: #0000ff">="mt2"</span><span style="COLOR: #ff0000">&nbsp;align</span><span style="COLOR: #0000ff">="left"</span><span style="COLOR: #ff0000">&nbsp;colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #000000">123</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">class</span><span style="COLOR: #0000ff">="mt2"</span><span style="COLOR: #ff0000">&nbsp;align</span><span style="COLOR: #0000ff">="right"</span><span style="COLOR: #ff0000">&nbsp;colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">--</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">b&nbsp;</span><span style="COLOR: #ff0000">style</span><span style="COLOR: #0000ff">="color:black;"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">游客</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">table</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">div</span><span style="COLOR: #0000ff">&gt;</span></div>
<p><br><br>想象一下，每个页面就这样几行就已经把侧边栏弄好了，那是多么干净。。<br><br><br>这里讨论侧边栏的其中一段的实现方式：<br>link_prog.html文件:<br></p>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">last&nbsp;program&nbsp;block&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr&nbsp;</span><span style="COLOR: #ff0000">height</span><span style="COLOR: #0000ff">="8"</span><span style="COLOR: #ff0000">&nbsp;bgcolor</span><span style="COLOR: #0000ff">="#a11f25"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">align</span><span style="COLOR: #0000ff">="left"</span><span style="COLOR: #ff0000">&nbsp;height</span><span style="COLOR: #0000ff">="28"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #000000">近期节目</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">align</span><span style="COLOR: #0000ff">="right"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="prog_list.php"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">img&nbsp;</span><span style="COLOR: #ff0000">src</span><span style="COLOR: #0000ff">="./templates/images/more.png"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;&nbsp;BEGIN&nbsp;link_progblob&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td&nbsp;</span><span style="COLOR: #ff0000">class</span><span style="COLOR: #0000ff">="mt2"</span><span style="COLOR: #ff0000">&nbsp;align</span><span style="COLOR: #0000ff">="left"</span><span style="COLOR: #ff0000">&nbsp;colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">a&nbsp;</span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="prog_article.php?issue={progid}"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">[第{issue}期]</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">b</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">{intro}</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">&nbsp;&nbsp;END&nbsp;link_progblob&nbsp;&nbsp;</span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span></div>
<p>这里已经是整个文件了，不需要&lt;html&gt;之类的文件头，因为是直接内嵌在表格里面的<br><br><br>php函数：<br></p>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000">&nbsp;setProgBlock(</span><span style="COLOR: #800080">$tpl</span><span style="COLOR: #000000">)&nbsp;{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #800080">$tpl</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">set_file(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">link_prog</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">link_prog.html</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #800080">$proglist</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;listProgram(</span><span style="COLOR: #800080">$page</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">5</span><span style="COLOR: #000000">);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #800080">$tpl</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">set_block(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">link_prog</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">link_progblob</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">pb</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #800080">$tpl</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">set_var(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">mb</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">!</span><span style="COLOR: #800080">$proglist</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">EOF)&nbsp;{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #800080">$tpl</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">set_var(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">progid</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #800080">$proglist</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">fields[</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">PROGRAM_ID</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">]);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #800080">$tpl</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">set_var(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">issue</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #800080">$proglist</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">fields[</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">PROGRAM_ISSUE</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">]);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #800080">$tpl</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">set_var(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">intro</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #008080">substr</span><span style="COLOR: #000000">(</span><span style="COLOR: #800080">$proglist</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">fields[</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">PROGRAM_INTRODUCTION</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">]</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">64</span><span style="COLOR: #000000">));<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #800080">$proglist</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">moveNext();<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #800080">$tpl</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">parse(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">pb</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">link_progblob</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #800080">$tpl</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">parse(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">link_area</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">link_prog</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>}<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span></div>
<p><br><br>有了以上的基础，就可以在php页面里面调用 setProgBlock($tpl) 来设置侧边栏了<br><br>假如侧边栏有几层（友情链接+最新留言+。。。），一样调用<br><br>其实这里还有个问题懒得改，就是把html里面的侧边栏区域{link_area}也作为变量输入setXxxBlock，这样才比较好看。<br><br>注意：每个php函数里面，<br>&nbsp;$tpl-&gt;set_file("link_prog","link_prog.html");处变量名需要设置为不同，否则会出错。<br>于是就搞定了<br><br>有了很nnd干净的侧边栏html页面和php页面，最最重要，侧边栏修改时不再需要每个页面改了。<br><br><br><br><br><br><br></p>
<img src ="http://www.cppblog.com/whitech/aggbug/86924.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/whitech/" target="_blank">whitech</a> 2009-06-06 17:27 <a href="http://www.cppblog.com/whitech/archive/2009/06/06/86924.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于三维场景八叉树的初步想法</title><link>http://www.cppblog.com/whitech/archive/2009/05/07/82149.html</link><dc:creator>whitech</dc:creator><author>whitech</author><pubDate>Thu, 07 May 2009 05:51:00 GMT</pubDate><guid>http://www.cppblog.com/whitech/archive/2009/05/07/82149.html</guid><wfw:comment>http://www.cppblog.com/whitech/comments/82149.html</wfw:comment><comments>http://www.cppblog.com/whitech/archive/2009/05/07/82149.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/whitech/comments/commentRss/82149.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/whitech/services/trackbacks/82149.html</trackback:ping><description><![CDATA[今天建冰跟我提起了一个很有意思的东西：八叉树<br><br>把一个立方体切三刀，横一刀，竖两刀（按坐标轴的方向切），就变成8个边长为一半的立方体。再切一次小立方体，在分成8块。。。<br>一直往下递归，这就可以使用一个八叉树储存。<br><br>八叉树储存的好处：<br>1.在没有东西的立方体，就不用再往下切，能节省储存空间，运算资源<br>2.管理方便，搜索某一个小方块的时候，能很方便的使用二分法查找<br>3.深度到一定层次以后，基本可以拟合所有的三维模型。<br><br>对八叉树的使用的初步想法：<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 首先，对一个三维游戏的空间来说，z维的使用远比x、y维少。若x、y维使用范围是0-1024，z维用到128就足够了（当然这是在地面游戏的基础上，不包括空战）。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 所以，为了减少八叉树的层次，我们可以对八叉树做一点点扩充：第一层不作为八叉树的分叉储存，储存一个平面。这是一个由立方体拼成的平面。大家可以想象一下平面拼起来的麻将。从第二层开始，就是真正意义上的八叉树，第一层平面上的每一个立方体，都是八叉树的根节点，然后往下细分。假如场景需要为1024*1024*128，这只需要第一层4*4的立方体，然后每个立方体对应7层的八叉树即可。对比起全八叉树，只能形成1024*1024*1024的空间，需要10层的八叉树，节约了3层。<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 其次，对于场景里面的物体操作。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 物体可以用一个小八叉树储存（八叉树again），当然这个八叉树的层次会少很多，最多不过5层。在场景中，以某一个元点（譬如八叉树的最左叶节点）作为场景的定位，然后判断与场景相交，只需要一个矩阵的乘法运算即可。效率很高<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 当然，八叉树的相交会存在一定问题。在我暂时能想到的范围里，由于八叉树的储存不完全是以元点为单位的，会有很多节点没有延伸到最底层（当然这个最底层是必须为定义好的有限层），取相交矩阵的时候，必须把其延伸到最底层，才能取出这个矩阵（或者用一些特殊算法取）。这还是在一个物体的情况下。当有多个物体的时候，两种解决方法：其一，把物体的占用空间存进场景八叉树，这样每个物体的占用空间场景都知道，只要在场景空间里面判断是否有交集即可。其二，以相对坐标的形式，遍历两个物体相交的元点是否有重叠占用。<br><br><br><br>
<img src ="http://www.cppblog.com/whitech/aggbug/82149.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/whitech/" target="_blank">whitech</a> 2009-05-07 13:51 <a href="http://www.cppblog.com/whitech/archive/2009/05/07/82149.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>继续物理引擎--问题暴露</title><link>http://www.cppblog.com/whitech/archive/2009/04/08/79223.html</link><dc:creator>whitech</dc:creator><author>whitech</author><pubDate>Tue, 07 Apr 2009 16:15:00 GMT</pubDate><guid>http://www.cppblog.com/whitech/archive/2009/04/08/79223.html</guid><wfw:comment>http://www.cppblog.com/whitech/comments/79223.html</wfw:comment><comments>http://www.cppblog.com/whitech/archive/2009/04/08/79223.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/whitech/comments/commentRss/79223.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/whitech/services/trackbacks/79223.html</trackback:ping><description><![CDATA[搁置了一段时间，想了不少东西，也发现了不少问题。<br><br>第一：只扫描一遍，功能有所欠缺。解决方案一，使用两遍扫描，第一遍扫描只做碰撞检测，记录状态。第二遍扫描才计算其速度、更新位置等<br><br>第二：运动的冗余。当前运动的方式写在BPhyBall里，当我尝试添加BPhyTriangle时，发觉线性运动的大部分函数都是可以直接从BPhyBall里面照搬过来，这是设计模式上的缺陷。<br><br>暂时到这里。陆续更新。
<img src ="http://www.cppblog.com/whitech/aggbug/79223.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/whitech/" target="_blank">whitech</a> 2009-04-08 00:15 <a href="http://www.cppblog.com/whitech/archive/2009/04/08/79223.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>试验性物理引擎（续）</title><link>http://www.cppblog.com/whitech/archive/2009/03/10/76122.html</link><dc:creator>whitech</dc:creator><author>whitech</author><pubDate>Tue, 10 Mar 2009 08:22:00 GMT</pubDate><guid>http://www.cppblog.com/whitech/archive/2009/03/10/76122.html</guid><wfw:comment>http://www.cppblog.com/whitech/comments/76122.html</wfw:comment><comments>http://www.cppblog.com/whitech/archive/2009/03/10/76122.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/whitech/comments/commentRss/76122.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/whitech/services/trackbacks/76122.html</trackback:ping><description><![CDATA[今天主要记录一些跟物理性质关系比较大的细节问题，有时候细节问题是很重要的，很多bug就在这些问题里。<br><br>首先一个，reflash函数内部的处理次序问题，究竟是先算速度，还是先算力
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">&nbsp;1</span><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;CBall::reflash()<br></span><span style="COLOR: #008080">&nbsp;2</span><span style="COLOR: #000000"><img id=Codehighlighter1_22_869_Open_Image onclick="this.style.display='none'; Codehighlighter1_22_869_Open_Text.style.display='none'; Codehighlighter1_22_869_Closed_Image.style.display='inline'; Codehighlighter1_22_869_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_22_869_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_22_869_Closed_Text.style.display='none'; Codehighlighter1_22_869_Open_Image.style.display='inline'; Codehighlighter1_22_869_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_22_869_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_22_869_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">&nbsp;3</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;velocity.positivation();<br></span><span style="COLOR: #008080">&nbsp;4</span><span style="COLOR: #000000"><img id=Codehighlighter1_51_130_Open_Image onclick="this.style.display='none'; Codehighlighter1_51_130_Open_Text.style.display='none'; Codehighlighter1_51_130_Closed_Image.style.display='inline'; Codehighlighter1_51_130_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_51_130_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_51_130_Closed_Text.style.display='none'; Codehighlighter1_51_130_Open_Image.style.display='inline'; Codehighlighter1_51_130_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_51_130_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span><span id=Codehighlighter1_51_130_Open_Text><span style="COLOR: #008000">/*</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">&nbsp;5</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;if(velocity.degree&nbsp;&gt;&nbsp;maxVelocity)<br></span><span style="COLOR: #008080">&nbsp;6</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="COLOR: #008080">&nbsp;7</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;velocity.degree&nbsp;=&nbsp;maxVelocity;<br></span><span style="COLOR: #008080">&nbsp;8</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="COLOR: #008080">&nbsp;9</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">*/</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img id=Codehighlighter1_133_200_Open_Image onclick="this.style.display='none'; Codehighlighter1_133_200_Open_Text.style.display='none'; Codehighlighter1_133_200_Closed_Image.style.display='inline'; Codehighlighter1_133_200_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_133_200_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_133_200_Closed_Text.style.display='none'; Codehighlighter1_133_200_Open_Image.style.display='inline'; Codehighlighter1_133_200_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_133_200_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span><span id=Codehighlighter1_133_200_Open_Text><span style="COLOR: #008000">/*</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">11</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;if(velocity.degree&nbsp;&lt;&nbsp;0.01)<br></span><span style="COLOR: #008080">12</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="COLOR: #008080">13</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;velocity.degree&nbsp;=&nbsp;0;<br></span><span style="COLOR: #008080">14</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="COLOR: #008080">15</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">*/</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(velocity.degree&nbsp;</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img id=Codehighlighter1_228_560_Open_Image onclick="this.style.display='none'; Codehighlighter1_228_560_Open_Text.style.display='none'; Codehighlighter1_228_560_Closed_Image.style.display='inline'; Codehighlighter1_228_560_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_228_560_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_228_560_Closed_Text.style.display='none'; Codehighlighter1_228_560_Open_Image.style.display='inline'; Codehighlighter1_228_560_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_228_560_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_228_560_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CVector&nbsp;griftForce(velocity.x&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">),&nbsp;velocity.y&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">),&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;griftForce&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;griftForce&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;(gravity&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;Qgrift&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;Qgroundgrift);<br></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;griftForce.degree&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;velocity.degree&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;velocity.degree&nbsp;</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1000</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">force&nbsp;=&nbsp;force&nbsp;+&nbsp;griftForce;</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">22</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;velocity.degree&nbsp;</span><span style="COLOR: #000000">-=</span><span style="COLOR: #000000">&nbsp;griftForce.degree</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">gravity;<br></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(velocity.degree&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img id=Codehighlighter1_529_557_Open_Image onclick="this.style.display='none'; Codehighlighter1_529_557_Open_Text.style.display='none'; Codehighlighter1_529_557_Closed_Image.style.display='inline'; Codehighlighter1_529_557_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_529_557_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_529_557_Closed_Text.style.display='none'; Codehighlighter1_529_557_Open_Image.style.display='inline'; Codehighlighter1_529_557_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_529_557_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_529_557_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;velocity.degree&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">26</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(fabs(force.degree)&nbsp;</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><img id=Codehighlighter1_591_633_Open_Image onclick="this.style.display='none'; Codehighlighter1_591_633_Open_Text.style.display='none'; Codehighlighter1_591_633_Closed_Image.style.display='inline'; Codehighlighter1_591_633_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_591_633_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_591_633_Closed_Text.style.display='none'; Codehighlighter1_591_633_Open_Image.style.display='inline'; Codehighlighter1_591_633_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_591_633_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_591_633_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">30</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;velocity&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;velocity&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;force</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">gravity;<br></span><span style="COLOR: #008080">31</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="COLOR: #008080">32</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;velocity.positivation();<br></span><span style="COLOR: #008080">33</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(velocity.degree&nbsp;</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;maxVelocity)<br></span><span style="COLOR: #008080">34</span><span style="COLOR: #000000"><img id=Codehighlighter1_698_734_Open_Image onclick="this.style.display='none'; Codehighlighter1_698_734_Open_Text.style.display='none'; Codehighlighter1_698_734_Closed_Image.style.display='inline'; Codehighlighter1_698_734_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_698_734_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_698_734_Closed_Text.style.display='none'; Codehighlighter1_698_734_Open_Image.style.display='inline'; Codehighlighter1_698_734_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_698_734_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_698_734_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">35</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;velocity.degree&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;maxVelocity;<br></span><span style="COLOR: #008080">36</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">37</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;velocity.standarlization();<br></span><span style="COLOR: #008080">38</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;tx&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;x;<br></span><span style="COLOR: #008080">39</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;x&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;velocity.degree&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;velocity.x;<br></span><span style="COLOR: #008080">40</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;y&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;velocity.degree&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;velocity.y;<br></span><span style="COLOR: #008080">41</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;force.reset();<br></span><span style="COLOR: #008080">42</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span></div>
这是最新版的ball-&gt;reflash函数。是经过了几次轮回尝试得来的。来之不易啊。。。<br>在这里，每一帧先算摩擦，然后是受力，最后才是速度。这样，每一帧结束后，球所保存的速度就是当前速度。上一个版本忘了怎样的顺序，出了个当速度很小的时候（应该是受力平衡而且运动很慢的时候），每一帧结束后速度总为0，但又总是能动的错误。<br><br>接下来是一个关于重叠的问题。<br>计算机是离散的，只能模拟连续，这是问题的根源。<br>举个例子，当在某一帧里，两球的距离为2，但径向的相对速度为8的时候，你应该怎样判断？假如判断为不碰，下一帧两球将会有6个像素的重叠区域，判为碰，两球其实还没碰到。<br>问题提出来了，我的解法是，当距离小于径向相对速度的一半判为碰。否则不碰。原因比较简单，也比较复杂，反正用起来是不错。<br>当然需要一个重叠的修正函数，参考水王的话&#8220;重叠的时候，用一种看起来正常的方法分开就可以了&#8221;，于是，我就直接把两个球的坐标重置。往径向位移一点就行了，根据重叠的程度。在运动中，这是看不出来的重置。<br><br>还有问题，是两球相对速度为0时候的碰撞。严格说这不算碰撞，但这里有一个力传递的概念。假如不管这个力，如果某球在下一帧受到作用力，在碰撞检测的时候，两球无速度，但到刷新的时候，速度出现了！就会产生一个重叠至穿越的bug。也许会说把刷新和碰撞检测的顺序调换，没试过，从逻辑上讲，我觉得行不太通，说不明白。<br><br>说实话，穿越这个bug我到现在还没能完全修正。由于出现几率较小，还是放着先吧。<br><br>再来一个细节，牵引力的问题。<br>把代码贴出来就行了。<br>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;CBall::tract(CVector&nbsp;d)<br><img id=Codehighlighter1_29_247_Open_Image onclick="this.style.display='none'; Codehighlighter1_29_247_Open_Text.style.display='none'; Codehighlighter1_29_247_Closed_Image.style.display='inline'; Codehighlighter1_29_247_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_29_247_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_29_247_Closed_Text.style.display='none'; Codehighlighter1_29_247_Open_Image.style.display='inline'; Codehighlighter1_29_247_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_29_247_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_29_247_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(fabs(velocity.degree)&nbsp;</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_63_177_Open_Image onclick="this.style.display='none'; Codehighlighter1_63_177_Open_Text.style.display='none'; Codehighlighter1_63_177_Closed_Image.style.display='inline'; Codehighlighter1_63_177_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_63_177_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_63_177_Closed_Text.style.display='none'; Codehighlighter1_63_177_Open_Image.style.display='inline'; Codehighlighter1_63_177_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_63_177_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_63_177_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CVector&nbsp;rg&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;velocity&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;d;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;d.degree&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;rg.degree&nbsp;</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">&nbsp;velocity.degree)&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;gravity&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;Qgrift&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;Qgroundgrift;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br><img id=Codehighlighter1_186_235_Open_Image onclick="this.style.display='none'; Codehighlighter1_186_235_Open_Text.style.display='none'; Codehighlighter1_186_235_Closed_Image.style.display='inline'; Codehighlighter1_186_235_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_186_235_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_186_235_Closed_Text.style.display='none'; Codehighlighter1_186_235_Open_Image.style.display='inline'; Codehighlighter1_186_235_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_186_235_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_186_235_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;d.degree&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;gravity&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;Qgrift&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;Qgroundgrift;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;push(d);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span></div>
看到了，不是单纯的使用摩擦力推进就可以。要先把牵引力方向的摩擦力中和掉。。<br><br>
<img src ="http://www.cppblog.com/whitech/aggbug/76122.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/whitech/" target="_blank">whitech</a> 2009-03-10 16:22 <a href="http://www.cppblog.com/whitech/archive/2009/03/10/76122.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>试验性物理引擎（未完成版）</title><link>http://www.cppblog.com/whitech/archive/2009/03/08/75938.html</link><dc:creator>whitech</dc:creator><author>whitech</author><pubDate>Sun, 08 Mar 2009 14:18:00 GMT</pubDate><guid>http://www.cppblog.com/whitech/archive/2009/03/08/75938.html</guid><wfw:comment>http://www.cppblog.com/whitech/comments/75938.html</wfw:comment><comments>http://www.cppblog.com/whitech/archive/2009/03/08/75938.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/whitech/comments/commentRss/75938.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/whitech/services/trackbacks/75938.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 花了差不多一个星期写的试验性的碰撞物理引擎还是试验性阶段，只有球和线段首先为了统一接口，定义一个 物理实体类 CEntity，存些最简单关键的东西譬如坐标，碰撞系数，可动性等等，还有一个比较重要的参数，是实体类型（球，线段，或者以后加上的什么东西）接下来就是球和线段的实现了。当然，有了实体类，球和线段就要继承实体了。在这个引擎里面，由于线段基本都被当障碍使用，所以线段暂时是不可动的，只存几个参数：...&nbsp;&nbsp;<a href='http://www.cppblog.com/whitech/archive/2009/03/08/75938.html'>阅读全文</a><img src ="http://www.cppblog.com/whitech/aggbug/75938.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/whitech/" target="_blank">whitech</a> 2009-03-08 22:18 <a href="http://www.cppblog.com/whitech/archive/2009/03/08/75938.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>