Skip to content

Commit d7ac73a

Browse files
committed
Move code into new folder. Move libraries into new folder. Make windows build files use directory locations that are relative to the solution directory. Add initial_window_size option to the json parser, update tests accordingly.
1 parent f88a32f commit d7ac73a

File tree

1,045 files changed

+361978
-3357
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,045 files changed

+361978
-3357
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
*.o
2+
Debug
3+
Release
24
main
35
build
46
.vs
@@ -16,3 +18,4 @@ musicVisualizer\.srctrlprj
1618
misc/
1719
\.editorconfig
1820
*shadertoys*
21+
tests/Debug

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[submodule "ffts"]
2-
path = ffts
2+
path = libs/ffts
33
url = https://github.com/xdaimon/ffts.git
44
[submodule "rapidjson"]
5-
path = rapidjson
5+
path = libs/rapidjson
66
url = https://github.com/Tencent/rapidjson.git
77
[submodule "SimpleFileWatcher"]
8-
path = SimpleFileWatcher
8+
path = libs/SimpleFileWatcher
99
url = https://github.com/xdaimon/SimpleFileWatcher.git

CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ set(SOURCE_FILES
1414

1515
include_directories(
1616
.
17-
rapidjson/include/
18-
SimpleFileWatcher/include/
17+
libs/ffts/include/
18+
libs/rapidjson/include/
19+
libs/SimpleFileWatcher/include/
1920
)
2021

21-
add_subdirectory(ffts)
22+
add_subdirectory(libs/ffts)
2223
#add_subdirectory(SimpleFileWatcher)
2324

2425
add_executable(main ${SOURCE_FILES})
2526

2627
LINK_DIRECTORIES(/usr/lib/x86_64-linux-gnu/)
2728

28-
TARGET_LINK_LIBRARIES(main stdc++fs glfw GLEW GLU GL pulse-simple pulse pthread ffts ${CMAKE_SOURCE_DIR}/build/ffts/libffts.a ${CMAKE_SOURCE_DIR}/SimpleFileWatcher/lib/Debug/libSimpleFileWatcher.a)
29-
29+
TARGET_LINK_LIBRARIES(main stdc++fs glfw GLEW GLU GL pulse-simple pulse pthread ffts ${CMAKE_SOURCE_DIR}/libs/ffts/build/ffts/libffts.a ${CMAKE_SOURCE_DIR}/libs/SimpleFileWatcher/lib/Debug/libSimpleFileWatcher.a)
3030

SimpleFileWatcher

Lines changed: 0 additions & 1 deletion
This file was deleted.

ffts

Lines changed: 0 additions & 1 deletion
This file was deleted.

libs/SimpleFileWatcher/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## CUSTOM IGNORES
2+
bin
3+
buildcfg
4+
lib

libs/SimpleFileWatcher/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2009 James Wynn ([email protected])
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

libs/SimpleFileWatcher/README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# FileWatcher
2+
3+
## Description
4+
5+
FileWatcher is a C++ wrapper for OS file monitoring systems. Currently
6+
it uses Win32 ReadDirectoryChangesW for monitoring changes in Windows,
7+
and inotify in linux. OSX is supported via kqueue and directory scans.
8+
9+
10+
## TODO
11+
12+
* Create a pure directory scan based fallback mode.
13+
* Optimize the kqueue implementation.
14+
* Thorough UnitTest
15+
* Add proper Unicode support.
16+
17+
18+
## Compiling
19+
20+
Use premake5 to generate a project for your build system.
21+
22+
23+
## SimpleDemo
24+
25+
To run the demo, create a directory relative to the execution directory
26+
called "test". Start SimpleDemo, then create/change/delete files inside
27+
"test". If "test" does not exist when SimpleDemo starts, it will throw
28+
an exception and exit.
29+
30+
31+
## OgreDemo
32+
33+
Check the OgreDemo directory for an example integration with Ogre.
34+
35+
36+
## Caveats
37+
38+
When some programs write data in Win32, they will generate both an Add,
39+
and a Modify event. This is likely because the program is actually using
40+
two separate calls to write its data.
41+
42+
Because of the time it takes to write the data to the file, it may be
43+
necessary in some cases to wait a few milliseconds after the event to be
44+
able to safely access the file's contents.
45+
46+
47+
## Credits
48+
Originally written by James Wynn
49+
50+
51+
Fixes and Buffered/AsyncFileWatcher by Ian Diaz
52+
53+
54+
James Wynn's original code can be located at:
55+
http://simplefilewatcher.googlecode.com

libs/SimpleFileWatcher/SimpleDemo.cpp

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/**
2+
Demo app for FileWatcher. FileWatcher is a simple wrapper for the file
3+
modification system in Windows and Linux.
4+
5+
@author James Wynn
6+
@date 2/25/2009
7+
8+
Copyright (c) 2009 James Wynn ([email protected])
9+
10+
Permission is hereby granted, free of charge, to any person obtaining a copy
11+
of this software and associated documentation files (the "Software"), to deal
12+
in the Software without restriction, including without limitation the rights
13+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
copies of the Software, and to permit persons to whom the Software is
15+
furnished to do so, subject to the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included in
18+
all copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26+
THE SOFTWARE.
27+
*/
28+
29+
#include <FileWatcher/FileWatcher.h>
30+
#include <iostream>
31+
#include <stdio.h>
32+
33+
/// Processes a file action
34+
class UpdateListener : public FW::FileWatchListener
35+
{
36+
public:
37+
UpdateListener() {}
38+
void handleFileAction(FW::WatchID watchid, const FW::String& dir, const FW::String& filename,
39+
FW::Action action)
40+
{
41+
std::cout << "DIR (" << dir + ") FILE (" + filename + ") has event " << action << std::endl;
42+
}
43+
};
44+
45+
46+
int main(int argc, char **argv)
47+
{
48+
try
49+
{
50+
// create the listener (before the file watcher - so it gets destroyed after the file watcher)
51+
UpdateListener listener;
52+
53+
// create the file watcher object
54+
FW::FileWatcher fileWatcher;
55+
56+
// add a watch to the system
57+
// the file watcher doesn't manage the pointer to the listener - so make sure you don't just
58+
// allocate a listener here and expect the file watcher to manage it - there will be a leak!
59+
FW::WatchID watchID = fileWatcher.addWatch("./test", &listener, true);
60+
61+
std::cout << "Press ^C to exit demo" << std::endl;
62+
63+
// loop until a key is pressed
64+
while(1)
65+
{
66+
fileWatcher.update();
67+
}
68+
}
69+
catch( std::exception& e )
70+
{
71+
fprintf(stderr, "An exception has occurred: %s\n", e.what());
72+
}
73+
74+
return 0;
75+
}

0 commit comments

Comments
 (0)