Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8313455
  • 博文数量: 1413
  • 博客积分: 11128
  • 博客等级: 上将
  • 技术积分: 14685
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-13 10:03
个人简介

follow my heart...

文章分类

全部博文(1413)

文章存档

2013年(1)

2012年(5)

2011年(45)

2010年(176)

2009年(148)

2008年(190)

2007年(293)

2006年(555)

分类:

2006-09-12 12:25:39

[点评:freebasic有着与qbasic一样简单的语法,但是它是发展了的BASIC语言.在许多功能上面要强于qbasic,这是我们所要了解的第一点]
1、Hello,world!
使用freebasic在windows下面,最好是用freebasic ide,这样比较方便.

PRINT "Hello World!"
SLEEP
按F5键开始编译执行.
2、类似于quickbasic的命令
LOCATE 10,10
PRINT "I'm the center of the universe!"
SLEEP
3、Screen13
在代码之前加入screen13,看到会多么简单的进入图形模式
SCREEN 13
PRINT "Hello World!"
SLEEP
你可以像QB下面一样简单的使用这些命令
SCREEN 13
LINE (1,1)-(100,100),1,bf
PRINT "Hello World!"
CIRCLE (10,10),10,2
PSET (30,15),3
SLEEP
Freebasic同样具有qb所不具备的特性,qb的屏幕不会大于14,而FREEBASIC却可以。
SCREEN 15
LINE (1,1)-(100,100),1,bf
PRINT "Hello World!"
CIRCLE (10,10),10,2
PSET (30,15),3
用screen打开图形模式后,你可以用alt+enter在窗口呼全屏之间进行切换.
另一个很好的特征是在freebasic下,你可以任何的视频模式下面进行页面翻转.
DIM page
DIM notpage
DIM a,b


screen 12, , 2 'This sets the screen for 2 pages
notpage = 1 'This sets the backpage

DO
IF page = 0 THEN page = 1 ELSE page = 0 'These two lines flip the page and the
IF notpage = 1 THEN notpage = 0 ELSE notpage = 1 'backpage

SCREENSET page, notpage 'This flips the page

CLS 'First we clear the screen
b = b + 1
IF b > 100 THEN b = 0
FOR a = 1 TO 128
PSET (b,a),a 'Then we draw a line. It moves without flickering.
NEXT a
一段简单的代码,获取鼠标的信息
DIM x,y,buttons
CONST escapeKey = 1
SCREEN 12

WHILE NOT MULTIKEY(escapeKey) 'this checks the escape key every frame
GETMOUSE x, y, , buttons 'This gets the mouse state
PRINT x,y,buttons
WEND
LOOP

SLEEP

阅读(3049) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2008-02-29 19:31:12

好像 screen 下用中文字会乱码哦? 知道怎么解决吗?