digitalmars.D.learn - Pixelbuffer to draw on a surface
- TheDGuy (3/3) Nov 30 2015 Hi,
- lobo (12/16) Nov 30 2015 Are any of these suitable for your needs?
Hi, is there any possibility, to draw with a pixelbuffer to a surface (for example with GTKD) and to update it every few milliseconds?
Nov 30 2015
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
Nov 30 2015
On Monday, 30 November 2015 at 09:09:00 UTC, lobo wrote:On Monday, 30 November 2015 at 08:37:04 UTC, TheDGuy wrote:Thanks for your answer, but there is no specific solution inside GTKD?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
Nov 30 2015
On 30.11.2015 15:49, TheDGuy wrote:On Monday, 30 November 2015 at 09:09:00 UTC, lobo wrote:As I know cairo is a part of GTK, so you consider using cairo as a specific solution.On Monday, 30 November 2015 at 08:37:04 UTC, TheDGuy wrote:Thanks for your answer, but there is no specific solution inside GTKD?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
Nov 30 2015
On 30.11.2015 16:09, drug wrote:On 30.11.2015 15:49, TheDGuy wrote:*you can considerOn Monday, 30 November 2015 at 09:09:00 UTC, lobo wrote:As I know cairo is a part of GTK, so you consider using cairo as a specific solution.On Monday, 30 November 2015 at 08:37:04 UTC, TheDGuy wrote:Thanks for your answer, but there is no specific solution inside GTKD?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
Nov 30 2015
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)
Nov 30 2015
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"?
Dec 04 2015
gtkd demos for examples, might be of interest, like clock : https://github.com/gtkd-developers/GtkD/blob/master/demos/cairo/cairo_clock/clock.d
Dec 06 2015
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.dThanks! I didn't knew about that source, that helped me alot :)
Dec 07 2015









drug <drug2004 bk.ru> 