Re: How to make Application bundle from Executable? (Mac)

2015-02-20 Thread Gan via Digitalmars-d-learn
On Friday, 20 February 2015 at 17:28:48 UTC, Nicholas Wilson wrote: On Friday, 20 February 2015 at 06:19:29 UTC, Gan wrote: On Friday, 20 February 2015 at 06:10:51 UTC, Nicholas Wilson wrote: On Friday, 20 February 2015 at 03:26:47 UTC, Gan wrote: Also I can't get my application to load images

Re: How to make Application bundle from Executable? (Mac)

2015-02-19 Thread Gan via Digitalmars-d-learn
On Friday, 20 February 2015 at 06:10:51 UTC, Nicholas Wilson wrote: On Friday, 20 February 2015 at 03:26:47 UTC, Gan wrote: Also I can't get my application to load images that I place in the Resources folder(or any folder in the bundle for that matter). I suggest to have a look at the projects

How to make Application bundle from Executable? (Mac)

2015-02-19 Thread Gan via Digitalmars-d-learn
I managed to copy an application bundle and change stuff inside it to run my executable, but it was very manual and kinda hackish. Also I can't get my application to load images that I place in the Resources folder(or any folder in the bundle for that matter). Is there an official way to

Re: Better native D 2D graphics library?

2015-02-08 Thread Gan via Digitalmars-d-learn
On Sunday, 8 February 2015 at 09:52:50 UTC, Namespace wrote: On Sunday, 8 February 2015 at 01:39:19 UTC, Gan wrote: On Saturday, 7 February 2015 at 23:29:01 UTC, Namespace wrote: On Saturday, 7 February 2015 at 22:09:03 UTC, Gan wrote: Is there a better D graphics library in the works? I'm

Re: Better native D 2D graphics library?

2015-02-07 Thread Gan via Digitalmars-d-learn
On Saturday, 7 February 2015 at 23:29:01 UTC, Namespace wrote: On Saturday, 7 February 2015 at 22:09:03 UTC, Gan wrote: Is there a better D graphics library in the works? I'm using SFML(which is very easy and has lots of features) but it seems to use a lot of ram(if you leave it running for a

Better native D 2D graphics library?

2015-02-07 Thread Gan via Digitalmars-d-learn
Is there a better D graphics library in the works? I'm using SFML(which is very easy and has lots of features) but it seems to use a lot of ram(if you leave it running for a while on a graphic intensive scene) and trying to make it include the dependencies with the compiled executable is

ubyte array to uint?

2015-02-05 Thread Gan via Digitalmars-d-learn
Is there a simple way of conversion? Something like: uint length = to!uint(buffer[0 .. 4]); Right now I have: uint length = *cast(uint*)buffer[0 .. 4].ptr; Which I'm not entirely sure is the correct way to do that.

Re: Trying to make a TCP server, client connects and disconnects immediately

2015-02-05 Thread Gan via Digitalmars-d-learn
On Friday, 6 February 2015 at 01:36:17 UTC, Mike Parker wrote: On 2/6/2015 9:50 AM, Gan wrote: On Friday, 6 February 2015 at 00:35:12 UTC, Adam D. Ruppe wrote: On Friday, 6 February 2015 at 00:31:37 UTC, Gan wrote: Or am I misunderstanding the receive function? Does it send whole messages or

Trying to make a TCP server, client connects and disconnects immediately

