2011年1月8日 星期六

雷蛇滑鼠


990和1990的差別

還有鼠墊大小

2010年12月19日 星期日

逢甲得宜科技...幹你娘

德誼!!幹.....

8/5我在逢甲德X

我女友買了一個九百多塊的耳機!!!

是我的生日禮物...

然後壞了送修11/8送修

當天店員跟我說: 兩個禮拜就會送回來了

然後到了以後會打電話給我

但一通電話都沒有!!

都是我當面催他又一直說到了一定會打電話給我

在今天我受不了了

我再去問...

他說我的耳機,原廠沒有送回來!!

他們也不知道原因.....

鄉親啊....這三個小朋友啊

怎麼可能不知道原因!!

東西一直沒送回來,他們沒去催嗎?

這會不會太誇張啦!!!

然後今天..他們拿了一個爛耳機說要賠給我!!

標簽上貼1000塊..但我女友去架上看!!!

完全沒有這一個耳機..而我原本的那一個也不見了!!

我說我不要這個我要我原本的那一個!!!

他們說這一款已經沒有賣了,要在別間店調貨

要我再等到下星期五...

淦........下星期五!!!

會不會又是永遠的電話通知

我都等一個多月了!!!今天就去調貨會死哦!!

反正到時候看怎樣..不爽我再客訴一次總公司...淦

真的是太誇張了!!!!那個耳機是R開頭的廠牌

德X啊德X....雖然說原本就知道你很爛了!!

但很不巧的,我女友就在你這買了一個耳機!!

不然我原本死都不會在這買任何東西

結果只買了一個就出這種包!!!

我只想知道..送修的物件..不見是要怎樣?

還我一個一樣的就算了...居然還一個更爛的!!

真的是保力達...嘛泥哥B

2010年6月25日 星期五

松藥房的兒子們

作者 wayne1985 (小書&小昭) 看板 KoreaDrama
標題 [心得] 松藥房的兒子們
時間 Sat Jun 26 02:49:07 2010
───────────────────────────────────────

第一次看這部是從29集開始看

是我跟我女友一起看的

然後我就迷上了這部連續劇

用了好幾天的時間把他終於看完

然後一直REVIEW我最喜歡的幾個橋段

而其中有幾個橋段是我最喜歡的!!

或者是最感動的,或是最喜歡也是最感動的幾個橋段



1.真風把大風叫出去揍他後,兩個人的真心話告白:

這段我真的看到哭了出來(小弟我幾乎是無血無淚的人)

可能也因為我家裡也是好幾個小朋友的家庭,
所以我對大風對他哥說出他從小的委屈的時候

特別的有感覺,而大風邊說出他的心裡話邊流著眼淚的畫面

讓我回想到,我曾經也有跟我媽有類似的對話過

真的讓我一開始是我最討厭的人物,變成最喜歡的人物了@@“~

原來他個性這麼機車不是沒有原因的

然後畫面切到宋爸跟宋媽在講話的地方

他爸回想並道說出當時大風對宋爸說我很想哥哥,我很想弟弟

的時候,我又不停的直流眼淚。

大風,原來你受了這麼多的委屈!

看似很小的事情,卻讓你從小就有苦往心裡吞

我到現在對大風對他哥激動的說話的表情,一直難難忘懷

而真風聽到自己的弟弟這樣的話,當然是心疼到難以自拔

我最愛的弟弟,我居然不曉得他受到了那麼多的委屈

還一直罵他打他誤會他

而後面大風又知道大哥跟他喜歡的人(秀珍)是互相喜歡的

他也沒有之前那麼激動的行動跟言論

只想要大哥跟秀珍能夠獲得幸福,兄弟之間的情誼

我從來沒有在那一部連續劇看到過,

那麼平凡卻又那麼讓我激動不己的畫面



2.宋媽喝酒回來看到真風在自己店裡跟人講電話笑的很誇張的場景

在這裡宋媽哭的真的很難過,

在這一連串的真風事件中

真的很清楚的表達出,真風是宋媽最愛的兒子

是宋媽最放心也是最不放心的大兒子

宋媽心裡的失落感,蹲在路邊哭的樣子

真的讓人好心疼啊!!!

自己最愛的大兒子,就要這樣讓給別人了



