r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Red] Red language group

Kaj
17-Aug-2011
[3001x2]
#include %../SDL.reds


log-error: does [  ; Log current SDL error.
	print [sdl-form-error newline]
]


red:	as-byte FFh
green:	as-byte FFh
blue:	as-byte FFh

screen:		as sdl-surface! 0

event:			declare sdl-event!
mouse-event:	declare sdl-mouse-motion-event!

either sdl-begin sdl-init-all [
	screen: sdl-set-video-mode 640 480 32  sdl-software-surface

	either as-logic screen [
	while [all [
		sdl-await-event event
		event/type <> as-byte sdl-quit
	]][
		if event/type = as-byte sdl-mouse-moved [
			mouse-event: as sdl-mouse-motion-event! event

			if as-logic (as-integer mouse-event/pressed?) and FFh [

    unless plot screen  mouse-event/x-y and FFFFh  mouse-event/x-y >>> 
    16  red green blue [
					log-error
				]
			]
		]
	]
	][
		log-error
	]

	sdl-end
][
	log-error
]
I hereby name it PeterPaint, after the friend whose birthday we're 
going to celebrate tomorrow :-)
GrahamC
17-Aug-2011
[3003]
should upload it to the red program repository
jocko
18-Aug-2011
[3004]
+1
shadwolf
18-Aug-2011
[3005x4]
PeterPaint aaaaaaaaaaaaaaaaaaahahahaah ... PetPaint would have been 
out of limit ?
hexadecimals used fort  event trigger comparaison could be holded 
in a meaning word ?
Impresive Kaj can you do us a set of widgets in SDL or just the smallest 
possible VID and the widgets will be designed later
I really like the  Idea of VID a single face that as all possibilities 
and you just activated /deactivate the parts you want or not this 
is for me the core meaning of VID.
Dockimbel
18-Aug-2011
[3009x2]
Looks very nice Kaj! Is your SDL binding available to download somewhere 
yet?
Re RTTI: One drawback is that you loose arguments type-checking, 
so some errors won't be caught at compile-time.
Kaj
18-Aug-2011
[3011x3]
Yes, it makes things a step more dynamic, so you move some of the 
checking to runtime. But that's actually the point: you can then 
develop interfaces that can be loosely compatible with a time range 
of interface versions. It's the philosophy of static everything versus 
declarative everything in REBOL and XML. In the beginning of computing, 
static seemed more correct, but these days it has turned out that 
everything has to be able to withstand change as well as possible
If you look at the Win32 API, for example, it's a huge mess of sets 
of deprecated interfaces that were replaced by new sets with slightly 
extended interfaces. So it's not only an issue in unreliable Internet 
programming, but also in low-level system programming
The SDL binding is not published yet. It's an experimental mess currently. 
I have been banging my head on getting sound to work
james_nak
22-Aug-2011
[3014x2]
Not that any of you would have issues with creating such a thing 
but here is an R2 version of the Colineau's (Jocko) Google translate 
app he created in Red. (Note, I didn't add all of the routines but 
if you take a look at Colineau's code it's all there.)  Also, the 
female voice (use gTTS function instead of TTS function) is much 
better than the male in my opinion unless you want to hear "This 
is Amiga Speaking." and feel nostalgic.

rebol [
	title: {googletts.r}
	date: 20-aug-2011
	usage: {gtts "Hello World." or tts "Hello World."}	
]

lib: load/library %tts-jc.dll

TTS: make routine! [
	lpStr [string!]
	return: [integer!]		
] lib "TTS"

gTTS: make routine! [
	lpStr [string!]
	return: [integer!]		
] lib "gTTS"

-----

I created some nice memory tools for my son who is in law school 
with this by setting up the string and tweaking it and then recording 
it (I use Sound Forge). If I get some free time I'd like to create 
a dialect so that I can make an interactive tool with visual reinforcements. 
As I mentioned, you have to tweak the words and punctuation and that 
creates a problem with just reading the text normally, hence I'll 
require a mechanism to sort all that out.

