2010年1月12日

<OpenGL>glut在VC下改變icon的方法

OS:Windows XP
編譯器:Visual Studio (C++) 2005
文章更新日:2010/01/12



這邊以glut.ico glut.rc 為例,不一定要一樣
一、設置glut.ico

首先,準備一個ICO圖檔 ex: glut.ico
放在專案資源檔內

二、設置資源檔glut.rc

在資源檔新增glut.rc
在glut.rc中(用Notepad++開啟即可)增加
GLUT_ICON ICON glut.ico
(我是在 #ifndef APSTUDIO_INVOKED 的前一行加入)

三、編譯glut.rc

輸入rc /r glut
只講這行一定看不懂
當然是用命令提示字元編譯啦~~
從【程式集】→【Microsoft Visual Studio 2005】→
【Visual Studio Tools】→【Visual Studio 2005命令提示字元】
再將目錄切換到放RC檔的位置
輸入rc /r glut
編譯完成 打開看看你的目錄是否多了 glut.res
有就成功啦!

四、加入glut.res
在資源檔加入glut.res
將原先產生的glut.rc 移掉(移掉,不是刪掉,刪掉以後換圖示都要重做了)
(不然會產生資源檔重複訊息)

五、完成^^
實作成果


未來修改這個圖示
必須要重新編譯
rc /r glut
這個指令

未來有什麼更快的方法在PO上


參考文章 http://www.gamedev.net/community/forums/topic.asp?topic_id=153917

To customize the windows icon, you can use the resource name
GLUT_ICON. For example, create an icon named "glut.ico", and
create a file called glut.rc that contains the following:
GLUT_ICON ICON glut.ico
then compile the glut.rc file with the following:
rc /r glut
and link the resulting glut.res file into your executable
(just like you would an object file).
Alternatively, you can simply add the glut.rc file to your
project if you are using Microsoft Developer Studio.

沒有留言:

張貼留言