Red 0.4.3
ldci6-Aug-2014/1:25:27+2:00
Bonne nouvelle
L
ldci6-Aug-2014/1:26:40+2:00
La nouvelle version de red (0.4.3) supporte le type float 64-bit
http://www.red-lang.org/
GreG7-Aug-2014/17:50:24+2:00
Excellent
ldci30-Aug-2014/17:12:40+2:00
J'aime bien ce site

http://www.explodingdog.com/title/whyred.html

ldci2-Sep-2014/15:04:04+2:00
Salut à tous
Le support du type float! dans cette nouvelle version de Red permet de faire des trucs sympas.
A titre d'exemple voici un code qui illustre comment on peut intégrer dans red du code red/System qui lui-même fait appel à une bibliothèque externe.
Red [
	Title:		"GLFW Binding: Triangle"
	Author:		"Francois Jouen"
	Rights:		"Copyright (c) 2014 Francois Jouen. All rights reserved."
	License:        "BSD-3 - https://github.com/dockimbel/Red/blob/master/BSD-3-License.txt"
]

; how to use Red/System code inside Red
; use #system [library] to make import
; functions are replaced by routines because we are using Red/S code inside the function
; lastly red strings must be converted in c-strings red/System (Thanks to Jocko for as c-string! string/rs-head txt)

#system [
	#include %../../glfw.reds ; this lib also includes opgl.reds	
	; for error callback code pointer
	error_callback: func [[cdecl] error [integer!] description [c-string!]] [
	print [ description " " stderr]
	]
]


initgl: routine [txt [string!] return: [integer!]] [
	if glfwInit = 0 [glfwTerminate return 0]
	window: glfwCreateWindow 800 600 as c-string! string/rs-head txt NULL NULL
	glfwMakeContextCurrent window
	glfwSetErrorCallback :error_callback
	return 1
]

closegl: routine [] [
	glfwDestroyWindow window    
	glfwTerminate
]

render: routine [return: [integer!] /local rep [integer!]] [
		glClear GL_COLOR_BUFFER_BIT
		glBegin GL_TRIANGLES
			glColor3ub 255 0 0    glVertex2d -0.75 -0.75
			glColor3ub 0 255 0    glVertex2d 0.0 0.75 
			glColor3ub 0 0 255    glVertex2d 0.75 -0.75
		glEnd
		glFlush
		glfwSwapBuffers window
		glfwPollEvents  
		glfwWindowShouldClose window	; 1 for window close request
]


;Main program

title: "A Simple OpenGL Triangle with Red"
initgl title
rep: 0
	until [
		rep: render	
	rep = 1
	]
closegl
quit



Nenad va à son rythme pour coder, mais c'est du travail de pro

Login required to Post.


Powered by RebelBB and REBOL 2.7.8.4.2