Re: Best way to use large C library in D as of 2024

2024-03-29 Thread harakim via Digitalmars-d-learn
On Tuesday, 26 March 2024 at 20:42:00 UTC, Chris Piker wrote: On Tuesday, 26 March 2024 at 20:19:27 UTC, bachmeier wrote: Should be able to just use it, as described here: https://forum.dlang.org/post/qxctappnigkwvaqak...@forum.dlang.org Create a .c file that includes the header files and

Re: Reworking the control flow for my tactical role-playing game

2024-03-25 Thread harakim via Digitalmars-d-learn
On Saturday, 23 March 2024 at 22:37:06 UTC, Liam McGillivray wrote: ...a tick system would go hand-in-hand with making animations happen in a separate thread, but it sounds like you're talking about the same thread. Are you suggesting a fixed framerate? I have done both ways. If you're new to

Re: Reworking the control flow for my tactical role-playing game

2024-03-22 Thread harakim via Digitalmars-d-learn
I am not an expert but I would second the tick system. That is pretty solid advice. Just iterate through your events or, in your case, units and such objects and update them all. Then draw. Then go to the next tick. You should engineer the system in a way that makes sense to you. The

Re: File size

2023-08-24 Thread harakim via Digitalmars-d-learn
On Wednesday, 23 August 2023 at 08:48:26 UTC, FeepingCreature wrote: That's hilarious! I'm happy you found it. Me too! Thanks for the support. (PS I've already reformatted that drive to ext4.)

Re: File size

2023-08-22 Thread harakim via Digitalmars-d-learn
On Monday, 21 August 2023 at 11:05:36 UTC, FeepingCreature wrote: Can you print some of the wrong sizes? D's DirEntry iteration code just calls `FindFirstFileW`/`FindNextFileW`, so this *shouldn't* be a D-specific issue, and it should be possible to reproduce this in C. Thanks for the

Re: File size

2023-08-21 Thread harakim via Digitalmars-d-learn
On Monday, 21 August 2023 at 11:05:36 UTC, FeepingCreature wrote: Can you print some of the wrong sizes? D's DirEntry iteration code just calls `FindFirstFileW`/`FindNextFileW`, so this *shouldn't* be a D-specific issue, and it should be possible to reproduce this in C. Yes! I will get that

File size

2023-08-21 Thread harakim via Digitalmars-d-learn
I have been doing some backups and I wrote a utility that determines if files are an exact match. As a shortcut, I check the file size. So far so good on this with millions of files until I found something odd: getSize() and DirEntry's .size are producing different values. This is the

Re: Recommendation on plotting library

2023-07-20 Thread harakim via Digitalmars-d-learn
On Thursday, 20 July 2023 at 02:37:54 UTC, Chris Piker wrote: Hi D One of my jobs is to release and maintain public data archives from long-running scientific instruments. In order to help people understand how to process the data, sample code is often included with the archive. Recently

Re: having troubles with D and Vulkan.

2023-07-20 Thread harakim via Digitalmars-d-learn
On Thursday, 20 July 2023 at 06:27:13 UTC, Danni Coy wrote: ok found it, I am an idiot, (really not used to working with dynamic libraries). erupted needs a call to load device level functions. loadDeviceLevelFunctions(instance); On Thu, Jul 20, 2023 at 4:22 PM Danni Coy wrote:

Re: having troubles with D and Vulkan.

2023-07-19 Thread harakim via Digitalmars-d-learn
On Wednesday, 19 July 2023 at 02:50:05 UTC, Danni Coy wrote: I am trying to run through the basic Vulkan triangle demo. I am getting stuck at vkGetDeviceQueue which segfaults for me. I have written the same tutorial to about the same point in C and I am not getting the segfault. I have

Re: std.conv.to

2022-06-17 Thread harakim via Digitalmars-d-learn
On Friday, 17 June 2022 at 12:53:53 UTC, bauss wrote: Just add a constructor to your type that takes the value of what you want to convert. Working example: ```d struct Foo { int value; this(int v) { value = v; } this(string v) { this(to!int(v));

Re: std.conv.to

2022-06-17 Thread harakim via Digitalmars-d-learn
On Friday, 17 June 2022 at 12:31:45 UTC, harakim wrote: I can generically convert a string to a type using to!type. I have a read function that does that. I have simplified the example below: ```d int readNumber() { return read!int(val => to!int(val),

std.conv.to

2022-06-17 Thread harakim via Digitalmars-d-learn
I can generically convert a string to a type using to!type. I have a read function that does that. I have simplified the example below: ```d int readNumber() { return read!int(val => to!int(val), "number"); } string readTime() {

Re: UI Library

2022-06-16 Thread harakim via Digitalmars-d-learn
On Saturday, 11 June 2022 at 21:50:47 UTC, Adam D Ruppe wrote: On Saturday, 11 June 2022 at 01:20:17 UTC, harakim wrote: The issue I'm having is that I don't understand how to assign bounds in the nested widget. I'm sure there's a very clean solution. I basically want a paintContent method but

Re: UI Library

2022-06-11 Thread harakim via Digitalmars-d-learn
On Saturday, 11 June 2022 at 01:20:17 UTC, harakim wrote: On Friday, 20 May 2022 at 12:07:46 UTC, Adam D Ruppe wrote: On Friday, 20 May 2022 at 03:47:14 UTC, harakim wrote: Thank you. I will definitely give that a try. But just ask me if something comes up since I can push fixes to master p

Re: UI Library

2022-06-10 Thread harakim via Digitalmars-d-learn
On Friday, 20 May 2022 at 12:07:46 UTC, Adam D Ruppe wrote: On Friday, 20 May 2022 at 03:47:14 UTC, harakim wrote: Thank you. I will definitely give that a try. But just ask me if something comes up since I can push fixes to master p quickly. I have been using the minigui library and it's

Re: Graphing a D function : possible?

2022-06-02 Thread harakim via Digitalmars-d-learn
On Thursday, 2 June 2022 at 03:37:13 UTC, z wrote: Is there a quick way of obtaining the graph of D functions like these? ```d T f(T) if (isScalarType!T){} ``` or ```D T[2] f(T, T)if (isScalarType!T){} ``` I know that there are graphing calculators already, but these don't support low level

Re: Basic SQLite Application

2022-06-01 Thread harakim via Digitalmars-d-learn
On Wednesday, 1 June 2022 at 15:58:01 UTC, Jesse Phillips wrote: On Wednesday, 1 June 2022 at 15:40:43 UTC, harakim wrote: It's been a long time since I did any C development, and I have never done any on windows, but I thought I could statically link to the .lib at compile time and then I

Re: Basic SQLite Application

2022-06-01 Thread harakim via Digitalmars-d-learn
On Wednesday, 1 June 2022 at 10:57:11 UTC, Adam D Ruppe wrote: BTW: "copyFiles":["lib/sqlite3.lib"] You don't need that, the .lib is only used while building. You might need to copyFiles the .dll though. It's been a long time since I did any C development, and I have never done

Basic SQLite Application

2022-05-31 Thread harakim via Digitalmars-d-learn
I'm creating an application in D to do some purchase management stuff and I ran into a snag pretty early on. I'm trying to use sqlite via [this library](https://github.com/adamdruppe/arsd/blob/master/sqlite.d). I started trying to get it to compile in another directory structure but since I've

Re: UI Library

2022-05-21 Thread harakim via Digitalmars-d-learn
On Friday, 20 May 2022 at 08:03:10 UTC, drug wrote: You can select category in dub (code.dlang.org) to get something like this: https://code.dlang.org/?sort=updated=20=library.gui Thanks. I'm still kind of new to dub so I didn't know this existed! I'm glad there are multiple options that

Re: UI Library

2022-05-21 Thread harakim via Digitalmars-d-learn
On Friday, 20 May 2022 at 12:07:46 UTC, Adam D Ruppe wrote: The docs don't have a lot of examples but hopefully one you do the first one the rest won't be too hard, the classes are relatively simple and the events are based on javascript so if you've used that before you can probably get to

Re: UI Library

2022-05-19 Thread harakim via Digitalmars-d-learn
On Friday, 20 May 2022 at 02:53:39 UTC, Craig Dillabaugh wrote: On Friday, 20 May 2022 at 02:37:48 UTC, harakim wrote: I need to write a piece of software to track and categorize some purchases. It's the kind of thing I could probably write in a couple of hours in C#/Java +

UI Library

2022-05-19 Thread harakim via Digitalmars-d-learn
I need to write a piece of software to track and categorize some purchases. It's the kind of thing I could probably write in a couple of hours in C#/Java + html/css/javascript. However, something keeps drawing me to D and as this is a simple application, it would be a good one to get back in

Re: curses/ncurses liberary in D

2021-11-02 Thread harakim via Digitalmars-d-learn
On Wednesday, 3 November 2021 at 01:39:02 UTC, H. S. Teoh wrote: On Wed, Nov 03, 2021 at 01:33:28AM +, dangbinghoo via Digitalmars-d-learn wrote: On Wednesday, 3 November 2021 at 00:50:31 UTC, pascal111 wrote: > How can I include "ncurses" liberary in D? I'm using Ubuntu > and GDC!

Re: Are there anything like leetcode.com but that supports D?

2021-10-29 Thread harakim via Digitalmars-d-learn
On Sunday, 24 October 2021 at 05:46:48 UTC, Dr Machine Code wrote: I'd like that to some friends getting start with programming. Sadly that platform doesn't support D. I wouldn't mind helping out by reviewing code or answering questions if they get stuck. My email is my username at

Re: D's Continous Changing

2021-03-05 Thread harakim via Digitalmars-d-learn
On Friday, 5 March 2021 at 07:51:24 UTC, Siemargl wrote: On Friday, 5 March 2021 at 03:32:35 UTC, harakim wrote: I want this almost every week at work. When I run into some trivial statement that I need to know for sure how it works, it's rarely worth it to create a whole new file and make a

Re: D's Continous Changing

2021-03-04 Thread harakim via Digitalmars-d-learn
``` "toolchainRequirements": { "frontend": "==2.096" }, ``` Thanks! I didn't know you could specify a toolchain version. I agree it would be cool if it automatically downloaded the correct version of compiler, but this will be helpful. Is it possible to

Re: Opaque type (struct) with a static immutable fails to compile without constructor - why?

2021-03-04 Thread harakim via Digitalmars-d-learn
On Thursday, 4 March 2021 at 13:58:48 UTC, frankp wrote: Hi all, I want to make an opaque type that simply contains an integer with some immutable constants and toString pretty printing. Like this: struct Foo_t { private long foo; alias foo this; static immutable long Inf =

Re: D's Continous Changing

2021-03-03 Thread harakim via Digitalmars-d-learn
For the record, I was able to resolve all of my issues in about 7 hours. That included upgrading from DerelictSDL to bindbc and converting to use dub instead of make. I hope my above post does not lead people to believe that I don't like D, because I otherwise wouldn't have lost track of time

D's Continous Changing

2021-03-03 Thread harakim via Digitalmars-d-learn
Every time I come back to a D program I wrote over a year ago, it seems like there are numerous breaking changes and it takes me a while to get it to compile again. And the documentation is difficult to figure out. I wish I could remember every time I've had to change this line of code, but I

Re: Heterogeneous Variadic Arguments with Other Arguments

2019-07-14 Thread harakim via Digitalmars-d-learn
On Sunday, 14 July 2019 at 06:05:13 UTC, evilrat wrote: On Sunday, 14 July 2019 at 03:51:14 UTC, harakim wrote: I wanted to do this: package int serialize(byte[] destination, int offset, T...)(T values) Can't really tell what's going on without call site and what do you exactly mean

Heterogeneous Variadic Arguments with Other Arguments

2019-07-13 Thread harakim via Digitalmars-d-learn
I wanted to do this: package int serialize(byte[] destination, int offset, T...)(T values) { static foreach (i, value; values) { *cast(T[i] *)(destination.ptr + offset) = value; offset += typeid(T[i]).tsize(); }

Re: Binary Serialization

2019-07-13 Thread harakim via Digitalmars-d-learn
On Sunday, 14 July 2019 at 00:18:02 UTC, Adam D. Ruppe wrote: On Saturday, 13 July 2019 at 23:52:38 UTC, harakim wrote: class MoveCommand { byte serialNumber; int x; int y; } When I do MoveCommand.sizeof, it returns 4. It is important to understand a class in D is a

Binary Serialization

2019-07-13 Thread harakim via Digitalmars-d-learn
I am receiving packets of data over the network from a C#/Java/dlang/etc. client. I'm writing the data directly to a socket, one primitive value at a time in little endian format. I would like to receive this super easily in d. Here is an example of roughly what I want to do. class

Re: Immutable

2017-06-23 Thread harakim via Digitalmars-d-learn
On Friday, 23 June 2017 at 14:29:40 UTC, Adam D. Ruppe wrote: On Friday, 23 June 2017 at 14:25:48 UTC, harakim wrote: immutable(AppendChatCommand) command = new AppendChatCommand(type, text); try `new immutable AppendChatCommand` instead of just `new`. If it complains that it cannot call the

Re: Immutable

2017-06-23 Thread harakim via Digitalmars-d-learn
On Friday, 23 June 2017 at 14:25:48 UTC, harakim wrote: I am building a system where one thread generates commands and sends them to another thread. The commands will never change once they are created. I have marked the values immutable, but I've been struggling to understand the requirements

Immutable

2017-06-23 Thread harakim via Digitalmars-d-learn
I am building a system where one thread generates commands and sends them to another thread. The commands will never change once they are created. I have marked the values immutable, but I've been struggling to understand the requirements for sharing a variable across threads. cannot