Oh, the dll is in the http://www.colineau.fr/rebol/downloads/demoTTS_Red.zip
file
Sorry I meant to post this in Core. :-(
Kaj
22-Aug-2011
[3016x2]
For the demos at the upcoming conferences, I've started working on 
a GTK+ binding
I can open a GTK window now
Dockimbel
22-Aug-2011
[3018x2]
Nice!
Have you finished with your SDL demos?
Kaj
22-Aug-2011
[3020x2]
No, I'm doing several things in parallel now
The SDL callback for playing sound crashes. It's in an extra thread, 
so it's hard to debug
jocko
22-Aug-2011
[3022]
just a detail on my dll :

tts uses the SAPI4 or SAPI5 voice synthesis normally installed on 
the PC (you can install other voices), while gTTS uses the Google 
TTS api. 

For the details on the SAPI5 interface, see http://www.colineau.fr/rebol/R3_extensions.html#section-2
james_nak
22-Aug-2011
[3023]
Thanks Jocko, that makes more sense since the female voice is so 
much better.
Pekr
23-Aug-2011
[3024]
Kaj - as you are so fast in creating bindings, you can port View 
engine as well, so that we coul use VID with RED later :-)
Kaj
23-Aug-2011
[3025]
I already told you: we can't use it. Besides, Red won't be compatible 
with REBOL, so it won't be able to run VID. The same goes for the 
View engine: it's very REBOL specific
Henrik
23-Aug-2011
[3026]
it does not prevent anything conceptually similar to be made, however.
Pekr
23-Aug-2011
[3027x3]
Kaj - I expect RED being kind-of compatible with REBOL, or I am not 
interested in it. I expect we will have parser, and REBOL-like constructs. 
We don't need 100% compatibility for porting. It is just that I thought 
that View (apart from its possible licence restrictions) is significantly 
smaller to port, when comparing to things like GTK or SDL?
Maybe one day it will come anyway, if Carl does not appear anytime 
in foreseable future. Add 2 months, and we are one year in an R3 
develompent limbo ...
I mean - maybe one day RMA ports it themselves :-)
Kaj
23-Aug-2011
[3030]
Any technical considerations are moot with software that you're not 
allowed to port
Pekr
23-Aug-2011
[3031]
btw - do we know the licence of View engine?
Kaj
23-Aug-2011
[3032x2]
No, that's the point
The new casting implementation has broken PeterPaint
Dockimbel
23-Aug-2011
[3034x3]
Ah, I was expecting some regressions...
I am working on some new type casting fixes, they might fix your 
issue. I am not sure I'll be able to release them today, probably 
tomorrow.
The following class of expressions is not emitting correct native 
code: A <op> B, where A is an integer! expression and B is byte! 
variable.
Kaj
23-Aug-2011
[3037]
It has also broken the cURL binding
Dockimbel
23-Aug-2011
[3038]
I tried to not break anything with this sensible commit, so I ensured 
that all current unit tests were passing as long as all my test apps 
(including Red's memory allocator). It would be useful to identify 
your regressions, so we can add new regression tests and avoid that 
in the future.
Kaj
23-Aug-2011
[3039]
I'll wait for your fixes. It's not useful to hunt for deep bugs that 
are already known
Dockimbel
23-Aug-2011
[3040]
Do you have runtime errors reported?
Kaj
23-Aug-2011
[3041]
No, I'm getting internal compiler errors during compilation, so I 
don't even know where they are in my source; and no pixels drawn 
in SDL
Dockimbel
23-Aug-2011
[3042]
Oh, those are easier to fix. :-)
Kaj
23-Aug-2011
[3043]
Not for me
Dockimbel
23-Aug-2011
[3044x2]
To locate internal compiler error, just run the compiler in verbose 
mode (like -v 5), and watch for "expr: " outputs, that should help 
you locate the part of your source causing that.
Usually, the last "expr: " output is enough to locate the error.
Kaj
23-Aug-2011
[3046]
Sorry, but I don't really have time to do such deep debugging
Dockimbel
23-Aug-2011
[3047x2]
The "expr: " outputs code from Red/System source, not compiler source.
At least, you'll know which expression in your Red/System app is 
causing the issue.
Kaj
23-Aug-2011
[3049]
I'll look into it when the errors are still there with your fixes
Dockimbel
23-Aug-2011
[3050]
You can also send me the source code, and I'll do the internal debugging, 
it is probably a minor error.