After a long day's work, I'm back.
So I tried to do some things before I came here looking for more help. I tried another fresh build, this time using...
[GCC] 7.3.0 MinGW (DW2) - 32-bit (https://www.sfml-dev.org/files/SFML-2.5.1-windows-gcc-7.3.0-mingw-32-bit.zip)
MinGW Builds 7.3.0 (32-bit) (https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/7.3.0/threads-posix/dwarf/i686-7.3.0-release-posix-dwarf-rt_v5-rev0.7z/download)
The tutorial I followed EXACT (again).
Anyways, I get...
(https://i.postimg.cc/yYnVbMY4/sfml-issue1.png)
...I notice the 7.3.0 MinGW version of SFML 2.5.1 has no /src folder. OK. So I download fresh from Github (https://github.com/SFML/SFML/) (only the /src folder because I don't need more than that.) No prob. Right?
...Is there a reason there are .hpp files in /src? Some of the headers I need are from /src and this is from a fresh, brand new download. If the system isn't able to find these .hpp files then I'm taking the executive decision to move them to /include.
Audio, Graphics, Network, System and Window all have .hpp files in the /src directory. I even moved the /src/Win32/ to /include/Win32/. I'm not an expert on C++ or your libraries but something tells me that's not how it's supposed to be.
Github source link - SFML/Window only (for example) (https://github.com/SFML/SFML/tree/master/src/SFML/Window)
All folders (Audio, Graphics, Window, Network, System) had .hpp files in the /src. Since I had no file replacement overwrite prompt, I'm assuming these WERE in the wrong place? Anyways, I moved them to get away from that "missing ALCheck.hpp" error I was having.....
Even the stuff that was /src/Unix, src/Android, src/Win32; if it had any .hpp files, I moved those to include/Unix, include/Android, include/Win32.
Here is a snapshot of the .hpp files in SFML/Window source, for which got moved to the /include dir with the rest of the headers.
"C:\SFML\2.5.1\src\SFML\Window\ClipboardImpl.hpp"
"C:\SFML\2.5.1\src\SFML\Window\CursorImpl.hpp"
"C:\SFML\2.5.1\src\SFML\Window\EGLCheck.hpp"
"C:\SFML\2.5.1\src\SFML\Window\EglContext.hpp"
"C:\SFML\2.5.1\src\SFML\Window\GlContext.hpp"
"C:\SFML\2.5.1\src\SFML\Window\InputImpl.hpp"
"C:\SFML\2.5.1\src\SFML\Window\JoystickImpl.hpp"
"C:\SFML\2.5.1\src\SFML\Window\JoystickManager.hpp"
"C:\SFML\2.5.1\src\SFML\Window\SensorImpl.hpp"
"C:\SFML\2.5.1\src\SFML\Window\SensorManager.hpp"
"C:\SFML\2.5.1\src\SFML\Window\VideoModeImpl.hpp"
"C:\SFML\2.5.1\src\SFML\Window\WindowImpl.hpp"
...So now I'm moving those .hpp from /src to /include. I've moved ALL these files, it was a lot. I'm not sure if they're supposed to be in /src but my GUT tells me /include is the place to be.
So now I build again...
(https://i.postimg.cc/Qxs8Sp5z/sfml-issue2.png)
The Island example game wouldn't compile, so I downloaded stb_perlin.h (https://github.com/SFML/SFML/search?q=stb_perlin.h) and put it where it needs to be.
Now I'm back to...
(https://i.postimg.cc/VkF58K9n/sfml-issue3.png)
Oh.
Is this something that is needed? I'm not familiar enough with the guts of SFML to know. I can only assume this is related to CSFML bindings, especially since that file extension is an .h and not a .hpp. For now I'm trying to build in purely C++, so I don't care for the CSFML portion (yet). Do I need to write something here to skip the check for these .h files? Are they needed for C++ SFML too? What would the preprocessor commands look like to skip this (if that's what I need to do)?
So, this^ comes full circle to the last time I tried to deploy and build fresh. Now that I've been through this process 3 times (yuck!), perhaps the tutorials ARE accurate but some things have changed in the library? I don't know...
EDIT: I've commented out the #include 'al.h' and #include 'alc.h' but that doesn't fix anything either.
(https://i.postimg.cc/j5wbCH2d/sfml-issue4.png)
So now I'm copying the extlibs into the SFML root directory.
(https://i.postimg.cc/zX1yZB2R/sfml-issue5.png)
^This pops up a whole bunch of times (in Code::Blocks).
It builds fresh regardless but I get (again)...
(https://i.postimg.cc/VkF58K9n/sfml-issue3.png)
So... here are my settings.
(https://i.postimg.cc/RhCsY9t6/sfml-issue6.gif)
EDIT: Updated picture due to bad cropping :X
Do I need to add extlibs too?
The only thing I haven't done (for which I've done last time) is build fresh with CMake. I'm not against building fresh with CMake but I want to make sure all my bases are covered before I touch it because I don't want it dumping on me a garbage truck full of files I don't need and can't use again. If I'm not using CSFML, then I probably don't need the extlibs right? (I might in the future but that's beyond the scope of this topic...) Is extlibs required to run OpenAL, OpenGL, etc or is that strictly for CSFML bindings?
I forget why I had to wipe SFML and start over, I just know one day I started getting a bunch of linker errors and... stuff. Which is strange because I wasn't messing with CMake, the Build options or anything, I was actually working on a Keyboard extension :( I'd like to see if that Keyboard extension works but I can't if the damn thing won't build! It WAS all building fine and it should've kept building fine because I hadn't changed any of the crucial pieces that make it work, nor have I touched the SFML source. :o
EDIT: So now I'm building with CMake. I've chose "Use default native compilers" and it gives...
(https://i.postimg.cc/1zJNHQyY/sfml-issue7.png)
OK. So I delete the files in /BUILD and I'm grabbing the CMakeLists.txt (https://github.com/SFML/SFML/blob/master/CMakeLists.txt) from Github.
The C compiler identification is GNU 5.1.0
The CXX compiler identification is GNU 5.1.0
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.22/Modules/CMakeRCInformation.cmake:27 (include):
include could not find requested file:
C:/SFML/2.5.1/cmake/CompilerOptionsOverride.cmake
Call Stack (most recent call first):
C:/Program Files (x86)/CMake/share/cmake-3.22/Modules/Platform/Windows-GNU.cmake:130 (enable_language)
C:/Program Files (x86)/CMake/share/cmake-3.22/Modules/Platform/Windows-GNU-C.cmake:2 (__windows_compiler_gnu)
C:/Program Files (x86)/CMake/share/cmake-3.22/Modules/CMakeCInformation.cmake:48 (include)
CMakeLists.txt:38 (project)
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working C compiler: C:/TDM-GCC-32/bin/gcc.exe - skipped
Detecting C compile features
Detecting C compile features - done
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Check for working CXX compiler: C:/TDM-GCC-32/bin/g++.exe - skipped
Detecting CXX compile features
Detecting CXX compile features - done
CMake Error at CMakeLists.txt:43 (include):
include could not find requested file:
C:/SFML/2.5.1/cmake/Config.cmake
CMake Error at CMakeLists.txt:79 (sfml_set_option):
sfml_set_option Macro invoked with incorrect arguments for macro named:
sfml_set_option
CMake Error at src/SFML/CMakeLists.txt:3 (include):
include could not find requested file:
C:/SFML/2.5.1/cmake/Macros.cmake
CMake Error at src/SFML/System/CMakeLists.txt:64 (sfml_add_library):
Unknown CMake command "sfml_add_library".
Configuring incomplete, errors occurred!
See also "C:/SFML/2.5.1/BUILD/CMakeFiles/CMakeOutput.log".
And now I'm going to Github to chase all this down^... (topic pending update...) Actually, I'm not going any farther than that. Is there a better way to do this???? I'm pretty livid at this point. Do I need to download the entire source tree and not bother with the stuff >>here, in the Downloads section (https://www.sfml-dev.org/download/sfml/2.5.1/)<<? :|
I started at 5PM. It's 11PM now. I've carefully documented EVERY step.
Hahaha! That was a quick 2 second fix, thank you! SOLVED :)
I'm a little slow on the uptake (it's a lot of information to absorb at once.) I think the problem started when CLion was needing me to do something with CMake. I'm going to continue with this CLion trial but it is now compiling and linking to MY project which was the most important thing to me :D
Now I can get back to the Keyboard extension I was writing. This is pretty cool. If I finish it and it works I'll let you check it out, you'd be more than welcome to include it in the official SFML because it's pretty standard. :)
Off to test out the new Keyboard then I'll be giving the same treatment to Mouse and Joystick! :D
Slightly Off Topic : Untested Brand New Keyboard Preview!
Preview of the code is below if you want to give it a try. (I haven't even tested it yet, outside of when I was writing it @ onlinegdb.com. If anybody tests or modifies it, PM me with the new version. The only thing I haven't added was a 'isDoubleTap()' function and it'll probably be converted to a sf::Vector3 to replace m_SYNC, m_States and maybe m_DblTime to check for each and every key double tap. (Onlinegdb doesn't have sf::Vector3 obviously but it sounds like a good class to use for this. Maybe.))
Keyboard.hpp
//==============================================================================
// ** rgl::Keyboard
//==============================================================================
#ifndef RGL_KEYBOARD_HPP
#define RGL_KEYBOARD_HPP
#include <SFML/System.hpp>
#include <SFML/Window/Keyboard.hpp>
//#include <algorithm>
#include <iostream>
#include <vector>
namespace rgl {
class Keyboard {
public:
// Public Enumerators
enum KeyState {
None = 0,
Trigger,
Press,
Repeat,
Release,
Invalid
};
// Construct and Destruct
Keyboard(); // Good
virtual ~Keyboard(); // Good
// Public Member Variables
std::vector<int> m_SYNC; // Good
std::vector<int> m_States; // Good
// Public Functions
void start(); // Good
bool setActive(bool boolean); // Good
bool isActive(); // Good
bool activate(); // Good
bool deactivate(); // Good
bool setVisible(bool boolean); // Good
bool isVisible(); // Good
bool show(); // Good
bool hide(); // Good
void reset(); // Good
void update(); // Good
bool isNonePress(); // Good
bool isAnyPress(); // Good
bool isAnyTrigger(); // Good
bool isNone(int key); // Good
bool isPress(int key); // Good
bool isTrigger(int key); // Good
bool isRepeat(int key); // Good
bool isRelease(int key); // Good
int checkState(int key); // Good
bool checkState(int key, KeyState state);
bool checkDir4(KeyState state); // Good / Partially Implemented
bool checkDir8(KeyState state); // Good / Partially Implemented
private:
// Private Constant Variables
const double REPEAT_TIME = 3.5; // Good
// Private Member Variables
bool m_Initialized = false; // Good
bool m_Active = false; // Good
bool m_Visible = false; // Good
bool m_AnyPress = false; // Good
bool m_AnyTrigger = false; // Good
sf::Keyboard m_Keyboard;
// Private Functions
sf::Keyboard::Key get(int key); // ...
void initASync(); // Good
void initStates(); // Good
void updatePoll(); // Good
void updateState(int i); // Good
};
}
#endif
//==============================================================================
// ** rgl::Keyboard
//==============================================================================
#include <RGL/Keyboard.hpp>
namespace rgl {
////////////////////////////////////////////////////////////////////////////////
// ** PUBLIC FUNCTION DECLARATIONS
////////////////////////////////////////////////////////////////////////////////
//------------------------------------------------------------------------------
// ** Keyboard (Costructor)
//------------------------------------------------------------------------------
Keyboard::Keyboard() { start(); }
//------------------------------------------------------------------------------
// ** Keyboard (Destructor)
//------------------------------------------------------------------------------
Keyboard::~Keyboard() {}
//------------------------------------------------------------------------------
// ** Keyboard.start()
//------------------------------------------------------------------------------
void Keyboard::start() {
if (m_Initialized) { return; }
initASync();
initStates();
m_Initialized = true;
activate();
}
//------------------------------------------------------------------------------
// ** Keyboard.setActive()
//------------------------------------------------------------------------------
bool Keyboard::setActive(bool boolean) {
if (m_Active == boolean) { return m_Active; }
return (boolean ? activate() : deactivate());
}
//------------------------------------------------------------------------------
// ** Keyboard.isActive()
//------------------------------------------------------------------------------
bool Keyboard::isActive() {
return m_Active;
}
//------------------------------------------------------------------------------
// ** Keyboard.activate()
//------------------------------------------------------------------------------
bool Keyboard::activate() {
m_Active = true;
reset();
return isActive();
}
//------------------------------------------------------------------------------
// ** Keyboard.deactivate()
//------------------------------------------------------------------------------
bool Keyboard::deactivate() {
m_Active = false;
reset();
return isActive();
}
//------------------------------------------------------------------------------
// ** Keyboard.setVisible()
//------------------------------------------------------------------------------
bool Keyboard::setVisible(bool boolean) {
if (m_Visible == boolean) { return m_Visible; }
return (boolean ? show() : hide());
}
//------------------------------------------------------------------------------
// ** Keyboard.isVisible()
//------------------------------------------------------------------------------
bool Keyboard::isVisible() {
return m_Visible;
}
//------------------------------------------------------------------------------
// ** Keyboard.show()
//------------------------------------------------------------------------------
bool Keyboard::show() {
m_Keyboard.setVirtualKeyboardVisible(true);
m_Visible = true;
return m_Visible;
}
//------------------------------------------------------------------------------
// ** Keyboard.hide()
//------------------------------------------------------------------------------
bool Keyboard::hide() {
m_Keyboard.setVirtualKeyboardVisible(false);
m_Visible = false;
return m_Visible;
}
//------------------------------------------------------------------------------
// ** Keyboard.reset()
//------------------------------------------------------------------------------
void Keyboard::reset() {
m_AnyPress = false;
m_AnyTrigger = false;
for(unsigned int i = 0; i < m_SYNC.size(); i++) { m_SYNC[i] = 0; }
for(unsigned int i = 0; i < m_States.size(); i++) { m_States[i] = 0; }
}
//------------------------------------------------------------------------------
// ** Keyboard.update()
//------------------------------------------------------------------------------
void Keyboard::update() {
updatePoll();
}
//------------------------------------------------------------------------------
// ** Keyboard.isNonePress()
//------------------------------------------------------------------------------
bool Keyboard::isNonePress() {
return !m_AnyPress;
}
//------------------------------------------------------------------------------
// ** Keyboard.isAnyPress()
//------------------------------------------------------------------------------
bool Keyboard::isAnyPress() {
return m_AnyPress;
}
//------------------------------------------------------------------------------
// ** Keyboard.isAnyTrigger()
//------------------------------------------------------------------------------
bool Keyboard::isAnyTrigger() {
return m_AnyTrigger;
}
//------------------------------------------------------------------------------
// ** Keyboard.isNone(key)
//------------------------------------------------------------------------------
bool Keyboard::isNone(int key) {
return (m_States[key] == KeyState::None);
}
//------------------------------------------------------------------------------
// ** Keyboard.isTrigger(key)
//------------------------------------------------------------------------------
bool Keyboard::isTrigger(int key) {
return (m_States[key] == KeyState::Trigger);
}
//------------------------------------------------------------------------------
// ** Keyboard.isPress(key)
//------------------------------------------------------------------------------
bool Keyboard::isPress(int key) {
return (m_States[key] == KeyState::Press);
}
//------------------------------------------------------------------------------
// ** Keyboard.isRepeat(key)
//------------------------------------------------------------------------------
bool Keyboard::isRepeat(int key) {
return (m_States[key] == KeyState::Repeat);
}
//------------------------------------------------------------------------------
// ** Keyboard.isRelease(key)
//------------------------------------------------------------------------------
bool Keyboard::isRelease(int key) {
return (m_States[key] == KeyState::Release);
}
//------------------------------------------------------------------------------
// ** Keyboard.checkState(key)
//------------------------------------------------------------------------------
int Keyboard::checkState(int key) {
return m_States[key];
}
//------------------------------------------------------------------------------
// ** Keyboard.checkState(key, state)
//------------------------------------------------------------------------------
bool Keyboard::checkState(int key, KeyState state) {
return (m_States[key] == state);
}
//------------------------------------------------------------------------------
// ** Keyboard.checkDir4
//------------------------------------------------------------------------------
bool Keyboard::checkDir4(KeyState state) {
// TODO : Replace '2, 4, 6, 8' with proper enum values...
//if (m_States[2] == state) { return true; }
//if (m_States[4] == state) { return true; }
//if (m_States[6] == state) { return true; }
//if (m_States[8] == state) { return true; }
if (checkState(2, state)) { return true; }
if (checkState(4, state)) { return true; }
if (checkState(6, state)) { return true; }
if (checkState(8, state)) { return true; }
return false;
}
//------------------------------------------------------------------------------
// ** Keyboard.checkDir8
//------------------------------------------------------------------------------
bool Keyboard::checkDir8(KeyState state) {
// TODO : Replace '1, 3, 7, 9' with proper enum values...
//if (m_States[1] == state) { return true; }
//if (m_States[3] == state) { return true; }
//if (m_States[7] == state) { return true; }
//if (m_States[9] == state) { return true; }
if (checkState(2, state)) { return true; }
if (checkState(4, state)) { return true; }
if (checkState(6, state)) { return true; }
if (checkState(8, state)) { return true; }
return checkDir4(state);
}
////////////////////////////////////////////////////////////////////////////////
// ** PRIVATE FUNCTION DECLARATIONS
////////////////////////////////////////////////////////////////////////////////
//------------------------------------------------------------------------------
// ** Keyboard.get(key)
//------------------------------------------------------------------------------
sf::Keyboard::Key Keyboard::get(int key) {
// Branch out by integer key
switch(key) {
// Return integer converted to keyboard key
case 0 : return sf::Keyboard::A;
case 1 : return sf::Keyboard::B;
case 2 : return sf::Keyboard::C;
case 3 : return sf::Keyboard::D;
case 4 : return sf::Keyboard::E;
case 5 : return sf::Keyboard::F;
case 6 : return sf::Keyboard::G;
case 7 : return sf::Keyboard::H;
case 8 : return sf::Keyboard::I;
case 9 : return sf::Keyboard::J;
case 10 : return sf::Keyboard::K;
case 11 : return sf::Keyboard::L;
case 12 : return sf::Keyboard::M;
case 13 : return sf::Keyboard::N;
case 14 : return sf::Keyboard::O;
case 15 : return sf::Keyboard::P;
case 16 : return sf::Keyboard::Q;
case 17 : return sf::Keyboard::R;
case 18 : return sf::Keyboard::S;
case 19 : return sf::Keyboard::T;
case 20 : return sf::Keyboard::U;
case 21 : return sf::Keyboard::V;
case 22 : return sf::Keyboard::W;
case 23 : return sf::Keyboard::X;
case 24 : return sf::Keyboard::Y;
case 25 : return sf::Keyboard::Z;
/*
You'll have to bring in the rest of the keys if this works :o :/ :D
*/
default : return sf::Keyboard::Unknown;
}
}
//------------------------------------------------------------------------------
// ** Keyboard.initASync()
//------------------------------------------------------------------------------
void Keyboard::initASync() {
for(int i = 0; i < 256; i++) { m_SYNC.push_back(0); }
}
//------------------------------------------------------------------------------
// ** Keyboard.initStates()
//------------------------------------------------------------------------------
void Keyboard::initStates() {
for(int i = 0; i < 256; i++) { m_States.push_back(0); }
}
//------------------------------------------------------------------------------
// ** Keyboard.updatePoll()
//------------------------------------------------------------------------------
void Keyboard::updatePoll() {
m_AnyPress = false;
m_AnyTrigger = false;
for(unsigned int i = 0; i < m_States.size(); i++) { updateState(i); }
// NOTES : ^Use this snippet when you're ready to delete all the other
// crap below it.
/* // NOTES : This just prints (and updates state). Delete when finished.
std::cout << "[KEYSTATE DATA]" << std::endl;
for(unsigned int i = 0; i < m_States.size(); i++) {
updateState(i);
std::cout << m_States[i] << ",";
if((i+1) % 64 == 0) { std::cout << std::endl; }
}
// NOTES : This just prints. Delete it when finished.
std::cout << std::endl;
std::cout << "[ASYNC DATA]" << std::endl;
for(unsigned int i = 0; i < m_SYNC.size(); i++) {
std::cout << m_SYNC[i] << ",";
if((i+1) % 64 == 0) { std::cout << std::endl; }
}
std::cout << std::endl;
*/
}
//------------------------------------------------------------------------------
// ** Keyboard.updateState(int)
//------------------------------------------------------------------------------
void Keyboard::updateState(int i) {
/*
// (TEST/PLACEHOLDER) : Delete these (4x) lines later. Forced test values.
bool pressing = ( i== 16 || i == 32 || i == 33);
if (i == 16) {m_SYNC[i] = 1; }
if (i == 32) {m_SYNC[i] = 1; }
if (i == 33) {m_SYNC[i] = 1; }
*/
if (m_Keyboard.isKeyPressed(get(i))) {
// (TEST/PLACEHOLDER) : Replace
//if (pressing) {
m_AnyPress = true;
if (m_SYNC[i] < REPEAT_TIME) { m_SYNC[i]++; }
if (m_SYNC[i] == 1) {
m_AnyTrigger = true;
m_States[i] = KeyState::Trigger;
} else if (m_SYNC[i] > 1 && m_SYNC[i] < REPEAT_TIME) {
m_States[i] = KeyState::Press;
} else if (m_SYNC[i] > REPEAT_TIME) {
m_States[i] = KeyState::Repeat;
}
return;
}
if (m_SYNC[i] > 0) {
m_States[i] = KeyState::Release;
m_SYNC[i] = 0;
return;
}
m_States[i] = KeyState::None;
}
} // end namespace rgl
Other than that, this topic is SOLVED, thank you for all your help!