注册会员 登录
Project1 返回首页

DeathKing的个人空间 https://rpg.blue/?11686 [收藏] [复制] [分享] [RSS]

日志

真是好可爱的命令行窗口

热度 11已有 1530 次阅读2010-8-21 23:51 |个人分类:QBasic|

 
据说咱是个命令行控,喜欢什么东西都命令行化,于是就弄了一个命令行Poker(坑化状态)。不过没关系,操刀QuickBASIC 4.05弄了一个OpenX(不是X/Open,别被忽悠)。
 
绘制代码:
 
CLS
CALL DrawBaseWindow(4, 5, 17, 14)
CALL DrawBaseWindow(7, 8, 20, 15)
CALL DrawMessage(10, 10, "A Message Test", "Just a Test!")

 
下面是蛋疼的代码(QuickBASIC可以编译,多久放上一个编译好的版本,下面这个只是一个可用的通用模块,绘制的代码见上方):
 
'------------------------------
' OpenX  1.00
'------------------------------
DECLARE SUB DrawBaseWindow (x AS INTEGER, y AS INTEGER, w AS INTEGER, h AS INTEGER)
DECLARE SUB DrawMessage (x AS INTEGER, y AS INTEGER, title AS STRING, text AS STRING)
DECLARE SUB DrawTitle (x AS INTEGER, y AS INTEGER, w AS INTEGER, title AS STRING)
DECLARE SUB DrawYesButton (x AS INTEGER, y AS INTEGER)
DECLARE SUB DrawText (x AS INTEGER, y AS INTEGER, text AS STRING)

SUB DrawBaseWindow (x AS INTEGER, y AS INTEGER, w AS INTEGER, h AS INTEGER)
 LOCATE y, x
 FOR nxs = x TO x + w
  FOR nys = y TO y + h
   LOCATE nys, nxs
   PRINT " "
  NEXT nys
 NEXT nxs
 
 
 xs = ys = 1
 WHILE xs <= w
  LOCATE y, x + xs
  PRINT "-"
  LOCATE y + h, x + xs
  PRINT "-"
  xs = xs + 1
 WEND
 WHILE ys <= h
  LOCATE y + ys, x
  PRINT "|"
  LOCATE y + ys, x + w
  PRINT "|"
  ys = ys + 1
 WEND
 LOCATE y, x
 PRINT "+"
 LOCATE y + h, x
 PRINT "+"
 LOCATE y, x + w
 PRINT "+"
 LOCATE y + h, x + w
 PRINT "+"
END SUB
SUB DrawMessage (x AS INTEGER, y AS INTEGER, title AS STRING, text AS STRING)
 
 alen = LEN(title)
 blen = LEN(text)
 w = 0
 IF alen > blen THEN
  w = alen
 ELSE
  w = blen
 END IF

  IF w < 22 THEN
  w = 22
 END IF
 
 CALL DrawBaseWindow(x, y, 22, 10)
 CALL DrawTitle(x, y, 22, title)
 CALL DrawYesButton(x + 7, y + 6)
 
END SUB
SUB DrawText (x AS INTEGER, y AS INTEGER, text AS STRING)
 LOCATE y, x
 PRINT text
END SUB
SUB DrawTitle (x AS INTEGER, y AS INTEGER, w AS INTEGER, title AS STRING)
 CALL DrawBaseWindow(x, y, w, 2)
 LOCATE y + 1, x + 1
 PRINT "*"
 CALL DrawText(x + 3, y + 1, title)
 
END SUB
SUB DrawYesButton (x AS INTEGER, y AS INTEGER)
 
 CALL DrawBaseWindow(x, y, 6, 2)
 CALL DrawText(x + 2, y + 1, "Yes")
END SUB
 
1

鸡蛋

鲜花

刚表态过的朋友 (1 人)

发表评论 评论 (5 个评论)

回复 yangff 2010-10-20 19:27
支持鼠标吗?
回复 DeathKing 2010-10-20 23:03
yangff: 支持鼠标吗?
那就全然没有意思了。。。。。。
回复 yangff 2011-2-5 16:57
DeathKing: 那就全然没有意思了。。。。。。
怎么会呢?我们信息学刚开始用fpc的时候就很疼的用fp做了一个支持鼠标的窗口模块……然后把做成了一个游戏……
回复 DeathKing 2011-2-5 16:58
yangff: 怎么会呢?我们信息学刚开始用fpc的时候就很疼的用fp做了一个支持鼠标的窗口模块……然后把做成了一个游戏…… ...
这里有个Pascal的投币游戏 = =b
回复 Losses 2011-7-14 19:17
= -! 你可以考虑用Qbasic写一个Windows DK- -!

facelist doodle 涂鸦笔

您需要登录后才可以评论 登录 | 注册会员

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2021-12-7 08:30

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

返回顶部