Re: Align object to vector using Dgame framework

2015-07-13 Thread codenstuff via Digitalmars-d-learn
On Monday, 13 July 2015 at 19:07:55 UTC, Márcio Martins wrote: On Monday, 13 July 2015 at 16:11:03 UTC, codenstuff wrote: [...] This is not really a game development forum but here you go: auto rads = atan2(object.velocity.y, object.velocity.x); // returns radians auto degs = angle * (180.0f

Align object to vector using Dgame framework

2015-07-13 Thread codenstuff via Digitalmars-d-learn
I've been using Dgame framework for simple simulations. I need moving object to be aligned to their velocity vectors. How is it possible to do that using Dgame? I see that shape object has setRotation and setRotationCenter. Not sure how to use these to achieve the effect. I realize that defau

Re: Import module

2015-07-10 Thread codenstuff via Digitalmars-d-learn
On Friday, 10 July 2015 at 10:22:39 UTC, anonymous wrote: On Friday, 10 July 2015 at 00:53:38 UTC, codenstuff wrote: On Friday, 10 July 2015 at 00:24:44 UTC, anonymous wrote: [...] [...] The path is ${HOME}/d_apps/steering/steering/game_object.d Compile command is dmd map/map.d main_visual

Re: Import module

2015-07-09 Thread codenstuff via Digitalmars-d-learn
On Friday, 10 July 2015 at 00:24:44 UTC, anonymous wrote: On Thursday, 9 July 2015 at 22:05:23 UTC, codenstuff wrote: I am trying to import module and compile. The compiler produces message map/map.d(9): Error: module game_object is in file 'steering/game_object.d' which cannot be read impor

Re: Import module

2015-07-09 Thread codenstuff via Digitalmars-d-learn
On Thursday, 9 July 2015 at 22:10:53 UTC, Adam D. Ruppe wrote: The best thing to do is to pass all the modules in the project to the compiler at once, so like: dmd map/map.d steering/game_object.d The import path could be changed to not include the steering/ folder - give it the folder that c

Import module

2015-07-09 Thread codenstuff via Digitalmars-d-learn
I am trying to import module and compile. The compiler produces message map/map.d(9): Error: module game_object is in file 'steering/game_object.d' which cannot be read import path[0] = /usr/include/dmd/phobos import path[1] = /usr/include/dmd/druntime/import make: *** [main] Error 1 How can

Malloc struct

2015-07-06 Thread codenstuff via Digitalmars-d-learn
I need to create following struct using malloc struct Map { int **entries; int rows; int cols; } Map *map_create(int rows, int cols) { Map *that = cast(Map*)malloc(Map.sizeof); that.entries = cast(int**)malloc(rows * int.sizeof); foreach(row; 0..rows) { that.entries[row] = cast(int*)mal