让AppGameKit输出中文,太美了

之前使用AGK开发游戏时苦于只能输出英文,作为中国人很不爽。
经过我的研究,发现是可以输出中文的。
对于Text和Print都适用,一起来看看吧!

  1. 使用LoadFont加载字体。
  2. 使用CreateText创建Text。
  3. 给Text设置大小位置等属性。
  4. 使用SetTextFont给Text设置字体即可。(或者使用SetPrintFont设置打印的字体)

注意在项目的路径中必须有你的字体。
在这里插入图片描述
没有字体也没关系,在下面路径找到系统字体,复制到你的项目文件夹即可。(这些字体必须支持中文才可输出中文)
在这里插入图片描述

项目完整代码:


// Project: MyFont 
// Created: 2020-04-14

// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "字体" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts

LoadFont(1,"simfang.ttf")
SetPrintFont(1)
SetPrintSize(60)

CreateText(1,"再见!bye!")
SetTextFont(1,1)
SetTextSize(1,50)
SetTextPosition(1,100,350)

do
    
	Print("仿宋")
	Print("如果有帮到您,感谢点个赞!")
    Sync()
loop

效果如下:
在这里插入图片描述

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序鸡

如果帮到您,点个赞鼓励一下吧。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值