2015-02-05 Thread Gan via Digitalmars-d-learn
I managed to get the client to connect but immediately on the server side, this happens: long length = player.playerSocket.receive(buf); if (length == 0) { //No longer connected player.playerSocket.shutdown(SocketShutdown.BOTH);

Re: Trying to make a TCP server, client connects and disconnects immediately

2015-02-05 Thread Gan via Digitalmars-d-learn
On Friday, 6 February 2015 at 00:24:54 UTC, Adam D. Ruppe wrote: On Friday, 6 February 2015 at 00:15:15 UTC, Gan wrote: ubyte[] buf = new ubyte[](0); This is your problem: receive fills a preexisting buffer, and you allocated zero bytes for it to fill, so it can't give you

Re: Trying to make a TCP server, client connects and disconnects immediately

2015-02-05 Thread Gan via Digitalmars-d-learn
On Friday, 6 February 2015 at 00:28:00 UTC, Gan wrote: On Friday, 6 February 2015 at 00:24:54 UTC, Adam D. Ruppe wrote: On Friday, 6 February 2015 at 00:15:15 UTC, Gan wrote: ubyte[] buf = new ubyte[](0); This is your problem: receive fills a preexisting buffer, and you

Re: Trying to make a TCP server, client connects and disconnects immediately

2015-02-05 Thread Gan via Digitalmars-d-learn
On Friday, 6 February 2015 at 00:35:12 UTC, Adam D. Ruppe wrote: On Friday, 6 February 2015 at 00:31:37 UTC, Gan wrote: Or am I misunderstanding the receive function? Does it send whole messages or just message chunks? It sends as much as it can when you call it. So if there's only 12 bytes

Concurrent Thread Safe List?

2015-02-04 Thread Gan via Digitalmars-d-learn
I'm looking for a non-blocking way of a thread pushing objects into a list and another thread able to pull objects from the same list. Thread 1 pushes objects onto the list, Thread 2 pulls the oldest objects off the list. Does D language have something like that?

Re: Concurrent Thread Safe List?

2015-02-04 Thread Gan via Digitalmars-d-learn
On Wednesday, 4 February 2015 at 22:14:31 UTC, Ali Çehreli wrote: On 02/04/2015 12:10 PM, Gan wrote: I'm looking for a non-blocking way of a thread pushing objects into a list and another thread able to pull objects from the same list. Thread 1 pushes objects onto the list, Thread 2 pulls the

Re: Concurrent Thread Safe List?

2015-02-04 Thread Gan via Digitalmars-d-learn
On Thursday, 5 February 2015 at 02:13:23 UTC, Gan wrote: On Wednesday, 4 February 2015 at 22:14:31 UTC, Ali Çehreli wrote: On 02/04/2015 12:10 PM, Gan wrote: I'm looking for a non-blocking way of a thread pushing objects into a list and another thread able to pull objects from the same list.

Re: I left my program open for 9 hours and it used up 700mb of ram, could someone review it?

2015-01-27 Thread Gan via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 15:45:47 UTC, bearophile wrote: Gan: How can I make it use less CPU/RAM? Most tiny classes probably should be structs. More generally, use a struct every time you don't need a class. You can start with those two: struct SBRange { double left = 0.0,

Re: I left my program open for 9 hours and it used up 700mb of ram, could someone review it?

2015-01-27 Thread Gan via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 19:26:12 UTC, bearophile wrote: Gan: Is there some special stuff I gotta do extra with structs? Do they need manually allocated and released? Most of your usages of tiny structs should be by value. So just keep in mind they are values. Even when you iterate

Re: I left my program open for 9 hours and it used up 700mb of ram, could someone review it?

2015-01-27 Thread Gan via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 19:59:08 UTC, Gan wrote: On Tuesday, 27 January 2015 at 19:26:12 UTC, bearophile wrote: Gan: Is there some special stuff I gotta do extra with structs? Do they need manually allocated and released? Most of your usages of tiny structs should be by value. So

Re: I left my program open for 9 hours and it used up 700mb of ram, could someone review it?

2015-01-27 Thread Gan via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 22:30:13 UTC, Gan wrote: On Tuesday, 27 January 2015 at 21:36:51 UTC, Rikki Cattermole wrote: On 28/01/2015 9:59 a.m., Gan wrote: On Tuesday, 27 January 2015 at 19:59:08 UTC, Gan wrote: On Tuesday, 27 January 2015 at 19:26:12 UTC, bearophile wrote: Gan: Is

Re: I left my program open for 9 hours and it used up 700mb of ram, could someone review it?

2015-01-27 Thread Gan via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 21:36:51 UTC, Rikki Cattermole wrote: On 28/01/2015 9:59 a.m., Gan wrote: On Tuesday, 27 January 2015 at 19:59:08 UTC, Gan wrote: On Tuesday, 27 January 2015 at 19:26:12 UTC, bearophile wrote: Gan: Is there some special stuff I gotta do extra with structs? Do

Re: I left my program open for 9 hours and it used up 700mb of ram, could someone review it?

2015-01-27 Thread Gan via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 22:42:25 UTC, Rikki Cattermole wrote: On 28/01/2015 11:39 a.m., Gan wrote: On Tuesday, 27 January 2015 at 22:30:13 UTC, Gan wrote: On Tuesday, 27 January 2015 at 21:36:51 UTC, Rikki Cattermole wrote: On 28/01/2015 9:59 a.m., Gan wrote: On Tuesday, 27 January

Re: I left my program open for 9 hours and it used up 700mb of ram, could someone review it?

2015-01-27 Thread Gan via Digitalmars-d-learn
On Wednesday, 28 January 2015 at 02:50:11 UTC, FG wrote: On 2015-01-28 at 03:04, Vladimir Panteleev wrote: What type is CircleShape? If it is a class, or otherwise contains pointers, then this is probably the source of your problem. class CircleShape : Shape is defined in

I left my program open for 9 hours and it used up 700mb of ram, could someone review it?

2015-01-27 Thread Gan via Digitalmars-d-learn
I feel like the only way I can get better right now is if someone with more knowledge can give me some advice on the code I have written. Here's the link: http://cl.ly/0s0Q1L1S3v0E How can I make it use less CPU/RAM? (Most code is in the Misc/SpaceBackground.d)

Re: Array List object?

2015-01-26 Thread Gan via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 06:16:03 UTC, H. S. Teoh wrote: On Tue, Jan 27, 2015 at 06:02:38AM +, Gan via Digitalmars-d-learn wrote: On Tuesday, 27 January 2015 at 06:00:50 UTC, Gan wrote: On Tuesday, 27 January 2015 at 05:32:09 UTC, Gan wrote: Hey I'm using normal arrays for my project

Re: Array List object?

2015-01-26 Thread Gan via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 05:32:09 UTC, Gan wrote: Hey I'm using normal arrays for my project: //Declaring the array SBTile[] tiles; //Initializing the array tiles = new SBTile[](0); //Clearing the array tiles = []; //Removing a tile at index i from the array tiles.remove(i); //Adding a

Re: Array List object?

2015-01-26 Thread Gan via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 06:00:50 UTC, Gan wrote: On Tuesday, 27 January 2015 at 05:32:09 UTC, Gan wrote: Hey I'm using normal arrays for my project: //Declaring the array SBTile[] tiles; //Initializing the array tiles = new SBTile[](0); //Clearing the array tiles = []; //Removing a

Re: Conflicts with Import error - New to D, trying to build a new project

2015-01-25 Thread Gan via Digitalmars-d-learn
Thanks. I didn't realize that could conflict. On Sunday, 25 January 2015 at 21:22:50 UTC, Ali Çehreli wrote: On 01/25/2015 11:30 AM, Gan wrote: Here's a screenshot: http://cl.ly/image/2n282v0B1X2M The error is: /Users/Matt/Projects/spacecraft/source/Game/Game.d(0,0): Error: class

Question about Allocating

2015-01-25 Thread Gan via Digitalmars-d-learn
I've been working on my game and am getting some pretty gnarly memory problems. I think it's how I'm allocating. Sometimes when I use variables I can do Color(255, 255, 255). But why is that different than new Color(255, 255, 255)? Same when I'm making arrays. new int[](0) vs []. What's the

Re: Turning Executable into Application?

2015-01-25 Thread Gan via Digitalmars-d-learn
On Monday, 26 January 2015 at 06:37:34 UTC, tcak wrote: On Monday, 26 January 2015 at 03:36:32 UTC, Gan wrote: With Xamarin Studio I create a D project and run it. It runs an Executable Unix file through the terminal. How can I turn that into an Application that doesn't open the Terminal?

Turning Executable into Application?

2015-01-25 Thread Gan via Digitalmars-d-learn
With Xamarin Studio I create a D project and run it. It runs an Executable Unix file through the terminal. How can I turn that into an Application that doesn't open the Terminal? Thanks.

Conflicts with Import error - New to D, trying to build a new project

2015-01-25 Thread Gan via Digitalmars-d-learn
Here's a screenshot: http://cl.ly/image/2n282v0B1X2M The error is: /Users/Matt/Projects/spacecraft/source/Game/Game.d(0,0): Error: class Game.Game.Game conflicts with import Game.Game.Game at source/Game/Game.d(2) (spacecraft) I figure it's because I did imports wrong or something. I'm