Search found 14 matches

by John73 John
January 6th, 2023, 3:38 am
Forum: Everything
Topic: why C++ cannot let you initialize a static array of objects that have at least one reference value ?
Replies: 6
Views: 13871

Re: why C++ cannot let you initialize a static array of objects that have at least one reference value ?

Ah yes, the classic programmer trap. "This will take me like 20 seconds, 25 tops. Let me put 4 hours into figuring out if there's a way to cut that down to 10."
by John73 John
January 6th, 2023, 3:15 am
Forum: Everything
Topic: why C++ cannot let you initialize a static array of objects that have at least one reference value ?
Replies: 6
Views: 13871

Re: why C++ cannot let you initialize a static array of objects that have at least one reference value ?

I'm afraid I can't help with that second question. Since there are only 2 things you're replacing why not just do them one at a time? Use ctrl+H to replace "position.x" with "X_POS" and then do the same for Y?
by John73 John
January 5th, 2023, 11:24 pm
Forum: Everything
Topic: why C++ cannot let you initialize a static array of objects that have at least one reference value ?
Replies: 6
Views: 13871

Re: why C++ cannot let you initialize a static array of objects that have at least one reference value ?

As with a lot of things in C++, it's complicated. Basically when you create and array, you create all the items in the array at that point. Creating an array of A's tries to call the default constructor, which is "A()" but that's been deleted. There's no way (that I know of) to create an array of A'...
by John73 John
January 4th, 2023, 7:59 am
Forum: Everything
Topic: Having problems overloading += operator of my Vector structure.
Replies: 8
Views: 14693

Re: Having problems overloading += operator of my Vector structure.

#pragma once is an instruction to the pre-processor that prevents a different kind of redefinition. If FileA.h is #included in FileB.h, and then both A and B are #included in FileC.cpp, then without #pragma once, there would be 2 copies of A included in C. That's what #pragma once protects against. ...
by John73 John
January 4th, 2023, 7:22 am
Forum: Everything
Topic: Having problems overloading += operator of my Vector structure.
Replies: 8
Views: 14693

Re: Having problems overloading += operator of my Vector structure.

Ah, I think I see where you went wrong. You can declare a function in the .h file, but you should define it in the associated .cpp file. The declaration is a single line like this: Vector2Float& operator *= (const float lhs, const Vector2Float& rhs); That's the only part of this function that should...
by John73 John
January 3rd, 2023, 8:02 pm
Forum: Everything
Topic: Having problems overloading += operator of my Vector structure.
Replies: 8
Views: 14693

Re: Having problems overloading += operator of my Vector structure.

It sounds like you're not declaring the operators correctly and you have a namespace issue maybe? Here's the proper way to do it. The declaration, in Vector2Float.h: // In the "Vector2Float" namespace struct Vector2Float { // return type is a Vector2Float reference Vector2Float& operator+=(const Vec...
by John73 John
January 3rd, 2023, 2:24 am
Forum: Everything
Topic: Having problems overloading += operator of my Vector structure.
Replies: 8
Views: 14693

Re: Having problems overloading += operator of my Vector structure.

The problem is the lines: return Vector2Float { this->x + rhs.x, this->y + rhs.y, }; It looks like you're trying to construct a new Vector2Float and then return it, but the += operator is supposed to work by modifying its original lefthand operator directly, not creating a new one. For example, "a +...
by John73 John
December 1st, 2022, 5:57 pm
Forum: Everything
Topic: Need some advice on self promotion / distribution
Replies: 3
Views: 12094

Re: Need some advice on self promotion / distribution

Okay, so I narrowed down the missing files, and I put a zipped folder of the finished build and all assets on the discord I started last week: https://discord.gg/Ddy8VbY2 Feel free to give the game a try, I found in playtesting that it can be kind of addictive :) Right now, installing the game means...
by John73 John
November 30th, 2022, 4:52 pm
Forum: Everything
Topic: Need some advice on self promotion / distribution
Replies: 3
Views: 12094

Re: Need some advice on self promotion / distribution

Hi, thanks for your reply. I went to the library this morning and tried to run it on one of their computers and your concerns were justified, I'm missing a few of visual studio's .dll files. I'm going to try to correct the issue myself once I get home from work, and I'll get back to you on that. I w...
by John73 John
November 19th, 2022, 7:40 pm
Forum: Everything
Topic: Need some advice on self promotion / distribution
Replies: 3
Views: 12094

Need some advice on self promotion / distribution

Okay, so, I made a thing. Fits the definition of "game" within normal parameters. I think it's pretty good. There's a lot more I'd like to add, but I'm at the point now where I'd like to let people start playing it and see what they think. The first thing I did was investigate what's involved in dis...