The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

0

First of all, i don't know how the entt-Framework works. I recognize most of its functions, but some i dont really understand what they do. I try to explain what i did the first time around and also try explain, what problems i had. Maybe that helps what my way of thinking was. Second, i just make some easy assumptions, that can be changed by your liking, ...


0

I fixed by changing special characters : üĞI to uGi


0

It's been a while since I last used SDL 1.2, but from what I remember there are two options. First, SDL by default works in software mode. If you're not using OpenGL, then you'd have to grab the screen buffer SDL_Surface and scale it to your window's size (probably SDL_Image has a function to do that). Second option is if you're using OpenGL. After ...


0

It's not possible to assign the mouse wheel scrolling action to a regular axis mapping as you would do with two different keys. The only option available is using MouseWheelUp to scale +1.0 (or what you need) and MouseWheelDown to scale -1.0. This is by design and is not considered a bug. Edit based on my own tests and from new comments. I'm not sure why ...


2

You can try like this. Define Struct: USTRUCT(BlueprintType) struct MYRROJ_API FMyStruct { GENERATED_USTRUCT_BODY() UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Test") int32 Test; FMyStruct() { } }; Usage: UPROPERTY(EditDefaultsOnly, BlueprintReadOnly) FMyStruct Test;


2

Non-const references in C++ functions exposed to Blueprint are always treated as outputs by the parser in UnrealHeaderTool. You can see this in the (very involved) logic of FHeaderParser::GetVarType in Engine/Source/Programs/UnrealHeaderTool/Private/HeaderParser.cpp. This is called by ParseParameterList during parsing a functions parameter list. If you ...


1

One of the requirements to develop with Unreal is to have Visual Studio installed. Because you are specifically working with a C++ project any attempt to open the project will also try to open Visual Studio. Since it isn't installed it errors out. As for "why unreal imposes this limitation" is "because". It's a requirement of the engine and editor to work. ...


0

A few things come to mind when I look at your code. Setting up your draw context should be done once at the start before you start executing draw calls. Consider using Instancing to reduce your call count down (does require more set up). Small vertex sets in a draw call will mean that the GPU Wavefront will not be filled completely. If you draw say 6 ...


0

Instancing is basically a technology that allows you to draw many instances using only GPU. You basically tell the GPU "draw this many instances of this buffer" and it does this by adding an additional shader input value called Instance ID (it's just an instance index). You do this by adding an additional element to your input layout: static const ...


2

One goal of the ECS pattern is that each system has all its data closely together so that it doesn't get many cache misses when it iterates over the components it manages. So there is nothing wrong with systems having their own memory buffers for data only required by that system. However, there is one thing in your architecture which is usually not what ...


1

There are 2 ways to deal with boxes straddling a boundary. One is to keep the box in the vector of the node where it straddles the boundary and don't push it down. The other is to add the box to all subtrees it overlaps with. For the second option all you need to do is change first if in insert to: //Check if box overlaps boundary if (!mo_boundry.Overlaps(...


1

The specific feature you're looking for in C++ is std::function. I am not saying that this is the best way to implement the actual feature you've asked for (though it's a perfectly sufficient one for some games!), but it is the solution you've asked for help implementing. :) class Bullet{ public: std::function<void(float x, float y, float angle,...


0

if (y + translate >= 50) { y == 50; } This doesn't actually do anything. y goes out of scope right after. Instead you want to limit the value of translate.


2

Another way would be to implement type-erasure with inheritance and to implement the loading parameters with variadic templates. I think the end result is fairly clean, but offers no protections (you could probably write them yourself with dynamic_casting and proper type trait usage) against trying to load a shader with a single string parameter. Note that ...


2

You could always use a variadic template for your arguments. I wrote a similar system for fun a while back and it had something like this: template<typename Resource, typename... Args> struct ContentLoader : public ContentLoaderBase { ContentLoader(std::function<Resource(const std::string&, Args...)> l) { load = l; } ...


0

You could use a new class BulletPath (or something) which would handle all the movement angles and stuff of the bullets. It would be created by the object who fires and used in the class Bullet to control its movement. The advantage is that you could make a different path for any kind of Enemy. You'll just have to add it as a parameter in the Bullet class. ...


-1

In my opinion shaders have too many dependencies to load it as separate resource. It's better to have a resource Material that will contain shaders, input layout, textures (as separate resources) and etc.


2

After advice from Alexandre Vaillancourt, my earlier comment is now turned into an answer. If performance is an issue, you might wanna use a design method/pattern called Object pooling. What this method/pattern actually means is that you, at the start-up of the game/level/scene, fill a container (an std::vector, an std::list etc) with a fixed number of ...


5

You're using a std::vector<Bullet>. This has the advantage of keeping data contiguous in memory, so iterating over it is fast (it has something to do with cache efficiency vs cache misses). The way you're using it is slow. auto it = Bulletlist.begin(); while (it != Bulletlist.end()) { if ((it->del)) { it = Bulletlist.erase(it); } else ...


Top 50 recent answers are included