Re: Error when using `import`.

2024-03-05 Thread Liam McGillivray via Digitalmars-d-learn
There's something that I'm trying to do that D may or may not be capable of. In the Map class, there is a 2-dimensional array called `grid`, where the Tile objects are stored. The Mission class inherits the Map class. In the Mission class, I want the `grid` array to instead be composed of

Re: Error when using `import`.

2024-03-05 Thread Liam McGillivray via Digitalmars-d-learn
I have made some progress on this. For the raylib front-end, I tried making a class called `Mission` which inherits `Map`. This class handles the graphics, input, and other game events. The program now compiles without errors, and there are some graphics. I have pushed these updates to the

Re: Error when using `import`.

2024-03-01 Thread monkyyy via Digitalmars-d-learn
On Friday, 1 March 2024 at 05:07:24 UTC, Liam McGillivray wrote: I don't know how best to organize the code. So far I have been oo ideas for a 2nd opinion: https://github.com/crazymonkyyy/raylib-2024/blob/master/docs/examplecode.md Theres not a good learning resource but "data oirented

Re: Error when using `import`.

2024-02-29 Thread Liam McGillivray via Digitalmars-d-learn
I now have the Raylib functions working by using `toStrinz`. I pushed some updates to the repository. I made the main project a source library so that I can experiment with different graphics library front-ends. I put have the front-end using Raylib in the `raylib_frontend` directory. It

Re: Error when using `import`.

2024-02-28 Thread Danilo via Digitalmars-d-learn
Examples were moved, so it‘s in the same place now: - https://github.com/schveiguy/raylib-d - https://github.com/schveiguy/raylib-d_examples

Re: Error when using `import`.

2024-02-28 Thread Danilo via Digitalmars-d-learn
On Wednesday, 28 February 2024 at 07:56:16 UTC, Liam McGillivray wrote: ``` DrawText("Open Emblem", 180, 300, 64, Colors.RAYWHITE); ``` So why is it that one of these functions, but not the other is allowing D strings in place of C-style strings? C is expecting null-terminated chars. D

Re: Error when using `import`.

2024-02-28 Thread Liam McGillivray via Digitalmars-d-learn
There's something very strange going on when using Raylib-D. I tried using the raylib function `LoadTexture` like this: ``` tileSprites[i] = LoadTexture("../sprites/" ~ spriteName); ``` I got the following error: ``` Error: function `raylib.LoadTexture(const(char)* fileName)` is not callable

Re: Error when using `import`.

2024-02-27 Thread Danilo via Digitalmars-d-learn
On Tuesday, 27 February 2024 at 22:05:48 UTC, Liam McGillivray wrote: Looking at the code examples on the Raylib and SFML website, they look similar in complexity of getting started, but I like it that the Raylib website has lots of simple demonstration programs on the website with the code

Re: Error when using `import`.

2024-02-27 Thread Liam McGillivray via Digitalmars-d-learn
On Tuesday, 27 February 2024 at 03:43:56 UTC, Liam McGillivray wrote: Raylib looks promising. I installed it along with your Raylib-d. I managed to build the example you provided with dub, but trying to use it in it's own dub project in a separate directory isn't working. Just copying and

Re: Error when using `import`.

2024-02-26 Thread Liam McGillivray via Digitalmars-d-learn
On Tuesday, 27 February 2024 at 03:06:19 UTC, Steven Schveighoffer wrote: If you are going for game development, I would recommend raylib-d (https://code.dlang.org/packages/raylib-d), which is my wrapper around the very good raylib library. For doing GUI, raygui is supported, but I also can

Re: Error when using `import`.

2024-02-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 26 February 2024 at 23:27:49 UTC, Liam McGillivray wrote: I don't know whether I should continue this topic or start a new one now that the problem mentioned in the title is fixed. I have now uploaded some of the code to [a GitHub repository](https://github.com/LiamM32/Open_Emblem).

Re: Error when using `import`.

2024-02-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 26 February 2024 at 22:40:49 UTC, Liam McGillivray wrote: On Sunday, 25 February 2024 at 03:23:03 UTC, Paul Backus wrote: You can't give a class the same name as the file it's in. If you do, then when you try to use it from another file, the compiler will get confused and think

Re: Error when using `import`.

2024-02-26 Thread Liam McGillivray via Digitalmars-d-learn
I don't know whether I should continue this topic or start a new one now that the problem mentioned in the title is fixed. I have now uploaded some of the code to [a GitHub repository](https://github.com/LiamM32/Open_Emblem). To make this game usable, I will need a library for graphics and

Re: Error when using `import`.

2024-02-26 Thread Liam McGillivray via Digitalmars-d-learn
On Sunday, 25 February 2024 at 03:23:03 UTC, Paul Backus wrote: You can't give a class the same name as the file it's in. If you do, then when you try to use it from another file, the compiler will get confused and think you're referring to the file instead of the class (that's what "import is

Re: Error when using `import`.

2024-02-24 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 24 February 2024 at 10:31:06 UTC, Liam McGillivray wrote: `Unit.d` & `Map.d` are longer files. `Map.d` begins with `import Tile;`, and `Unit.d` begins with `import Map;`. Why are the errors happening? What's the problem? Why is it `currentclass.importedclass` instead of simply

Re: Error when using `import`.

2024-02-24 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 24/02/2024 11:51 PM, Liam McGillivray wrote: On Saturday, 24 February 2024 at 10:34:25 UTC, Richard (Rikki) Andrew Cattermole wrote: A few things. Module names should be lower case. I capitalised the first letter in the class names so that I can make instances of them in lowercase.

Re: Error when using `import`.

2024-02-24 Thread Liam McGillivray via Digitalmars-d-learn
On Saturday, 24 February 2024 at 10:34:25 UTC, Richard (Rikki) Andrew Cattermole wrote: A few things. Module names should be lower case. I capitalised the first letter in the class names so that I can make instances of them in lowercase. Should I rename the classes, modules, and filenames

Re: Error when using `import`.

2024-02-24 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
A few things. Module names should be lower case. Each file, needs the full module declaration. source/foo/bar.d: ```d module foo.bar; ``` source/app.d: ```d module app; import foo.bar; ``` Directories matter, this allows the import path search (via the use of the -I switch) to

Error when using `import`.

2024-02-24 Thread Liam McGillivray via Digitalmars-d-learn
I am trying to make a tactical role-playing game which I am likely to open-source. Right now the code is very simple, with only 3 files each containing a class with the same name. The files are `Map.d`, `Tile.d`, and `Unit.d`. Each of these files contains an `import` line to access one of the