3.真風送宋媽戒指,抱在一起的場景

這一個橋段,真的讓人猜不到想不透

但卻又讓我心裡的哭哭鬼又出來鬧我了 冏RZ

這一個場景,台詞並沒有很多!時間也沒有很長

但是真風對宋媽的不捨跟感恩

卻從簡單的幾個動作(送戒指)

表露無疑,很平凡很樸實!!卻是最感動我的


4.隔著房門大風跟福實的純情(笑)

這個時候的大風的每一句話,都己經完全解放了自己的堅硬外殼

每一句都很像小孩子的認錯台詞

其實這一段沒什麼好說的,但我卻很喜歡這一段的畫面跟台詞

因為這一段的台詞,是全劇裡

大風對福實最最最沒有掩飾的告白


五十幾集裡面,柳善(福實)

的表演真的最讓我印像最最最深刻

一方面是跟她之前曾經所演的角色有很大的反差

而且在松劇中,她伴演了很多不同個性卻又是同一個人的困難角色

雖然是主角群之一,但我覺得她是最搶眼的

而且真的不愧是電眼美女

她的眼神真的會說話啊!!!!!!!!!!!

她的眼神真的是畫龍點睛又帶有強烈的尾勁

我特別喜歡有她出現的場景(如果又有大風又更好XDD)





松藥房的兒子們

每一種感情的描寫,都很樸實!!

卻又很近於生活!讓人很容易跟著引起共鳴

其中太多地方引起我的情緒了。。。。

由其,其中有超多場景都是出現在吃東西(吃正餐或在外吃小吃)

的時候,的確!!

一家人最重要的事就是在餐桌上

而現實生活中也是這樣(我說我的生活)

在我家裡,吃飯時間到了

家裡不管是誰,都會大聲嚷嚷著

爸~~~呷本啦!! 媽呷本啦~~

不然就姐~~呷本啦~~~等等的

吃飯的時候,就是要一家人吃才會好吃

就算是在外面吃飯,一群朋友一起吃最好吃了!!~

真的很配服韓國人超會拍家庭劇的!!!

最後,松劇的選角真的太厲害了=,=

每個角色所配的演員。。。。。。。。。實在都太太太太太適合了!!!!




--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.170.210.245

2010年5月16日 星期日

我工作的地方 有夠擠

夜間模式開的
有加閃光

有加閃光2


一個書桌塞了三台電腦 mb dv 跟一台22吋aio 還有一組2.1喇叭 一個雷射事務機

有夠擠的!!! 很明顯的看到3顆滑鼠都擠在一個地方

還好滑鼠都是無線的,不然更擠...........

這桌子實在太小了,根本是給小人國的人用的

真希望換一個3米 x 1.2米 的大桌子!!!

2010年4月22日 星期四

MACBOOK 小白








  21號中午我拿到了我生命中第一台APPLE PRODUCT

""MACBOOK""

說實話,非常的挫折!!!

使用習慣,完全和WIN不一樣....

用起來礙手礙腳的,和WIN的邏輯方式完完全全的不同

我原本以為WIN跟MAC應該很多都差不多吧..

沒錯,在MAC裡有些地方有WIN的影子

而在WIN裡有些地方,我發現也是抄MAC OS的

但這些所謂的影子,都是好的!!!

都是為了讓兩者的OS都能有更方便的使用性

雖然MACBOOK讓我受到了很多挫折

但我在小白身上,卻發現了很多迷人的地方

他把軟件的使用方式,做的更單純了

這點真的很棒,還有介面真的是做的超漂亮

但有一點WIN就比較好了@@"~WIN的圖形物件導向

做的卻好很多(耗資源+1)

詳細我就不多說了@@"~大部份人不會做這點的比較

而MACBOOK的省資源性和省電性,真的讓我大開了眼界

嚇死我的毛....居然可以用至少4.5個小時以上

這點可是WINTEL望塵莫及的

還有一點我要提一下

MAC OS的倉頡輸入法,比MS的還好用(其他的我不知道)

雖然我有幾樣週邊,也是有MAC OS的驅動

但抓了都不能用,這點我是蠻納悶的

但我把OS灌成上一版的以後,就都沒有問題了!!

這部份可以給版友們做參考...

我暫時應該會把我的HP封印起來

專心的去習慣MAC OS

