Discuss Scratch

gtoal
Scratcher
1000+ posts

Are there scratch-like graphics facilities for C? Maybe Kurt-based?

Does anyone know of any system that lets you use a scratch-like GUI to create sprites etc, but then use those sprites from C with procedure calls analogous to the scratch primitives? I've done a lot (and I mean, a *lot*) of C programming in my life but it's mostly been text only and the few graphics programs I've had to write have been a hassle to construct - using Scratch's model for graphics, but accessing it from C, would be ideal for me.

By the way I have been very impressed by the ‘Kurt’ system for loading/saving Scratch projects to a text-based language. It would be excellent if it were taken just a smidgeon further so that you could write programs in that language and compile/build them with a command-line compiler and makefiles etc. What would be even cooler would be if one of the formats that Kurt wrote was C code with the scratch facilities available as C procedure calls as I was asking about above - that really would be the best of both worlds, especially since it would let you call your own proper C code analogously to using custom blocks in Scratch, except without the complexity that I'm sure it must currently take to call a C procedure from Scratch, if that is even possible!

(Another wish-list item for Kurt is a cut-down C to Scratch translator, for simple procedures and functions that don't require any facilities that Scratch doesn't offer, to make it easier to import things like mathematical procedures into Scratch programs)

Graham
drmcw
Scratcher
1000+ posts

Are there scratch-like graphics facilities for C? Maybe Kurt-based?

For C as with most languages you bind to a library so something like OpenGL would be what you're after but don't expect It to be like Scratch and Hassle free! After all that's pretty much the point of Scratch, making those nasty multimedia problems easy.
You may be interested in this http://scratch.mit.edu/discuss/topic/27690/

Something else to consider which would allow you to call C functions indirectly from Scratch would be http://wiki.scratch.mit.edu/wiki/Scratch_Extension

Last edited by drmcw (May 24, 2014 20:46:45)


10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
blob8108
Scratcher
1000+ posts

Are there scratch-like graphics facilities for C? Maybe Kurt-based?

I did actually start writing a C –> Scratch compiler, but mostly as a joke. To port C programs properly you really need dynamic memory allocation and a proper stack, so you're better off writing a CPU emulator (like the DCPU-16 emulator one user wrote in scratch) and compiling C for that.

Have you seen kurt.herokuapp.com/parser.sb ? I've been fiddling with a command-line tool that does the same thing. It sounds closest to what you're looking for (without the native C code stuff).

tosh · slowly becoming a grown-up adult and very confused about it
gtoal
Scratcher
1000+ posts

Are there scratch-like graphics facilities for C? Maybe Kurt-based?

blob8108 wrote:

I did actually start writing a C –> Scratch compiler, but mostly as a joke. To port C programs properly you really need dynamic memory allocation and a proper stack, so you're better off writing a CPU emulator (like the DCPU-16 emulator one user wrote in scratch) and compiling C for that.

Even so, I bet there's a lot of C code that would be worth importing, even if it's just at the level of ten or twenty lines worth of a procedure…

blob8108 wrote:

Have you seen kurt.herokuapp.com/parser.sb ? I've been fiddling with a command-line tool that does the same thing. It sounds closest to what you're looking for (without the native C code stuff).

I have seen it and I'm very impressed by the whole system you've put together. Even if a full bi-direction conversion to and from C is not practical, I'd still be interested in outputting C from Kurt, then maybe find some existing game-building system to bolt on to it to handle the sprites…

G
blob8108
Scratcher
1000+ posts

Are there scratch-like graphics facilities for C? Maybe Kurt-based?

gtoal wrote:

Even if a full bi-direction conversion to and from C is not practical, I'd still be interested in outputting C from Kurt, then maybe find some existing game-building system to bolt on to it to handle the sprites…
Eh, Scratch to C is even harder, because of how Scratch's threading works!

Last edited by blob8108 (May 26, 2014 11:12:58)


tosh · slowly becoming a grown-up adult and very confused about it
nXIII
Scratcher
1000+ posts

Are there scratch-like graphics facilities for C? Maybe Kurt-based?

blob8108 wrote:

Scratch to C
is almost exactly the same thing as Scratch to JavaScript, and we solved(ish) that problem already.

nXIII · GitHub
blob8108
Scratcher
1000+ posts

Are there scratch-like graphics facilities for C? Maybe Kurt-based?

nXIII wrote:

blob8108 wrote:

Scratch to C
is almost exactly the same thing as Scratch to JavaScript, and we solved(ish) that problem already.
Oh, sure.

But I thought gtoal wanted human-readable C / Javascript code, which phosphorus doesn't produce.

tosh · slowly becoming a grown-up adult and very confused about it
Hardmath123
Scratcher
1000+ posts

Are there scratch-like graphics facilities for C? Maybe Kurt-based?

blob8108 wrote:

I did actually start writing a C –> Scratch compiler, but mostly as a joke.

With the best name ever! scratc.h

Powered by DjangoBB