作者purpose (purpose)
看板Programming
标题Re: 冒昧请教高手有关游戏的程式设计....
时间Thu Jan 24 19:59:07 2013
※ 引述《kingstong (卍解-天锁斩月)》之铭言:
: 我只知道要制作游戏需先在电脑绘画图档(单机游戏)
: 然後再利用程式将图档与程式做连结.......
: 有人是使用DirectX,但我想知道在dos时代时
: 到底是怎麽写游戏.....就像大宇的轩辕剑
: 或是仙剑奇侠传等...还望高手赐教,感激不尽
经典游戏,金庸群侠传总玩过吧
http://goo.gl/oYYUR
这里有原始码,用 C 语言写,一样从 main 开始
int main(int argc, char* argv[])
#endif
{
srand(clock());
InitialFont();
InitialVedio();
InitialAudio();
Start();
Quit();
return 0;
}
然後这个专案画图是用 SDL 画的:
http://goo.gl/Lzugi
====
而 DOS 基本就两种显示模式,文字模式、绘图模式。
平常刚开玩机,就文字模式,这时只能显示些文字,然後你要画图就是用 CPU 指令 int
呼叫中断,进入绘图模式,进入後就可以有比如 320 X 200 像素
然後你画图时就是一个像素一个像素去设定,比如 X 座标 = 10, Y 座标 = 20 时
颜色要采用比如黄色...
DOS 绘图范例程式码:
http://ubuntuone.com/p/17bB/
====
补充:备份一下上面网址内的程式码,以免砍档後看不到
Plotting a pixel
An easy way to plot a pixel is by using function 0x0C under BIOS interrupt
0x10. For this function, set CX
and DXto the pixel xand ylocation. The color displayed depends on the value
in AL. See Table I for a list
of common colors.
union REGS regs;
regs.h.ah = 0x0C; /* function 0Ch = pixel plot */
regs.h.al = color;
regs.x.cx = x; /* x location, from 0..319 */
regs.x.dx = y; /* y location, from 0..199 */
int86(0x10,®s,®s);
Plotting a pixel quickly
typedef unsigned char byte;
byte far *VGA = (byte far*)0xA0000000L;
unsigned short offset;
/* ... */
offset = 320*y + x;
VGA[offset] = color;
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 124.8.138.160
※ 编辑: purpose 来自: 124.8.138.160 (01/24 21:10)
1F:推 Bencrie:那个时代记忆体应该比较难搞吧 XD 114.34.236.197 01/24 23:56
2F:→ MOONRAKER:在DPMI/VCPI之前都是恶梦 114.45.207.187 01/25 22:54