我認為,一切真的只是習慣的問題

客觀來看的話,MAC OS有許多小地方

是比WIN來的優秀!!!

加油!!!維尼!!!加油!!!小白!!!

2010年4月12日 星期一

喵仔小時候

MOMO和現在差很多~~之前很小一隻~~現在是胖喵 ^ ^ MIKI超古錐的~~



毛色很白~~現在整個都灰掉囉~~





2010年4月2日 星期五

自己鑽進被子裡~~MOMO MIKI~~~MIKI仔
MOMO是小胖仔~~



MIKI站起來囉~~^^


古錐喵~~~喵

吐舌頭睡著的MOMO仔


MOMO~~~









2010年3月26日 星期五

Java 第二堂課

public class Practise {
/**
* @param args
*/
public static void main(String[] args) {

System.out.println(args[0]);
System.out.println(args[1]);
System.out.println(Integer.parseInt(args[0])+Integer.parseInt(args[1]));


}
}

1.使用args[],來輸入字元
2.再使用Integer.parseInt()把字元轉換成整數
3.再將兩個整數相加,後印出

2010年3月24日 星期三


心情棒呼輕鬆~~


來這裡有一票便宜的版工~


把他們買回家吧!!
點圖會放大哦~

2010年3月22日 星期一

滷蛋仔~生日快樂



阿扁還沒出來所以沒畫~
煎蝦在我肚仔內..所以也沒畫

2010年3月21日 星期日

Bamboo pen











前幾天買了一塊繪圖板!!

超好用的,不管寫字畫圖都跟真的一樣~

而且拿來當滑鼠用也是很方便~

靈敏度非常的好~!!








2010年3月19日 星期五

Java 第一堂課

下載JAVA:載點

下載Eclipse:載點

使用方法:

1.先下載JAVA再下載Eclipse,選擇自己要的版本。

2.因為是硬碟版,所以下載好再解壓縮後;點執行檔即可使用。

第一堂課教學內容:

重點:

1.MATH資料庫的呼叫

2.數學運算

public static void main(String[] args) {

int x,y,z;

x=1;

y=3;

z=x+y;

double pi;

pi=Math.cos(0);

System.out.println(pi);

pi=Math.cos(Math.PI/4);

System.out.println(pi);

pi=Math.cos(Math.PI/2);

System.out.println(pi);

pi=Math.cos(Math.PI*3/2);

System.out.println(pi);

pi=Math.cos(Math.PI*2);

System.out.println(pi);

pi=Math.sin(0);

System.out.println(pi);

pi=Math.sin(Math.PI/4);

System.out.println(pi);

pi=Math.sin(Math.PI/2);

System.out.println(pi);

pi=Math.sin(Math.PI*3/2);

System.out.println(pi);

pi=Math.sin(Math.PI*2);

System.out.println(pi);

// TODO Auto-generated method stub

}

2010年3月15日 星期一

web C# array and write

