I vaguely remember testing that just before finalizing, and it not crashing at all. Weird. While it's possible some other small but crucial bit of code got left out as you were building the editor, I'm not sure. Either way, since solidity toggling only applies to selection mode, I'd stick to modifying that branch down the line inside the SolidToggle method:
void GUI_SelectionOptions::SolidToggle(EventDetails* l_details) {
auto mode = m_mapControls->GetMode();
...
if (mode == ControlMode::Brush) {
...
} else if (mode == ControlMode::Select) {
... // Modify/verify the selection range here.
}
...
}
Doing it up top like that completely ignores the fact that brush mode doesn't even deal with selection range. At least modify your check up top to something like this:
if (m_mapControls->GetMode() != ControlMode::Brush && (mode != ControlMode::Select || m_selectRangeX.x == -1)) { return; }
Goes to show how missing something simple like that can result in a crash.
Yes, the editor crashed every time if you replicated those steps. Also, it makes sense to use my suggested check, but moving it into the specific portion of the code that matters to it: the selection mode (as you suggested!) -> BUG FIXED! ;)
Now, not related to the map editor anymore (and jumping from chapter 4 to chapter 8). One wierd thing started to happen and before posting it here I double check with the source code from PacktLib instead of just trusting my own version of the code (because it could have been my fault if I missed something). So the results described below are after compiling and runing the original source code available with the book purchase by PacktLib.
PROBLEM 1 (minor):Prior to chapter 8 you could move your guy in the town, so all movement was working fine. After the modifications in chapter 8, we can only move the guy for about 1 or 2 seconds before it starts to decelerate and then completely stops. No matter how you keep pressing any directional key, it doesn't move anymore. You have to hit ESCAPE to return to main menu and get back to the game state so it can move a little bit more if you press the key, only to stop again after 1 or 2 seconds. It's like something is slowing him down like a car applying the brakes. It's very wierd, specially because we didn't change anything in the S_Movement or C_Controller files. I can't wrap my head around why chapter 7 (implementing openGL camera, transforms, etc..) and chapter 8 (implementing basic light) has to do/can influence the character movement.
PROBLEM 2 (critical): After chapter 9, following the implementations of the 3d dynamic shadows, we are forced to move to openGL completely when using our rendering engine and the shaders. With that, we are instructed to create a GenericFBO class, so far so good. After compiling the Packtlib version of chapter 9 (to see if I still encounter the error), I still do, and hit an exception at the following line :
void GenericFBO::Create() {
if (!m_FBO) { glCreateFramebuffers(1, &m_FBO); }
Observation: My graphics card can run OpenGL fine and its drivers are updated.
Well, those are the two main problems: character movement (wierd, wierd!) and the openGL exception that doesn't let me run the game anymore.
Hi OrderNexus, thank you for the reply.
About your questions:
1. No, there was no other types of lag: just the player movement. I tried using your version of chapter 9 files, just compiled and run and I experience the same issue. This issue started happening after chapter 5 (when we cut off SFML and started using openGL).
1.1. My delta time during the update? Let me know exactly what you want me to create so I can log something for you to see.
2. GLEW version I use is the latest on their website (v 2.0.0) which supports opennGL up to 4.5. My graphics card is simple, it only supports up to 4.4, but that didn't seemed to be the problem, because I use 4.4 in the context setting inside Window::Create() and I was able to follow the entire chapter 6 (when you create a rotating 3D cube on the screen as an introduction to openGL) and it compiled and ran just fine. As a comparisson, here is the setting I am using:
void Window::Create() {
sf::Uint32 style = sf::Style::Default;
if (m_isFullscreen) { style = sf::Style::Fullscreen; }
sf::ContextSettings settings;
settings.depthBits = 24;
settings.stencilBits = 8;
settings.antialiasingLevel = 0;
settings.majorVersion = 4;
settings.minorVersion = 4;
m_window.create(
sf::VideoMode(m_windowSize.x, m_windowSize.y, 32), m_windowTitle, style, settings);
...
}
Actually, the engine with those context settings compiled every time until chapter 9. It only started throwing an exception when we created that class called "GenericFBO" and used it to create the framebuffer m_FBO. The exception is thrown in this line:
void GenericFBO::Create() {
if (!m_FBO) { glCreateFramebuffers(1, &m_FBO); } // <-- exception throws right here!
...
}
and the exception message is attached to the attachments below my post, followed by my graphics card settings. Let me know what you would like me to do in order to solve this. I'm really into game programming. I love it and I don't want small stones in the path to break my motivation to keep going. I want to start the debugging tool for the engine. I also bought another C++ book to further my knowledge! (https://www.amazon.com/How-Program-10th-Paul-Deitel/dp/0134448235/ref=sr_1_1?ie=UTF8&qid=1497409561&sr=8-1&keywords=deitel+deitel+c%2B%2B) 8) Supposedly a very good one.