- 注册时间
- 2004-11-1
- 最后登录
- 2018-4-24
版主
- 积分
- 548
|
http://nimrod-code.org
主要是仿制python,另外还有一些pascal的风格
总之没有了同样是先编译成c的,Genie必需glib库的麻烦,也不像Zimbu关键字大写,结尾单花括号的那么别扭。
主流c编译器nimrod都支持。可以直接用vc,这就砍掉了d语言只认omf格式的短腿。
虽然才0.9版本,库已经几乎比较全面了,像线程,容器,网络,xml&json支持,unicode,加密算法,redis数据库访问,数据库mysql,mongo,sqlite...,正则表达式,zip,ssl,winapi,x11,pcre,tre,cairo,sdl, opengl,gtk,iup,libcurl,libuv,openssl......
可惜,对游戏开发来说,应该还少了个openal。
只是对于nimrod,直接用工具转换下H文件就可以用c库了。所以openal,bass什么的也不是问题。
就连脚本语言,它都支持了3个lua,tcl和python。
已经开发有一个ide。
总的来说非常不错,可玩性相当的高。
在github上看到的一个例子,这代码写出来,那是绝对的漂亮。ps.只 是我个人的感觉:)- import glfw
- import opengl ## TODO: Maybe import opengl in glfw ?
- import strutils
- ## -------------------------------------------------------------------------------
- var
- running : bool = true
- frameCount: int = 0
- lastTime: float = 0.0
- lastFPSTime: float = 0.0
- currentTime: float = 0.0
- frameRate: int = 0
- frameDelta: float = 0.0
- x: float = 0.0
- y: float = 0.0
- vx: float = 200.0
- vy: float = 200.0
- windowW: int = 640
- windowH: int = 480
- ## -------------------------------------------------------------------------------
- proc Initialize() =
-
- if Init() == 0:
- write(stdout, "Could not initialize GLFW! \n")
- if OpenWindow(windowW.cint, windowH.cint, 0, 0, 0, 0, 0, 0, GLFW_WINDOW) == 0:
- Terminate()
-
- opengl.loadExtensions()
- SwapInterval(1)
- glClearColor(0.1,0.1,0.1,1.0)
- glClearDepth(1.0)
- glEnable(GL_BLEND)
- glDisable(GL_LIGHTING)
- glCullFace(GL_BACK)
- glDisable(GL_DEPTH_TEST)
- glViewport(0,0,windowW,windowH)
- glMatrixMode(GL_PROJECTION)
- glOrtho(0.0, float(windowW), float(windowH), 0.0, 0.0, 1.0)
- lastTime = GetTime()
- lastFPSTime = lastTime
- ## -------------------------------------------------------------------------------
- proc Update() =
-
- currentTime = GetTime()
- frameDelta = currentTime - lastTime
- lastTime = currentTime
- if currentTime - lastFPSTime > 1.0:
- frameRate = int(float(frameCount) / (currentTime - lastFPSTime))
- SetWindowTitle("FPS: $1" % intToStr(frameRate))
-
- lastFPSTime = currentTime
- frameCount = 0
- frameCount += 1
- x += vx * frameDelta
- y += vy * frameDelta
- var w = float(windowW)
- var h = float(windowH)
- if x > w - 100.0:
- x = w - 100.0
- vx *= -1.0
- elif x < 0.0:
- x = 0.0
- vx *= -1.0
- if y > h - 100.0:
- y = h - 100.0
- vy *= -1.0
- elif y < 0.0:
- y = 0.0
- vy *= -1.0
- ## --------------------------------------------------------------------------------
- proc Render() =
-
- glClear(GL_COLOR_BUFFER_BIT)
- glMatrixMode(GL_MODELVIEW)
- glLoadIdentity()
- glBegin(GL_QUADS)
- glColor3f(0.9,0.2,0.49)
- glVertex3f(x, y, 0.0)
- glVertex3f(x + 100.0, y, 0.0)
- glVertex3f(x + 100.0, y + 100.0, 0.0)
- glVertex3f(x, y + 100.0, 0.0)
- glEnd()
- SwapBuffers()
- ## --------------------------------------------------------------------------------
- proc Run() =
-
- while running:
-
- Update()
- Render()
- running = GetKey(GLFW_KEY_ESC) == GLFW_RELEASE and
- GetWindowParam(GLFW_OPENED) == GL_TRUE
- ## ==============================================================================
- Initialize()
- Run()
- Terminate()
复制代码 |
|