Categories
Mastering Development

Why is the KeyListener not working on JDialog?

JDialog contains a label and a custom button. Both the dialog and the button are available for focusing. Action and Mouse Listeners for ResetToDefaultButton work fine, but KeyListener for KeyBindDialog doesn’t work. I debugged all overwritten methods: keyTyped, keyPressed, keyReleased and there are no calls in these methods. What could be the problem? public class […]

Categories
Mastering Development

Knight Tour Backstracking with Warndorff rule improvement

The assignment said that I could improve it with Warnsdorff’s algorithm with int CountVisitedNeighbors(). Use this function to compare all of the knight’s possible moves. Choose the next move where the most neighbors have already been visited. *** static int BoardSize = 8; static int attemptedMoves = 0; / xMove[] and yMove[] define next move […]

Categories
Game Creation Mastering Development

Trying to creating roads from a 2D texture into a 3D map using RoadArchitect

I need help with a complex task I’m trying to creating roads using RoadArchitect: https://github.com/FritzsHero/RoadArchitect/tree/RewrittenAPI I’m trying to detect all roads from a texture. I have created a model class to store every detected road using a little bit of recursion: [Serializable] public class RoadNode : IPathNode { //[JsonConverter(typeof(RoadNodeConverter))] public ConcurrentBag<int> Connections { get; set; […]

Categories
Mastering Development

I need help understanding the mind set of solving this question using all functions [closed]

im fairly new to programming and I’m starting off with C++, this question is from an example shown in my comp sci 120 class, and I’m not sure exactly how to get the answer from looking at the question prompt. to be more specific i dont know when to use void or main, when to […]

Categories
Mastering Development

Mac CMake C++ SDL2 duplicate symbols for architecture x86_64

I am following a tutorial about C++ and SDL2 on youtube that was done in 2017 and I’m not able to progress due to this error. I’m new to working on Mac and assumed the error was due to CMake or using VS Code so I installed Qt creator and I’m still getting the same […]

Categories
User Help

Linux mint freezes when running SDL2 prgram

In the past couple SDL2 programs I’ve been developing the strangest error seems to pop up; whenever I run the program– after an arbitrary amount of time has passed– Linux mint freezes. I can’t move my mouse or do anything with the computer. My only option at that point is to push the power button […]

Categories
Mastering Development

I tried to implement transparency but something went wrong

I wanted to add "transparency" to my Game Engine, which I have no earlier knowledge of. I didn’t find any straight answer on how to implement it so I ended up doing some research about something called Alpha Blending which is one way of showing opacity if I have understood it right. I Googled around […]

Categories
Game Creation Mastering Development

Stencil not working processing

With jogamp I can create the following stencil: package help; import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.GLEventListener; import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.awt.GLCanvas; import java.awt.Frame; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ArrayList; import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2; import com.jogamp.opengl.glu.GLU; public class Mask_Jogamp { static class Rect { float x, y, w, h; ArrayList<Rect> children = new ArrayList<Rect>(); Rect parent; int […]

Categories
Mastering Development

JPanels not being added to the JFrame

So I was building this very simple game and I’ve add all the elements (for the movement) but when I hit run it only shows me the JFrame and not the JPanel. I should mention that I am very new to Java and the code you see bellow might not be the cleanest (it’s also […]

Categories
Mastering Development

Copy constructor + Shallow & deep copy

I wanted to ask that when I don’t write any copy constructor explicitly so the compiler automatically generates the copy constructor which performs shallow copy by default right? So in the main() program when I changed the values of integers a, b and pointer p only the value of p changed and values of a […]