int[] myArray1 = new int[]{3,4,3,5,6,1};
Response.Write(Convert.ToString(myArray1[0]));
Response.Write("////
");
int[] numbers = { 4, 5, 6, 1, 2, 3, -2, -1, 0 };
foreach (int i in numbers)
{
Response.Write(i);
Response.Write("
");
}

int a,b,c,d,f;
f = Convert.ToInt16(TextBox1.Text);
b = f;
d = f;
a = f % 10;
b = b - a;
b = b / 10;
Convert.ToString(b);
Response.Write(b);
Response.Write("
");
c = f % 5;
d = d - c;
d = d / 5;
Convert.ToString(d);
Response.Write(d);
Response.Write("
");
Response.Write(TextBox1.Text);


Response.Redirect(http://www.yahoo.com.tw);

2010年3月14日 星期日

MSI 22吋平版家用電腦

AE2200 PRO


今天呢!!
從老師那裡搬了這台電腦回來玩!!
一拿到家,開電腦!!整個系統已經被玩爛掉了.
連畫面都有點模糊...實在不知道是怎麼玩的=,=
我就先把他重灌好,再做了一次備份~
先貼個官網連結:請點我
規格: 請點我
使用心得:

就螢幕很大很漂亮,因為是HD的關係吧~~~
所以看起來很舒服!!只是實在不喜歡16:9這種扁的有點噁心,左右距太大@@"~
不然其他的話,用起來都沒什麼問題!
再來一張照片:




2010年3月13日 星期六

納豆咖


筆電有三寶


滷蛋/煎蝦/油雞噗


2010年2月27日 星期六

ThinkPad藍芽滑鼠




表面觸感極佳,外型完全是TP的味道!!
雷射感應,可以不用滑鼠墊~超好用的!!~呵呵
買了非常的開心。
而且他是憑發票保固一年哦~
價錢是1400NT




2010年2月12日 星期五

2010年1月7日 星期四

VC#期末作業

經由W、S、A、D可做3D旋轉

               此3D空間是以此物件為中心(神劍)
               神劍會隨著時間不停地做旋轉


               烏龜會隨著時間隨機走動


               經由←→鍵可旋轉蠍子
               ↑↓可前後移動蠍子
遊戲程式碼下載連結!!
http://webhd.xuite.net/_oops/a88488869/48q

主程式部份
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
namespace WindowsGame1
{
///
/// This is the main type for your game
///

public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
GameComponentNPC_Evade NPC_01;
GameComponentNPC_RotationY NPC_02;
InspectionCamera camera;
GameComponent_Grid Grid;
GameComponent_PC PC_01;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
this.IsMouseVisible = true;
this.Window.Title = "A、D、W、S、Z、X、Space 鍵;↑、↓、← 鍵";
}
protected override void Initialize()
{
// TODO: Add your initialization logic here
NPC_01 = new GameComponentNPC_Evade(this, Content.Load("tortoise"));
Components.Add(NPC_01); // 由這裡 加入 DrawableGameComponent
camera = new InspectionCamera(this);
camera.cameraRotationX = 30;
this.Components.Add(camera);
Grid = new GameComponent_Grid(this);
this.Components.Add(Grid);
NPC_02 = new GameComponentNPC_RotationY(this, Content.Load("weapon5"));
NPC_02.World = Matrix.CreateScale(0.01f);
Components.Add(NPC_02); // 由這裡 加入 DrawableGameComponent
PC_01 = new GameComponent_PC(this, Content.Load("001"));
this.Components.Add(PC_01); // 由這裡 加入 DrawableGameComponent
base.Initialize();
}
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
// TODO: use this.Content to load your game content here
}
protected override void UnloadContent()
{
// TODO: Unload any non ContentManager content here
}
protected override void Update(GameTime gameTime)
{
// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
// TODO: Add your update logic here
NPC_01.EvadePosition = PC_01.Position;
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
NPC_01.View = camera.view;
NPC_01.Projection = camera.projection;
Grid.view = camera.view;
Grid.projection = camera.projection;
NPC_02.View = camera.view;
NPC_02.Projection = camera.projection;
PC_01.View = camera.view;
PC_01.Projection = camera.projection;
base.Draw(gameTime);

}
}
}

烏龜副程式部份
namespace WindowsGame1
{
///
/// This is a game component that implements IUpdateable.
///

public class GameComponentNPC_Evade : Microsoft.Xna.Framework.DrawableGameComponent
{
Model myModel; //宣告一個 模型物件 全域變數
Matrix[] transforms; // 宣告一個 骨架轉換矩陣 全域變數
//public Matrix World = Matrix.Identity;
public float Scale = 0.02f; // 3D 模型的縮放比例
public Vector3 Position = new Vector3(3, 0, 0); // 開始位置
public float Yaw = 0; // 目前的徑度
public float Yaw_initial = 0; // 開始的Y軸旋轉矯正徑度
public Vector3 Wander_Center = new Vector3(0, 0, 0); // 漫遊的中心點
public float Wander_Radius = 4; // 漫遊的半徑距離
public Matrix View = Matrix.CreateLookAt(new Vector3(0.0f, 2.0f, 2.0f),
Vector3.Zero,
Vector3.Up);
public Matrix Projection = Matrix.CreatePerspectiveFieldOfView(
MathHelper.ToRadians(45.0f),
1.333f, 1.0f, 10000.0f);
Random rd = new Random();
public Vector3 EvadePosition = new Vector3(3, 0, 0); // 閃躲的位置
public float EvadeRadius = 2; // 開始閃躲的半徑距離
public float CaughtRadius = 0.6f; // 已經被追逐到的距離
public GameComponentNPC_Evade(Game game, Model model)
: base(game)
{
// TODO: Construct any child components here
myModel = model;
}
///
/// Allows the game component to perform any initialization it needs to before starting
/// to run. This is where it can query for any required services and load content.
///

public override void Initialize()
{
// TODO: Add your initialization code here
transforms = new Matrix[myModel.Bones.Count];
myModel.CopyAbsoluteBoneTransformsTo(transforms);
base.Initialize();
}
///
/// Allows the game component to update itself.
///

/// Provides a snapshot of timing values.
public override void Update(GameTime gameTime)
{
// TODO: Add your update code here

Vector3 vectorToCenter = Wander_Center - Position;
float len = Vector3.Distance(Wander_Center, Position);
Vector3 vectorToChase = EvadePosition - Position;
float ChaseLen = Vector3.Distance(EvadePosition, Position);
if (ChaseLen < EvadeRadius)
{
float Yaw2 = (float)Math.Atan2(vectorToChase.X, vectorToChase.Z) +
MathHelper.Pi;
float diff = Yaw2 - Yaw;
while (diff < -MathHelper.Pi) diff += MathHelper.TwoPi;
while (diff > MathHelper.Pi) diff -= MathHelper.TwoPi;
float r = 0.02f * MathHelper.Pi;
diff = MathHelper.Clamp(diff, -r, r);
Yaw = Yaw + diff;
while (Yaw < -MathHelper.Pi) Yaw += MathHelper.TwoPi;
while (Yaw > MathHelper.Pi) Yaw -= MathHelper.TwoPi;
if (ChaseLen > CaughtRadius)
{
Vector3 step = new Vector3(0, 0, 0.01f);
Position += Vector3.Transform(step, Matrix.CreateRotationY(Yaw));
}
}
else
{
if (len > Wander_Radius)
{
float Yaw2 = (float)Math.Atan2(vectorToCenter.X, vectorToCenter.Z);
float diff = Yaw2 - Yaw;
float r = 0.01f * MathHelper.Pi * len / Wander_Radius;
//float r = 0.01f * MathHelper.Pi;
diff = MathHelper.Clamp(diff, -r, r);
Yaw = Yaw + diff;
}
else
Yaw += MathHelper.Lerp(-0.05f, 0.05f, (float)rd.NextDouble());
while (Yaw < -MathHelper.Pi) Yaw += MathHelper.TwoPi;
while (Yaw > MathHelper.Pi) Yaw -= MathHelper.TwoPi;
Vector3 step = new Vector3(0, 0, 0.01f);
Position += Vector3.Transform(step, Matrix.CreateRotationY(Yaw));
}
base.Update(gameTime);
}
//protected override void Draw(GameTime gameTime)
public override void Draw(GameTime gameTime)
{
foreach (ModelMesh mesh in myModel.Meshes)
{
// 設定網格的呈現效果 (世界、觀測、投影矩陣)
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] *
Matrix.CreateScale(Scale) *
Matrix.CreateRotationY(Yaw_initial) *
Matrix.CreateRotationY(Yaw ) *
Matrix.CreateTranslation(Position);
effect.View = View;
effect.Projection = Projection;
}
// 畫出在 模型 中的 某一個 網格
mesh.Draw();
}
}
}
}



