Re: GTKD - CSS class color "flash" delay

2016-06-30 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 30 June 2016 at 20:11:17 UTC, Mike Wey wrote: Is the complete source available some ware? Yes, here: http://pastebin.com/h0Nx1mL6

Re: GTKD - CSS class color "flash" delay

2016-06-30 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 10:41:21 UTC, TheDGuy wrote: I tried to debug a little and what i don't understand is, that i get two times 'blue' on the console, even though yellow and blue lit up but yellow stayed at the flash color: private void letButtonsFlash(){ foreach(Button

Re: GTKD - CSS class color "flash" delay

2016-06-29 Thread TheDGuy via Digitalmars-d-learn
On Sunday, 26 June 2016 at 21:06:58 UTC, TheDGuy wrote: Thanks for your answer, but as i said before, i want to flash each button on it's own (the game is kinda like 'Simon Says'). I tried to debug a little and what i don't understand is, that i get two times 'blue' on the console, even

Re: GTKD - CSS class color "flash" delay

2016-06-26 Thread TheDGuy via Digitalmars-d-learn
On Sunday, 26 June 2016 at 16:29:52 UTC, Mike Wey wrote: How about this: private void letButtonsFlash(){ foreach(Button btn;bArr){ btn.setSensitive(false); } for(int i = 0; i < level; i++){ Button currentButton = bArr[rndButtonBlink[i]]; ListG list =

Re: GTKD - CSS class color "flash" delay

2016-06-26 Thread TheDGuy via Digitalmars-d-learn
On Sunday, 26 June 2016 at 12:30:22 UTC, Mike Wey wrote: You should probably increment the index in the timeout_delay function. This leads to a Range violation exception...

Re: GTKD - CSS class color "flash" delay

2016-06-25 Thread TheDGuy via Digitalmars-d-learn
On Saturday, 25 June 2016 at 21:57:35 UTC, TheDGuy wrote: But i want to flash (e.g. change the CSS class) the buttons one by one and not all at the sime time? How am i going to do that? Okay, i tried it with a new private int-variable which contains the current index of the for-loop, like

Re: GTKD - CSS class color "flash" delay

2016-06-25 Thread TheDGuy via Digitalmars-d-learn
On Saturday, 25 June 2016 at 20:39:53 UTC, Mike Wey wrote: The constructor accepts an delegate, witch can access it's context so it has access to some of the data. The functions from GTK are also available like Timeout.add from the linked tutorial:

Re: GTKD - CSS class color "flash" delay

2016-06-25 Thread TheDGuy via Digitalmars-d-learn
On Saturday, 25 June 2016 at 15:26:00 UTC, TheDGuy wrote: } But i get the error: Error: none of the overloads of '__ctor' are callable using argument types (bool delegate(void* userData), int, bool), candidates are: This is the correct error message: Error: none of the overloads of '__ctor'

Re: GTKD - CSS class color "flash" delay

2016-06-25 Thread TheDGuy via Digitalmars-d-learn
On Saturday, 25 June 2016 at 13:01:09 UTC, TheDGuy wrote: Thanks for your answer. I have to pass the Button object to my timeout function to change the CSS class. But how do i do that within the Timeout constructor? I mean: I have to pass my function and delay time to the constructor, but

Re: GTKD - CSS class color "flash" delay

2016-06-25 Thread TheDGuy via Digitalmars-d-learn
On Saturday, 25 June 2016 at 11:45:40 UTC, Mike Wey wrote: You should change the css class in the timeout_delay function. It's called by the GTK main loop every time the amount of seconds passed to the constructor has passed. And return true if you want to continue to flash the button, and

Re: GTKD - CSS class color "flash" delay

2016-06-24 Thread TheDGuy via Digitalmars-d-learn
On Friday, 24 June 2016 at 16:44:59 UTC, Gerald wrote: Other then the obvious multi-threaded, using glib.Timeout to trigger the reversion of the color change could be an option. http://api.gtkd.org/src/glib/Timeout.html Thanks! I tried this so far: private void letButtonsFlash(){

GTKD - CSS class color "flash" delay

2016-06-24 Thread TheDGuy via Digitalmars-d-learn
Hello, i would like to flash some buttons with CSS. My current approach: for(int i = 0; i < level; i++){ Button currentButton = bArr[rndButtonBlink[i]]; ListG list = currentButton.getStyleContext().listClasses(); string CSSClassName =

Re: GTKD - addOnButtonPress faulty?

2016-06-24 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 23 June 2016 at 22:00:18 UTC, Mike Wey wrote: addOnPressed is deprecated addOnButtonPress is not. Ah, okay. I changed the event type to addOnButtonRelease and it works fine now, i don't know if it's just me or if addOnButtonPress behaves a little bit strange.

GTKD - addOnButtonPress faulty?

2016-06-23 Thread TheDGuy via Digitalmars-d-learn
Hi, sorry for my next thread but i did encounter a strange behaviour of the "Button.addOnButtnPress" - Event. Sometimes if i click very fast on the GTKD button, it reacts twice! I am working on a small game and i noticed that if i click slowly everything works as expected but sometimes i

Get specific item by index from DList

2016-06-22 Thread TheDGuy via Digitalmars-d-learn
Hi, i am currently programming a small game with GTKD and i have to use a Dlist because an array is static but i want to add user inputs dynamically to a list. Now i am wondering how i can get a specific item from that list? I read that this isn't possible but is it possible to convert that

Re: GTKD - get CSS class for button

2016-06-22 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 22 June 2016 at 17:50:53 UTC, Mike Wey wrote: "Type T wraps should match the type of the data" Does string match the type of the data? What is the type of the data? How do i tell the function that i want the Array as a string array? I am not familiar with Types and what 'TC' or

Re: GTKD - get CSS class for button

2016-06-22 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 22 June 2016 at 13:47:01 UTC, Gerald wrote: On Wednesday, 22 June 2016 at 12:57:51 UTC, TheDGuy wrote: widget.getStyleContext().listClasses() to get a list of all classes assigned to the widget. If you just want to see if a specific class is assigned to the widget you can use

Re: GTKD - get CSS class for button

2016-06-22 Thread TheDGuy via Digitalmars-d-learn
widget.getStyleContext().listClasses() to get a list of all classes assigned to the widget. If you just want to see if a specific class is assigned to the widget you can use widget.getStyleContext().hasClass() Thanks a lot for your answer. Do you know how i can get the first classname as

Re: Access vialotion

2016-06-22 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 22 June 2016 at 12:45:29 UTC, TheDGuy wrote: I have an array of buttons: class Window : MainWindow{ private Button[4] bArr; this(){ Button btn_1 = new Button(); Button btn_2 = new Button(); Button btn_3 = new Button(); Button btn_4 = new

Access vialotion

2016-06-22 Thread TheDGuy via Digitalmars-d-learn
I have an array of buttons: class Window : MainWindow{ private Button[4] bArr; this(){ Button btn_1 = new Button(); Button btn_2 = new Button(); Button btn_3 = new Button(); Button btn_4 = new Button(); Button[4] bArr = [btn_1,btn_2,btn_3,btn_4];

GTKD - get CSS class for button

2016-06-22 Thread TheDGuy via Digitalmars-d-learn
Hello, i would like to know if it possible to get the CSS-class which is asigned to a button (for example)? I didn't find any documentation about this, just the function "getStyleContext().getProperty()", my current attempt: Value value;

Re: GTKD - overrideBackgroundColor of Button doesn't work

2016-06-22 Thread TheDGuy via Digitalmars-d-learn
I am wondering if it is possible to get the name of the current CSS-class the button is asigned to?

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-17 Thread TheDGuy via Digitalmars-d-learn
On Friday, 17 June 2016 at 06:18:59 UTC, Basile B. wrote: On Thursday, 16 June 2016 at 09:18:54 UTC, TheDGuy wrote: On Thursday, 16 June 2016 at 08:20:00 UTC, Basile B. wrote: Yes it's "WorkingDirectory" (and not current...). But otherwise you can use args[0]. Actually using the cwd in a

Re: GTKD - overrideBackgroundColor of Button doesn't work

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 16 June 2016 at 13:12:12 UTC, Gerald wrote: It can be done fine with on the fly changes, i.e. random colors, it's somewhat more work then just calling a simple function call but CSS gives you a lot more power as well. I do this in Terminix where for certain themes I want to set

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 16 June 2016 at 17:44:08 UTC, Basile B. wrote: Please Stop your comedy. Thanks a lot for your help! This is my solution: import gtk.Main; import gtk.MainWindow; import gtk.CssProvider; import gtk.Button; import gdk.Display; import gdk.Screen; import gtk.StyleContext; import

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 16 June 2016 at 10:14:47 UTC, Basile B. wrote: from args[0] you can get the base bath and since your css is relative to the base path: string cssPath = "test.css"; CssProvider provider = new CssProvider(); provider.loadFromPath(cssPath); add something like

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 16 June 2016 at 09:27:38 UTC, Basile B. wrote: FOrget any previous comment and in your program use the first argument of the command line to detect your resources, this will solve your problem. For the execution click compile and run or just run. Okay: void main(string[] args){

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 16 June 2016 at 08:20:00 UTC, Basile B. wrote: Yes it's "WorkingDirectory" (and not current...). But otherwise you can use args[0]. Actually using the cwd in a program is often an error because there is no guarantee that the cwd is the path to the application ;) People often

Re: GTKD - overrideBackgroundColor of Button doesn't work

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 22:34:05 UTC, Gerald wrote: snip... The text color is green but the button background color is still default-gray! I don't see an obvious issue with your code, I usually use CSS classes personally and I know that works fine because I use this technique all

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 16 June 2016 at 00:46:44 UTC, Basile B. wrote: On Wednesday, 15 June 2016 at 23:41:51 UTC, Basile B. wrote: - You can create a launcher in the custom tools, excluding the double quote: - as executable type "" - as CurrentDirectory type "" - as alias put something

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 16 June 2016 at 07:50:13 UTC, TheDGuy wrote: I get 'Failed to execute: 267'. Probably because a symbolic string is used in the run options? https://picload.org/upload,8e3f683557a8cd3401f002304f387932.html That is the correct image link:

Re: GTKD - overrideBackgroundColor of Button doesn't work

2016-06-15 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 20:49:02 UTC, Gerald wrote: On Wednesday, 15 June 2016 at 09:03:45 UTC, TheDGuy wrote: Hello, why does this code not work? RGBA rgb = new RGBA(1,0.5,0.5,1.0); Button btn_1 = new Button("Start");

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-15 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 13:15:56 UTC, Rene Zwanenburg wrote: I'm not familiar with Coedit, but the run options seem to contain a field for setting it: https://github.com/BBasile/Coedit/wiki#run-options You may be able to use the symbolic strings there:

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-15 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 10:21:20 UTC, Rene Zwanenburg wrote: On Wednesday, 15 June 2016 at 09:48:19 UTC, TheDGuy wrote: But if i execute the app my hand (in the windows command window or my double click) it works as expected (so no error)? Why is that? My first guess would be that

GTKD - Application crashes - or not? [Coedit]

2016-06-15 Thread TheDGuy via Digitalmars-d-learn
Hi, this is my app: import gtk.Main; import gtk.MainWindow; import gtk.CssProvider; import gdk.Display; import gdk.Screen; import gtk.StyleContext; import glib.GException; class Window : MainWindow{ this(int width, int height, string title){ super(title);

GTKD - overrideBackgroundColor of Button doesn't work

2016-06-15 Thread TheDGuy via Digitalmars-d-learn
Hello, why does this code not work? RGBA rgb = new RGBA(1,0.5,0.5,1.0); Button btn_1 = new Button("Start"); btn_1.overrideBackgroundColor(StateFlags.NORMAL, rgb); The color of btn_1 just doesn't change.

Re: GTKD - Attach Button to Grid in specific column and row

2016-06-14 Thread TheDGuy via Digitalmars-d-learn
On Saturday, 11 June 2016 at 21:14:43 UTC, Mike Wey wrote: The way GTK manages width and height, usually widgets are given the minimum size they need. So when the button is the only widget in the grid the other rows and columns have a height/width of 0. You can force the button / gird cell

GTKD - Attach Button to Grid in specific column and row

2016-06-11 Thread TheDGuy via Digitalmars-d-learn
Hi, i am wondering why this code doesn't work, even though i set the column and row position of the button it is always placed at the top left (so basically first row and first column): this(int width, int height, string title){ super(title); setDefaultSize(width,height);

Re: How to cast ASCII value to char?

2016-06-10 Thread TheDGuy via Digitalmars-d-learn
On Friday, 10 June 2016 at 14:27:41 UTC, Seb wrote: On Friday, 10 June 2016 at 14:20:16 UTC, TheDGuy wrote: Is it possible to cast an ascii value to char? Sure! char A = cast(char) 65; // A char a = cast(char) 97; // a and back again: ubyte b = cast(ubyte) a; // 65 In general there's also

Re: How to cast ASCII value to char?

2016-06-10 Thread TheDGuy via Digitalmars-d-learn
On Friday, 10 June 2016 at 14:20:16 UTC, TheDGuy wrote: Is it possible to cast an ascii value to char? Yea, basically just like that: cast(char) *sorry*

How to cast ASCII value to char?

2016-06-10 Thread TheDGuy via Digitalmars-d-learn
Is it possible to cast an ascii value to char?

Re: Easier way to add libraries to visual d?

2016-06-07 Thread TheDGuy via Digitalmars-d-learn
On Friday, 3 June 2016 at 16:20:53 UTC, TheDGuy wrote: On Thursday, 26 May 2016 at 17:06:03 UTC, Basile B. wrote: colorize works. You meant "serial-port" ? Does Coedit have the possibility to debug? Yes / No?

Re: Easier way to add libraries to visual d?

2016-06-03 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 26 May 2016 at 17:06:03 UTC, Basile B. wrote: colorize works. You meant "serial-port" ? Does Coedit have the possibility to debug?

Read registry keys recursively

2016-05-29 Thread TheDGuy via Digitalmars-d-learn
Hello, i am wondering what is wrong with my code: import std.windows.registry; import std.stdio; void main(){ Key lclM = Registry.localMachine(); Key hrdw = lclM.getKey("HARDWARE"); writeRegistryKeys(hrdw); } void writeRegistryKeys(Key k){ foreach(Key key; k.keys){

Re: Easier way to add libraries to visual d?

2016-05-28 Thread TheDGuy via Digitalmars-d-learn
On Saturday, 28 May 2016 at 15:29:36 UTC, TheDGuy wrote: Thanks a lot for the fast hot fix, now everything works fine! :) Great IDE! Do you mind implementing an option to reset the layout to default? Because i think i messed up and no i don't know how i can get the file view for the

Re: Easier way to add libraries to visual d?

2016-05-28 Thread TheDGuy via Digitalmars-d-learn
On Saturday, 28 May 2016 at 13:25:14 UTC, Basile B. wrote: I've released a hot fix yesterday and now it works with latest DUB tag (0.9.25). But registering from the project that's loaded was already working yesterday. I think that you have forgotten to choose the right configuration to

Re: Easier way to add libraries to visual d?

2016-05-27 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 26 May 2016 at 22:15:17 UTC, Basile B. wrote: gfm doesn't yield a .lib because of this: https://github.com/d-gamedev-team/gfm/blob/master/dub.json#L22 it should be "library" or staticLibrary or "sourceLibrary" thus it can't be registered. Bad luck here you've chosen the wrong

Re: Easier way to add libraries to visual d?

2016-05-26 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 26 May 2016 at 20:25:43 UTC, Basile B. wrote: But the procedure I described is very easy. you just have to clone, compile and click a button in the library manager. It's even better because you can choose which version to compile by "git checkout vx.x.x" while using the "DUB

Re: Easier way to add libraries to visual d?

2016-05-26 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 26 May 2016 at 17:25:25 UTC, Basile B. wrote: I'm on Windows now. I'm sorry but both packages were setup successfully. What you can do is the other way: - clone the git repos. - open the DUB json as project. - choose the right config in the inspector. - compile. - while the

Re: Easier way to add libraries to visual d?

2016-05-26 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 26 May 2016 at 17:06:03 UTC, Basile B. wrote: colorize works. You meant "serial-port" ? Well, i get the same message for both packages...Even though it creates a new folder with all the files in AppData\Roaming\dub\packages

Re: Easier way to add libraries to visual d?

2016-05-26 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 26 May 2016 at 16:53:42 UTC, Basile B. wrote: - Registering a dub package from online is in the "library manager" - The DUB project editor is a widget that's not docked by default, see in the menu "Windows", the item "Dub project editor". The Native project configuration and

Re: Easier way to add libraries to visual d?

2016-05-26 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 26 May 2016 at 17:02:06 UTC, TheDGuy wrote: Thanks, now i found it. If i try to add for example 'colorize' as a package i get: Fetching serial-port ~master... Placing serial-port ~master to C:\Users\luc\AppData\Roaming\dub\packages\... Neither a package description file, nor

Re: Easier way to add libraries to visual d?

2016-05-26 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 26 May 2016 at 16:01:22 UTC, Basile B. wrote: To register a DUB package, you can either fetch (DUB icon) or clone the repo, open the DUB JSON project, compile the right config, then in the libman there's a icon with a gray chain over a book. Click this icon and the library is

Re: Easier way to add libraries to visual d?

2016-05-26 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 26 May 2016 at 15:21:40 UTC, Basile B. wrote: Use Coedit: the widget "library manager" allow to register libraries in a single click and then they are usable on the fly, in the projects or in a runnable modules, without specifying anything (except a (*) in a project setting

Easier way to add libraries to visual d?

2016-05-26 Thread TheDGuy via Digitalmars-d-learn
Hi, i use Visual D as a plugin for visual studio to create D applications. But what bothers me a bit is that i have to tell visual D the exact link to the .lib file for every lib i want to use in the project (!). So these are the steps i have to make to get an external lib working: 1.

Re: Use Requests to send data to webpage - how?

2016-05-22 Thread TheDGuy via Digitalmars-d-learn
On Friday, 20 May 2016 at 14:42:19 UTC, TheDGuy wrote: On Friday, 20 May 2016 at 09:21:33 UTC, Kagamin wrote: Does this work? Request rq = Request(); Response rs = rq.exec!"GET"("http://somewebpage.org/;, [parameter:data]); No :( If i call my SQL.php function directly with: Response rs =

Re: Use Requests to send data to webpage - how?

2016-05-20 Thread TheDGuy via Digitalmars-d-learn
On Friday, 20 May 2016 at 09:21:33 UTC, Kagamin wrote: Does this work? Request rq = Request(); Response rs = rq.exec!"GET"("http://somewebpage.org/;, [parameter:data]); No :(

Use Requests to send data to webpage - how?

2016-05-19 Thread TheDGuy via Digitalmars-d-learn
Hi, i was sucessfull in installing requests and getting data from a webpage like this: Request rq = Request(); Response rs = rq.exec!"GET"("http://somewebpage.org/SQL.php;, ["action":"getTemp"]); But i am not able to send data to the webpage like this: Request rq = Request(); Response rs =

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-18 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 18 May 2016 at 19:49:04 UTC, Edwin van Leeuwen wrote: That does mention Windows as supported. It is quite old though, the latest github activity is from a year ago. Got it working, thanks a lot!

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-18 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 18 May 2016 at 20:41:13 UTC, TheDGuy wrote: C:\Users\Standardbenutzer\Downloads\DUB>dub build Fetching serial-port 1.1.0 (getting selected version)... Placing serial-port 1.1.0 to C:\Users\Standardbenutzer\AppData\Roaming\dub\packages\... Performing "debug" build using dmd for

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-18 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 18 May 2016 at 19:49:04 UTC, Edwin van Leeuwen wrote: The onyx README seems to suggest it only works for POSIX. Did you try serial-port by any chance: http://code.dlang.org/packages/serial-port That does mention Windows as supported. It is quite old though, the latest github

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-18 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 18 May 2016 at 16:13:35 UTC, Seb wrote: May I ask why you need to get tango working? It has been deprecated a long time ago and phobos (the standard library) or alternatively other packages on dub have a look of features :) Okay, it looks like 'onyx' is a library which handles

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-18 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 18 May 2016 at 16:13:35 UTC, Seb wrote: On Wednesday, 18 May 2016 at 14:59:52 UTC, TheDGuy wrote: On Wednesday, 18 May 2016 at 14:19:48 UTC, Jacob Carlborg wrote: [1] https://github.com/SiegeLord/Tango-D2/blob/d2port/dub.json#L32 How can i get that line working? May I ask why

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-18 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 18 May 2016 at 14:19:48 UTC, Jacob Carlborg wrote: [1] https://github.com/SiegeLord/Tango-D2/blob/d2port/dub.json#L32 How can i get that line working?

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-18 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 18 May 2016 at 14:19:48 UTC, Jacob Carlborg wrote: Everything in tango/stdc/posix should be ignored when compiling on Windows. Seems like this line isn't working [1], fore some reason. So what should i do? Delete the file?

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-18 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 18 May 2016 at 12:25:47 UTC, John Colvin wrote: http://code.dlang.org/download Okay, now i get this: Performing "debug" build using dmd for x86. tango ~master: building configuration "static"... tango\sys\win32\WsaSock.d(31,14): Warning: instead of C-style syntax, use D-style

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-18 Thread TheDGuy via Digitalmars-d-learn
Oh it looks like Dub is a program i have to install ^^

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-18 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 18 May 2016 at 03:15:25 UTC, Mike Parker wrote: That should get your library. Thanks for your answer. I tried that on my windows console and i got the error that the command 'dub' can't be found. If i try: 'dub.json build' it just opens the dub.json file in my default .json

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-17 Thread TheDGuy via Digitalmars-d-learn
Okay i now have several ".obj" files in "Tango-D2-d2port\build\bin\win32" but how can i merge them to a library? Anyone here who knows that?

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-17 Thread TheDGuy via Digitalmars-d-learn
Okay i now got a step further. If i type: bob -vu C:\Users\Standardbenutzer\Downloads\Tango-D2-d2port a huge list of files comes down such as: dmd -c -IC:\Users\Standardbenutzer\Downloads\Tango-D2-d2port -release -ofngo-core-Array-release.obj

Compile Tango for DMD2 - Any instructions how to do it?

2016-05-17 Thread TheDGuy via Digitalmars-d-learn
Hi, i am wondering if there are any instructions how to build tango with dmd2 on windows? I mean, if i take a look at this: http://dsource.org/projects/tango/wiki/WindowsInstall "Automated Build and Install This section is out of date. Is there an installer at all? Manually Build and

Re: GTKD - Write Pixbuf back to context

2016-01-08 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 7 January 2016 at 21:35:40 UTC, Gerald wrote: https://developer.gnome.org/gtkmm-tutorial/stable/sec-draw-images.html.en Does this work for you? Yes, thank you very much! cr.paint();

GTKD - Write Pixbuf back to context

2016-01-07 Thread TheDGuy via Digitalmars-d-learn
Hello, after i found out how i can access the pixel data in this thread: http://forum.dlang.org/thread/ljktabqxzdjprrqca...@forum.dlang.org i want to know how i can write the Pixbuf back to my context? This code doesn't work because the color does not change: cr.setSourceRgb(0,0,0);

Re: GTKD Cairo get pixel color

2016-01-05 Thread TheDGuy via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 16:43:00 UTC, Basile B. wrote: On Tuesday, 5 January 2016 at 16:25:01 UTC, TheDGuy wrote: But how do i know which line or column my pixel is in? - study D operator overloading, I've given you the solution. And what is 't' in 'opIndexAssign'? - t is what you want

Re: GTKD Cairo get pixel color

2016-01-05 Thread TheDGuy via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 16:16:39 UTC, Basile B. wrote: On Tuesday, 5 January 2016 at 15:04:57 UTC, TheDGuy wrote: But i get "only one index allowed to index char". So it looks like there is no 2D array but just a char. If i try like this: The data is just a contiguous memory area. You

Re: GTKD Cairo get pixel color

2016-01-05 Thread TheDGuy via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 17:34:06 UTC, Basile B. wrote: On Tuesday, 5 January 2016 at 17:16:10 UTC, TheDGuy wrote: On Tuesday, 5 January 2016 at 16:43:00 UTC, Basile B. wrote: [...] Okay, but what is this? "import iz.memory, iz.streams, iz.properties;" I dont' understand what

Re: GTKD Cairo get pixel color

2016-01-05 Thread TheDGuy via Digitalmars-d-learn
On Monday, 4 January 2016 at 23:47:05 UTC, Basile B. wrote: On Friday, 1 January 2016 at 22:00:04 UTC, TheDGuy wrote: On Friday, 1 January 2016 at 19:32:40 UTC, Basile B. wrote: On Wednesday, 30 December 2015 at 23:20:23 UTC, Basile B. wrote: On Wednesday, 30 December 2015 at 20:44:44 UTC,

Re: GTKD Cairo get pixel color

2016-01-05 Thread TheDGuy via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 22:02:33 UTC, Mike Wey wrote: On 01/04/2016 11:08 PM, TheDGuy wrote: On Monday, 4 January 2016 at 21:42:16 UTC, Mike Wey wrote: [...] Ups, that was my fault, sry :( But how do i get now the color for each pixel out of the ubyte[]? It looks like the array has

Re: GTKD Cairo get pixel color

2016-01-04 Thread TheDGuy via Digitalmars-d-learn
On Monday, 4 January 2016 at 19:27:48 UTC, Mike Wey wrote: I think you are looking for something like this. Context.getTarget will get you the surface the Context is drawing to, this most likely isn't a ImageSurface. So you will need to create an pixbuf from the returned surface, with the

Re: GTKD Cairo get pixel color

2016-01-04 Thread TheDGuy via Digitalmars-d-learn
On Monday, 4 January 2016 at 21:42:16 UTC, Mike Wey wrote: On 01/04/2016 09:13 PM, TheDGuy wrote: [...] I don't have any issues with either getPixelsWithLength and savev. for the savev call there is an missing \ just before test.jpg, but that might be a copy and paste error? For the

Threading to prevent GUI Freeze

2016-01-04 Thread TheDGuy via Digitalmars-d-learn
Hello, i use GTKD to draw some stuff on a DrawingArea. Because it needs some time to calculate i want to outsource those calculation so that the GUI doesn't freeze. I tried it with "std.concurrency" like this: bool drawCallback(Scoped!Context cr, Widget widget){ writeln("init");

Re: Threading to prevent GUI Freeze

2016-01-04 Thread TheDGuy via Digitalmars-d-learn
On Monday, 4 January 2016 at 15:07:12 UTC, Luis wrote: On Monday, 4 January 2016 at 14:31:04 UTC, TheDGuy wrote: [...] Before doing anything with threads and GTK, you should read this : http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/gtk-thread-awareness Okay, so i

Re: Threading to prevent GUI Freeze

2016-01-04 Thread TheDGuy via Digitalmars-d-learn
I wrote a demo for GtkD showing how multi-threading and D work together, it's in the demos/gtkD/DemoMultithread folder of GtkD, hopefully it will be helpful. However this example it is based on using the GTk threadIdle callback which is generally preferred over the locking methods you show

Re: Threading to prevent GUI Freeze

2016-01-04 Thread TheDGuy via Digitalmars-d-learn
On Monday, 4 January 2016 at 17:33:28 UTC, Gerald wrote: On Monday, 4 January 2016 at 16:13:50 UTC, TheDGuy wrote: [...] Yes, you need it. The extern (C) function is what GDK invokes on idle. In any GUI application there is a lot of idle time waiting for events, what the addThreadIdle

Re: Call C function - Access violation

2016-01-03 Thread TheDGuy via Digitalmars-d-learn
On Sunday, 3 January 2016 at 21:20:35 UTC, anonymous wrote: On 03.01.2016 21:32, TheDGuy wrote: If i type: gcc -c -otest.c.o the 'test.c.o' file is generated but if i type: dmd main.d test.c.o i get: 'Error: unrecognized file extension o'? You're probably on Windows then? dmd doesn't

Re: Call C function - Access violation

2016-01-03 Thread TheDGuy via Digitalmars-d-learn
Use an import. import std.string; import std.conv; void main(string[] args) { auto value = toStringz("Hello World"); auto result = write(value); auto s = to!(string)(result); writeln(s); } Also all string literals in D are zero terminated so you could write the call

Call C function - Access violation

2016-01-03 Thread TheDGuy via Digitalmars-d-learn
I get an access violation with this code: extern(C) char* write(char* text); void main(string[] args){ char[] text = "Hello World".dup; //.dup converts string to char[] text ~= '\0'; //append char* result = write(text.ptr); //you need .ptr const(char)[] s =

Re: Call C function - Access violation

2016-01-03 Thread TheDGuy via Digitalmars-d-learn
Works for me after adding the needed imports and removing the wrong include from the C file. Is this really the actual code you're running? Doesn't your C compiler reject that include? gcc does. Okay, i think this C code should work (checked with cpp.sh): #import char* write(char* text){

Re: Call C function - Access violation

2016-01-03 Thread TheDGuy via Digitalmars-d-learn
On Sunday, 3 January 2016 at 13:25:04 UTC, Gary Willoughby wrote: On Sunday, 3 January 2016 at 13:23:25 UTC, Gary Willoughby wrote: I think I've noticed one problem with the code above. You are using `text.ptr`. You shouldn't do that because you are passing a pointer not an array. Just use

Re: GTKD Cairo get pixel color

2016-01-02 Thread TheDGuy via Digitalmars-d-learn
``` import cairo.ImageSurface; ImageSurface.createForData(c,cairo.FORMAT_ARGB32,256,256,256*4); ``` You need to import the ImageSurface module, and the createForData function is in the ImageSurface class which is in the cairo.ImageSurface module. Thanks, that was the problem! Now i can read

Re: GTKD Cairo get pixel color

2016-01-01 Thread TheDGuy via Digitalmars-d-learn
On Friday, 1 January 2016 at 22:00:04 UTC, TheDGuy wrote: On Friday, 1 January 2016 at 19:32:40 UTC, Basile B. wrote: On Wednesday, 30 December 2015 at 23:20:23 UTC, Basile B. wrote: On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy wrote: Hello, is there any way to get the pixel color

Re: GTKD Cairo get pixel color

2016-01-01 Thread TheDGuy via Digitalmars-d-learn
On Friday, 1 January 2016 at 19:32:40 UTC, Basile B. wrote: On Wednesday, 30 December 2015 at 23:20:23 UTC, Basile B. wrote: On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy wrote: Hello, is there any way to get the pixel color of a single pixel by x and y coordinates of a context?

Why does this not work?

2016-01-01 Thread TheDGuy via Digitalmars-d-learn
writeln("Which number should i guess?"); string input = readln(); int i = to!int(input);

Re: Why does this not work?

2016-01-01 Thread TheDGuy via Digitalmars-d-learn
On Friday, 1 January 2016 at 14:29:34 UTC, Tobi G. wrote: On Friday, 1 January 2016 at 14:20:26 UTC, Tobi G. wrote: The solution is that readln() returns a string that also contains the newline this can be solved by easily stripping the newline off import std.string; int i =

Re: GTKD Cairo get pixel color

2016-01-01 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 30 December 2015 at 23:20:23 UTC, Basile B. wrote: On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy wrote: Hello, is there any way to get the pixel color of a single pixel by x and y coordinates of a context? render to a png back buffer. see

Re: GTKD Cairo get pixel color

2016-01-01 Thread TheDGuy via Digitalmars-d-learn
On Friday, 1 January 2016 at 15:22:18 UTC, Mike Wey wrote: On 01/01/2016 01:37 PM, TheDGuy wrote: [...] you would either cr.getTarget(); or cairo.ImageSurface.ImageSurface.create. I'm not sure how those would get you access to the pixel data. Okay, thanks for your answer. So which

Re: Why does this not work?

2016-01-01 Thread TheDGuy via Digitalmars-d-learn
On Friday, 1 January 2016 at 15:16:36 UTC, Adam D. Ruppe wrote: On Friday, 1 January 2016 at 15:06:53 UTC, bachmeier wrote: I've battled with a few times, not having any idea what was going on. I now almost automatically use strip when it's not working. This is one of the most frequently

GTKD Cairo get pixel color

2015-12-30 Thread TheDGuy via Digitalmars-d-learn
Hello, is there any way to get the pixel color of a single pixel by x and y coordinates of a context?

Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread TheDGuy via Digitalmars-d-learn
Get used to it :) Unfortunately, DMD is not emitting the best debug information. The program flow is correct, but the line info is not, that's why the execution step will not be triggered in the real location of the source code. The simplest example is this: import std.stdio; void foo(int

Re: Variable below zero but if statement doesn't grab?

2015-12-27 Thread TheDGuy via Digitalmars-d-learn
On Sunday, 27 December 2015 at 16:39:18 UTC, SimonN wrote: On Sunday, 27 December 2015 at 16:01:37 UTC, TheDGuy wrote: Sry: if((x1 < 0) & (x2 >= 0)){ This looks like a bug, with & instead of &&. -- Simon It looks like the debugger is not working correctly because i

  1   2   >