Pixelbuffer to draw on a surface

2015-11-30 Thread TheDGuy via Digitalmars-d-learn

Hi,
is there any possibility, to draw with a pixelbuffer to a surface 
(for example with GTKD) and to update it every few milliseconds?


Re: Pixelbuffer to draw on a surface

2015-11-30 Thread lobo via Digitalmars-d-learn

On Monday, 30 November 2015 at 08:37:04 UTC, TheDGuy wrote:

Hi,
is there any possibility, to draw with a pixelbuffer to a 
surface (for example with GTKD) and to update it every few 
milliseconds?


Are any of these suitable for your needs?

https://github.com/DerelictOrg/DerelictSDL2
http://dgame-dev.de/

https://github.com/DerelictOrg/DerelictSFML2
https://github.com/DerelictOrg/DerelictAllegro5
http://api.gtkd.org/src/gdk/Cairo.html


I'm using DerelictSDL2 and Dgame for small 2D hobby games and 
loving it. Haven't used the others for D pixel rendering but I'm 
sure they're fine too.


bye,
lobo


Re: Pixelbuffer to draw on a surface

2015-11-30 Thread TheDGuy via Digitalmars-d-learn

On Monday, 30 November 2015 at 09:09:00 UTC, lobo wrote:

On Monday, 30 November 2015 at 08:37:04 UTC, TheDGuy wrote:

Hi,
is there any possibility, to draw with a pixelbuffer to a 
surface (for example with GTKD) and to update it every few 
milliseconds?


Are any of these suitable for your needs?

https://github.com/DerelictOrg/DerelictSDL2
http://dgame-dev.de/

https://github.com/DerelictOrg/DerelictSFML2
https://github.com/DerelictOrg/DerelictAllegro5
http://api.gtkd.org/src/gdk/Cairo.html


I'm using DerelictSDL2 and Dgame for small 2D hobby games and 
loving it. Haven't used the others for D pixel rendering but 
I'm sure they're fine too.


bye,
lobo

Thanks for your answer,
but there is no specific solution inside GTKD?



Re: Pixelbuffer to draw on a surface

2015-11-30 Thread drug via Digitalmars-d-learn

On 30.11.2015 16:09, drug wrote:

On 30.11.2015 15:49, TheDGuy wrote:

On Monday, 30 November 2015 at 09:09:00 UTC, lobo wrote:

On Monday, 30 November 2015 at 08:37:04 UTC, TheDGuy wrote:

Hi,
is there any possibility, to draw with a pixelbuffer to a surface
(for example with GTKD) and to update it every few milliseconds?


Are any of these suitable for your needs?

https://github.com/DerelictOrg/DerelictSDL2
http://dgame-dev.de/

https://github.com/DerelictOrg/DerelictSFML2
https://github.com/DerelictOrg/DerelictAllegro5
http://api.gtkd.org/src/gdk/Cairo.html


I'm using DerelictSDL2 and Dgame for small 2D hobby games and loving
it. Haven't used the others for D pixel rendering but I'm sure they're
fine too.

bye,
lobo

Thanks for your answer,
but there is no specific solution inside GTKD?


As I know cairo is a part of GTK, so you consider using cairo as a
specific solution.

*you can consider


Re: Pixelbuffer to draw on a surface

2015-11-30 Thread drug via Digitalmars-d-learn

On 30.11.2015 15:49, TheDGuy wrote:

On Monday, 30 November 2015 at 09:09:00 UTC, lobo wrote:

On Monday, 30 November 2015 at 08:37:04 UTC, TheDGuy wrote:

Hi,
is there any possibility, to draw with a pixelbuffer to a surface
(for example with GTKD) and to update it every few milliseconds?


Are any of these suitable for your needs?

https://github.com/DerelictOrg/DerelictSDL2
http://dgame-dev.de/

https://github.com/DerelictOrg/DerelictSFML2
https://github.com/DerelictOrg/DerelictAllegro5
http://api.gtkd.org/src/gdk/Cairo.html


I'm using DerelictSDL2 and Dgame for small 2D hobby games and loving
it. Haven't used the others for D pixel rendering but I'm sure they're
fine too.

bye,
lobo

Thanks for your answer,
but there is no specific solution inside GTKD?

As I know cairo is a part of GTK, so you consider using cairo as a 
specific solution.


Re: Pixelbuffer to draw on a surface

2015-11-30 Thread visitor via Digitalmars-d-learn

but there is no specific solution inside GTKD?


for example, in pseudo code

auto surf = new Surface(...); // look for cairo.Surface doc
auto cr = cairo.Context.Context.create(surf);

// pb is an existing gdkpixbuf.Pixbuf
gdk.Cairo.setSourcePixbuf(cr, pb, width, height);
cr.paint();

adding onDraw event listener on the widget owner of the Pixbuf 
(gtk.Image for example)


Re: Pixelbuffer to draw on a surface

2015-12-04 Thread TheDGuy via Digitalmars-d-learn
Thanks for your answers. I think Cairo is the right way but i 
have a hard time to translate any of those C++ or Python 
tutorials to D, my current code:


import gtk.Main;
import gtk.MainWindow;
import gtk.DrawingArea;
import gdk.Cairo;
import gtk.Widget;

void main(string[] args){
Main.init(args);
MainWindow win = new MainWindow("Tutorial");
win.setDefaultSize(250,250);

win.add(new MyArea());
win.showAll();
Main.run();
}

class MyArea : DrawingArea
{
this(){
}

bool on_draw(){

return true;
}
}

I tried to work with this Python tutorial (i think Python is 
easier to read than C++):

http://www.tortall.net/mu/wiki/PyGTKCairoTutorial

but if i try to do this: "cr = self.window.cairo_create()" i get:
"No property Window for type main.Area"?



Re: Pixelbuffer to draw on a surface

2015-12-06 Thread visitor via Digitalmars-d-learn

gtkd demos for examples, might be of interest, like clock :
https://github.com/gtkd-developers/GtkD/blob/master/demos/cairo/cairo_clock/clock.d






Re: Pixelbuffer to draw on a surface

2015-12-07 Thread TheDGuy via Digitalmars-d-learn

On Sunday, 6 December 2015 at 13:32:19 UTC, visitor wrote:

gtkd demos for examples, might be of interest, like clock :
https://github.com/gtkd-developers/GtkD/blob/master/demos/cairo/cairo_clock/clock.d


Thanks!
I didn't knew about that source, that helped me alot :)