蠍子副程式部份
namespace WindowsGame1
{
///
/// This is a game component that implements IUpdateable.
///

public class GameComponentNPC_RotationY : Microsoft.Xna.Framework.DrawableGameComponent
{
Model myModel; //宣告一個 模型物件 全域變數
Matrix[] transforms; // 宣告一個 骨架轉換矩陣 全域變數
public Matrix World = Matrix.Identity;
public Matrix View = Matrix.CreateLookAt(new Vector3(0.0f, 2.0f, 2.0f),
Vector3.Zero,
Vector3.Up);
public Matrix Projection = Matrix.CreatePerspectiveFieldOfView(
MathHelper.ToRadians(45.0f),
1.333f, 1.0f, 10000.0f);
float RotationY = 0;
public GameComponentNPC_RotationY(Game game, Model model)
: base(game)
{
// TODO: Construct any child components here
myModel = model;
}
///
/// Allows the game component to perform any initialization it needs to before starting
/// to run. This is where it can query for any required services and load content.
///

public override void Initialize()
{
// TODO: Add your initialization code here
transforms = new Matrix[myModel.Bones.Count];
myModel.CopyAbsoluteBoneTransformsTo(transforms);
base.Initialize();
}
///
/// Allows the game component to update itself.
///

/// Provides a snapshot of timing values.
public override void Update(GameTime gameTime)
{
// TODO: Add your update code here
RotationY += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
base.Update(gameTime);
}
//protected override void Draw(GameTime gameTime)
public override void Draw(GameTime gameTime)
{
foreach (ModelMesh mesh in myModel.Meshes)
{
// 設定網格的呈現效果 (世界、觀測、投影矩陣)
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] *
Matrix.CreateRotationY(MathHelper.ToRadians(RotationY)) *
World;
effect.View = View;
effect.Projection = Projection;
}
// 畫出在 模型 中的 某一個 網格
mesh.Draw();
}
}
}
}
方格地板副程式
namespace WindowsGame1
{
///
/// This is a game component that implements IUpdateable.
///

public class GameComponent_Grid : Microsoft.Xna.Framework.DrawableGameComponent
{
public int gridSize = 12; // 每邊有 幾格
public float gridScale = 1.0f; // 每格 的 寬
public Color gridColor = new Color(0xFF, 0xFF, 0xFF, 0xFF); // 格線 的顏色 內定是黑色
VertexBuffer vertexBuffer; // 頂點緩衝區
VertexDeclaration vertexDeclaration; // 頂點格式 (每個頂點 包含什麼內容)
BasicEffect effect; // 產出時會用到的 效果
int vertexCount; // 頂點 數目
GraphicsDevice device; //繪圖設備
public Matrix world = Matrix.Identity; // 世界 觀測 投影 矩陣
public Matrix view = Matrix.CreateLookAt(new Vector3(0.0f, 20.0f, 20.0f),
Vector3.Zero,
Vector3.Up);
public Matrix projection = Matrix.CreatePerspectiveFieldOfView(
MathHelper.ToRadians(45.0f),
1.333f, 1.0f, 10000.0f);
public GameComponent_Grid(Game game)
: base(game)
{
// TODO: Construct any child components here
this.device = game.GraphicsDevice;
}
///
/// Allows the game component to perform any initialization it needs to before starting
/// to run. This is where it can query for any required services and load content.
///

public override void Initialize()
{
// TODO: Add your initialization code here
effect = new BasicEffect(device, null); // 效果
vertexCount = (gridSize + 1) * 4; // 每邊的頂點數 比 每邊的格數 多一,共有四個邊
// 每個頂點 包含 位置 和 顏色 ,先空出 vertexCount 個 頂點
VertexPositionColor[] vertices = new VertexPositionColor[vertexCount];
float length = (float)gridSize * gridScale; // 邊長 等於 格數 乘以 格寬
float halfLength = length * 0.5f; // 半邊長 因為是要 以原點為中心 左右 各半
int index = 0; // 頂點 索引
// 定義頂點位置 頂都是 躺在 X Z 平面上
for (int i = 0; i <= gridSize; ++i)
{
vertices[index++] = new VertexPositionColor(
new Vector3(-halfLength, 0.0f, i * gridScale - halfLength),
gridColor); // 左邊的頂點
vertices[index++] = new VertexPositionColor(
new Vector3(halfLength, 0.0f, i * gridScale - halfLength),
gridColor); // 右邊的頂點
vertices[index++] = new VertexPositionColor(
new Vector3(i * gridScale - halfLength, 0.0f, -halfLength),
gridColor); // 上緣的頂點
vertices[index++] = new VertexPositionColor(
new Vector3(i * gridScale - halfLength, 0.0f, halfLength),
gridColor); // 下緣的頂點
}
// 建立 頂點緩衝區
vertexBuffer = new VertexBuffer(device, vertexCount * VertexPositionColor.SizeInBytes,
BufferUsage.WriteOnly);
// 將 頂點資料 複製入 頂點緩衝區 內
vertexBuffer.SetData(vertices);
// 頂點格式
vertexDeclaration = new VertexDeclaration(device, VertexPositionColor.VertexElements);
base.Initialize();
}
///
/// Allows the game component to update itself.
///

/// Provides a snapshot of timing values.
public override void Update(GameTime gameTime)
{
// TODO: Add your update code here
base.Update(gameTime);
}
public override void Draw(GameTime gameTime)
{
// 效果 三大矩陣 設定
effect.World = world;
effect.View = view;
effect.Projection = projection;
effect.VertexColorEnabled = true; // 使用 頂點顏色 效果
device.VertexDeclaration = vertexDeclaration; // 頂點格式
device.Vertices[0].SetSource(vertexBuffer, 0, VertexPositionColor.SizeInBytes); // 頂點來源
effect.Begin(); // 效果 開始
foreach (EffectPass CurrentPass in effect.CurrentTechnique.Passes)
{
CurrentPass.Begin();
device.DrawPrimitives(PrimitiveType.LineList, 0, vertexCount / 2); // 兩兩畫線 所以只有 vertexCount/2 條線
CurrentPass.End();
}
effect.End();
}
}
}
神劍副程式部份
namespace WindowsGame1
{
///
/// This is a game component that implements IUpdateable.
///

public class GameComponent_PC : Microsoft.Xna.Framework.DrawableGameComponent
{
Model myModel; //宣告一個 模型物件 全域變數
Matrix[] transforms; // 宣告一個 骨架轉換矩陣 全域變數
public Vector3 FrontVector = new Vector3(0, 0, 1); //3D 物件的 往前向量
public Vector3 Position = new Vector3(0.0f, 0.0f, 0.0f); // 3D 物件的 位置
public float Yaw = 0.0f; // 第一人稱的Y軸旋轉角度
public float YawDelta = 100.0f; // 旋轉角度 的 增減量
public float MoveDelta = 2; // 前後走 的 增減量
public Matrix View = Matrix.CreateLookAt(new Vector3(0.0f, 20.0f, 20.0f),
Vector3.Zero,
Vector3.Up);
public Matrix Projection = Matrix.CreatePerspectiveFieldOfView(
MathHelper.ToRadians(45.0f),
1.333f, 1.0f, 10000.0f);
public GameComponent_PC(Game game, Model model)
: base(game)
{
// TODO: Construct any child components here
myModel = model;
}
///
/// Allows the game component to perform any initialization it needs to before starting
/// to run. This is where it can query for any required services and load content.
///

public override void Initialize()
{
// TODO: Add your initialization code here
transforms = new Matrix[myModel.Bones.Count];
myModel.CopyAbsoluteBoneTransformsTo(transforms);
base.Initialize();
}
///
/// Allows the game component to update itself.
///

/// Provides a snapshot of timing values.
public override void Update(GameTime gameTime)
{
// TODO: Add your update code here
float elapsedTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
KeyboardState newState; // 宣告一個KeyboardState 結構的變數
newState = Keyboard.GetState(); //得到目前鍵盤每一個按鍵的狀況
if (newState.IsKeyDown(Keys.Right)) Yaw -= YawDelta * elapsedTime; //判斷Right鍵是否已經被按下
if (newState.IsKeyDown(Keys.Left)) Yaw += YawDelta * elapsedTime; //判斷Left鍵是否已經被按下
if (newState.IsKeyDown(Keys.Up)) //判斷Up鍵是否已經被按下
{
Position += Vector3.Transform(-MoveDelta * elapsedTime * FrontVector,
Matrix.CreateRotationY(MathHelper.ToRadians(Yaw)));
}
if (newState.IsKeyDown(Keys.Down)) //判斷Down鍵是否已經被按下
{
Position += Vector3.Transform(MoveDelta * elapsedTime * FrontVector,
Matrix.CreateRotationY(MathHelper.ToRadians(Yaw)));
}
base.Update(gameTime);
}
public override void Draw(GameTime gameTime)
{
foreach (ModelMesh mesh in myModel.Meshes)
{
// 設定網格的呈現效果 (世界、觀測、投影矩陣)
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] *
Matrix.CreateScale(0.01f) *
Matrix.CreateRotationY(MathHelper.ToRadians(Yaw)) *
Matrix.CreateTranslation(Position); //
effect.View = View;
effect.Projection = Projection;
}
// 畫出在 模型 中的 某一個 網格
mesh.Draw();
}
}
}
}