Re: Help making a game with transparency

2019-09-30 Thread Murilo via Digitalmars-d-learn
Hi everyone, I tried creating a program which simply shows the 
image of the ship near the corner of the screen, just for testing 
sake. Here it is:


import arsd.gamehelpers, arsd.image;
​
void main()​
{​
SimpleWindow window = create2dWindow("Space Invaders", 1000, 
400);​
OpenGlTexture ship = new 
OpenGlTexture(loadImageFromFile("images/ship_normal.png").getAsTrueColorImage());​

window.eventLoop(40,​
(/*no events*/)​
{​
window.redrawOpenGlSceneNow;​
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | 
GL_ACCUM_BUFFER_BIT);​

glLoadIdentity;​
ship.draw(20, 20, 41, 47);​
});​
}​

But the screen stays all white, nothing appears in it. Any ideas 
what needs to be changed?


Re: Help making a game with transparency

2019-09-30 Thread Murilo via Digitalmars-d-learn
On Saturday, 28 September 2019 at 14:33:03 UTC, Adam D. Ruppe 
wrote:


But if you all want that, on your schedule, smash that like 
button, comment, subscribe, and be sure to ring that bell so 
you get a notification every time I parrot what people say on 
Youtube at the end of their videos. Then head on over my 
patreon page and give me all your money today. If everyone who 
downloaded my libraries contributed just $3 / month, I'd be 
able to devote myself to expanding these libraries to support 
more use cases.




What are your pages that you want people subscribing to? And what 
is your patreon page? I may buy your book "D cookbook" next year, 
that will probably be a good contribution.




Saving and loading large data sets easily and efficiently

2019-09-30 Thread Brett via Digitalmars-d-learn
I have done some large computations where the data set is around 
10GB and takes several minutes to run. Rather than running it 
every time regenerating the same data, can I simply save it to 
disk easily?


The data is ordered in arrays and structs. It's just numbers/POD 
except some arrays use pointers to elements in other arrays(so 
the structs are not duplicated).


Hence any saving routine would have to take this in to account 
and properly reference the references structs rather than 
duplicate them...


Hence why it is not so simple as writing out the array data. 
Ideally it would write to binary to save space.


Essentially pointers will get to file offsets and so, in some 
sense, it is as if one had a memory map where ptr = 0 is the 
start of the data structure and ptr=34 would reference the 34 
byte. All pointers in the data struct refer to all pointers 
relative to the main structure(no heal allocations except for the 
arrays of struct pointers).


So it much more difficult than POD but would still be a little 
more work to right... hoping that there is something already out 
there than can do this. It should be



The way the data is structured is that I have a master array of 
non-ptr structs.


E.g.,

S[] Data;
S*[] OtherStuff;

then every pointer points to an element in to Data. I did not use 
int's as "pointers" for a specific non-relevant reason but I 
should be able to convert every pointer to an index by simply 
removing the offset. [Technically I do not know if this is 
occurring but it should]


OtherStuff's elements just reference Data's elements.


I imagine it wouldn't be that difficult to write out the Data. 
Save Data to a file then append the rest of the info and all 
pointers from memory can be converted to pointers to disk by 
simple a ptr - Data.ptr. It still requires managing some issues 
stuff though. As I do have some associative arrays:


S*[int] MoreStuff;

So I'm looking for a more robust solution that will handle any 
future expansions.




Re: Help making a game with transparency

2019-09-30 Thread Murilo via Digitalmars-d-learn

On Saturday, 28 September 2019 at 13:41:24 UTC, matheus wrote:
Ok, I took a look over my old projects and I found exactly what 
you want, by the way it's from 2012.


It uses Derelict 2.0 bindings and will draw a PNG image where 
you can move around with cursor keys.


If you want I can send you the whole project (Makefile, DLL's) 
and everything else to build it.


Code:

/* 02/10/2012 */
import std.stdio;
import derelict.sdl.sdl;
import derelict.sdl.image;
Matheus.


Thank you very much.


Re: How to use Dbus to detect application uniqueness in D?

2019-09-30 Thread Kagamin via Digitalmars-d-learn

On Sunday, 29 September 2019 at 02:09:56 UTC, Hossain Adnan wrote:

On Saturday, 28 September 2019 at 13:37:12 UTC, Kagamin wrote:

https://ddbus.dpldocs.info/ddbus.bus.requestName.html


It requires a Connection type which I cannot find in the API.


It's in ddbus.thin, missing documentation comment, see unittest: 
https://ddbus.dpldocs.info/source/ddbus.bus.d.html#L46 and usage 
example at http://code.dlang.org/packages/ddbus


Re: How to use Dbus to detect application uniqueness in D?

2019-09-30 Thread Kagamin via Digitalmars-d-learn

On Sunday, 29 September 2019 at 02:09:56 UTC, Hossain Adnan wrote:

On Saturday, 28 September 2019 at 13:37:12 UTC, Kagamin wrote:

https://ddbus.dpldocs.info/ddbus.bus.requestName.html


It requires a Connection type which I cannot find in the API.


It's in ddbus.thin, missing documentation comment, see unittest: 
https://ddbus.dpldocs.info/source/ddbus.bus.d.html#L46