shawind 发表于 2012-11-5 20:10:54

编程语言nimrod:果然这个世界上总会有人爱好相同

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()

shawind 发表于 2012-11-5 20:47:19

另外还有一些有用的资源:

https://github.com/dom96/jester
模仿了ruby的微型网页开发框架sinatra的网页开发框架

https://github.com/Vladar4/nimgame
一个才0.3还没有完成的游戏框架,基于sdl

https://github.com/fowlmouth/nimrod-glfw
glfw的移植

https://github.com/fowlmouth/nimrod-sfml
sfml 2.0

https://github.com/fowlmouth/nimrod-chipmunk
2d物理引擎chipmunk

https://github.com/fowlmouth/nimlibs
assimp, devil 图像处理
bullet ode 3d物理引擎
clutter 3d加速的2.5d GUI库
ftgl opengl的渲染

https://github.com/fowlmouth/nimrod-enet
udp网络开发包 enet

https://github.com/apriori/nimCL
opencl

secondsen 发表于 2012-11-5 22:27:19

这。。。自己写个脚本??游戏开发??

tamashii 发表于 2013-2-4 17:10:36

我对这种编程语言不感兴趣,符号太复杂了 Orz
还是C/C++或者是C#这样的好。
最好能弄一个可以编写Native的C#

duzhi5368 发表于 2022-4-11 14:57:38

讲真,回头来看这帖子,这语言看起来确实有很好的底子,可惜没大应用发展起来。
滚滚长江东逝水,浪花淘尽英雄。
页: [1]
查看完整版本: 编程语言nimrod:果然这个世界上总会有人爱好相同