Skip to content

Instantly share code, notes, and snippets.

@PifyZ
Last active October 12, 2015 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PifyZ/4723a56585901033d0ee to your computer and use it in GitHub Desktop.
Save PifyZ/4723a56585901033d0ee to your computer and use it in GitHub Desktop.
rock --libpath=libhang-c/src --incpath=libhang-c/include -lhang
include libhang
lhMutex: cover from lh_mutex_t {
id: extern Int64
}
lhWindow: cover from lh_window_t {
id: extern Int64
x: extern Int
y: extern Int
width: extern UInt
height: extern UInt
graphic_ctx_mutex: lhMutex*
}
lhRgba: cover {
r, g, b, a: Float
}
lhColor: cover from lh_rgba_t {
comp: lhRgba
}
lhVec3: cover from lh_vec3_t {
x, y, z: extern Float
}
lhDistance: cover from lh_distances_t {
near_v: extern(near) Float
far_v: extern(far) Float
}
lhObj: cover from lh_obj_t {
id: extern Int
pos : lhVec3
angle: lhVec3
is_visible: extern Bool
culling_enabled: extern Bool
reversed_culling: extern Bool
depth_test_enabled: extern Bool
is_illuminable: extern Bool
custom_textures: extern UInt*
nb_clones: extern UInt
nb_allocated_clones: extern UInt
}
lhInit: extern func -> Void
lhCreateWindow: extern func(CString, Int, Int, UInt, UInt, Int, Int) -> lhWindow*
lhSetBackColor: extern func(lhWindow*, lhColor*) -> Void
lhStartDrawing: extern func(lhWindow*) -> Void
lhEnterEventLoop: extern func(lhWindow*) -> Void
lhRegColoredCube: extern func(lhWindow*) -> Int
lhNewColoredCube: extern func(lhWindow*, Float, lhVec3*, lhVec3*, lhColor*, Bool) -> lhObj*
lhEnableLight: extern func(lhWindow*, Int, Int) -> Void
lhSetCameraPos: extern func(lhWindow*, lhVec3*) -> Void
lhSetRenderDistances: extern func(lhWindow*, lhDistance*) -> Void
lhSetAmbientLight: extern func(lhWindow*, lhColor*) -> Void
lhSetLightParameters: extern func(lhWindow*, Int, lhColor*, lhVec3) -> Void
// Test
lhInit()
window := lhCreateWindow("TerraNova", 0, 0, 640, 480, 1, 1)
color: lhColor*
color@ comp r = 0
color@ comp g = 0
color@ comp b = 0.1
color@ comp a = 1
lhSetBackColor(window, color)
distance: lhDistance*
distance@ near_v = 0.1
distance@ far_v = 100
color2: lhColor*
color2@ comp r = 0.4
color2@ comp g = 0.4
color2@ comp b = 0.4
color2@ comp a = 1
lhSetRenderDistances(window, distance)
//lhSetAmbientLight(window, color2)
lhStartDrawing(window)
lhEnterEventLoop(window)
Name: libhang-ooc
Version: 0.0.0
SourcePath: src
Main: libhang-ooc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment