hobby-script
所属分类:编程语言基础
开发工具:Haskell
文件大小:0KB
下载次数:0
上传日期:2024-04-06 01:50:35
上 传 者:
sh-1993
说明: 一种为游戏开发而设计的编程语言。
(A programming language designed for game development.)
文件列表:
benchmark/
examples/
src/
tests/
benchmark.py
makefile
test.hs
test.py
# HobbyScript
A dynamically typed programming language designed for use in game development.
## Features
- No OOP
- Designed by me
- Works with Swift syntax highlighting
### Hello, world!
```swift
print("Hello, world!");
```
### Something more substantial
Here's a simple timer, that works given a delta time:
```swift
struct Timer {
var totalTime;
var timeLeft;
static func new(time) {
return Timer {
.totalTime = time,
.timeLeft = 0,
};
}
func start() => self.timeLeft = self.totalTime;
func step(delta) => self.timeLeft -= delta;
func isOver() => self.timeLeft < 0;
}
var timer =- Timer:new(15);
timer.start();
loop {
timer.step(1);
print(timer.timeLeft);
if (timer.isOver()) {
break;
}
}
```
近期下载者:
相关文件:
收藏者: