├── .gitignore
├── AntTweakBar.nim
├── AntTweakBar.nimble
├── cAntTweakBar
├── .gitignore
├── AntTweakBar_Doc.url
├── ChangeLog.txt
├── Clean.bat
├── License.txt
├── Readme.txt
├── examples
│ ├── Examples_VS2008.sln
│ ├── Examples_VS2012.sln
│ ├── Makefile
│ ├── Makefile.osx
│ ├── Readme.txt
│ ├── SDL-1.3.lib
│ ├── SDL.lib
│ ├── TwAdvanced1.cpp
│ ├── TwAdvanced1.vcproj
│ ├── TwAdvanced1.vcxproj
│ ├── TwCopyDLL.vcproj
│ ├── TwCopyDLL.vcxproj
│ ├── TwDualGLUT.c
│ ├── TwDualGLUT.vcproj
│ ├── TwDualGLUT.vcxproj
│ ├── TwGLCoreSDL.c
│ ├── TwGLCoreSDL.vcproj
│ ├── TwGLCoreSDL.vcxproj
│ ├── TwSimpleDX10.cpp
│ ├── TwSimpleDX10.vcproj
│ ├── TwSimpleDX10.vcxproj
│ ├── TwSimpleDX11.cpp
│ ├── TwSimpleDX11.hlsl
│ ├── TwSimpleDX11.vcproj
│ ├── TwSimpleDX11.vcxproj
│ ├── TwSimpleDX9.cpp
│ ├── TwSimpleDX9.vcproj
│ ├── TwSimpleDX9.vcxproj
│ ├── TwSimpleGLFW.c
│ ├── TwSimpleGLFW.vcproj
│ ├── TwSimpleGLFW.vcxproj
│ ├── TwSimpleGLUT.c
│ ├── TwSimpleGLUT.vcproj
│ ├── TwSimpleGLUT.vcxproj
│ ├── TwSimpleSDL.c
│ ├── TwSimpleSDL.vcproj
│ ├── TwSimpleSDL.vcxproj
│ ├── TwSimpleSFML.cpp
│ ├── TwSimpleSFML.vcproj
│ ├── TwString.cpp
│ ├── TwString.vcproj
│ ├── TwString.vcxproj
│ ├── bin32
│ │ ├── GLFW.dll
│ │ ├── Readme.txt
│ │ ├── SDL-1.3.dll
│ │ ├── SDL.dll
│ │ └── glut32.dll
│ ├── bin64
│ │ ├── Readme.txt
│ │ └── glut64.dll
│ ├── d3d10vs2003.h
│ ├── glfw.h
│ ├── glfwdll.lib
│ ├── glut32.lib
│ ├── glut64.lib
│ ├── sfml-graphics-s.lib
│ ├── sfml-system-s.lib
│ └── sfml-window-s.lib
├── include
│ └── AntTweakBar.h
├── lib
│ └── Readme.txt
└── src
│ ├── AntPerfTimer.h
│ ├── AntTweakBar.rc
│ ├── AntTweakBar.vcproj
│ ├── AntTweakBar.vcxproj
│ ├── AntTweakBar.vcxproj.filters
│ ├── AntTweakBar_VS2008.sln
│ ├── AntTweakBar_VS2012.sln
│ ├── LoadOGL.cpp
│ ├── LoadOGL.h
│ ├── LoadOGLCore.cpp
│ ├── LoadOGLCore.h
│ ├── Makefile
│ ├── Makefile.osx
│ ├── MiniGLFW.h
│ ├── MiniGLUT.h
│ ├── MiniSDL12.h
│ ├── MiniSDL13.h
│ ├── MiniSDL20.h
│ ├── MiniSFML16.h
│ ├── Readme.txt
│ ├── TwBar.cpp
│ ├── TwBar.h
│ ├── TwColors.cpp
│ ├── TwColors.h
│ ├── TwDirect3D10.cpp
│ ├── TwDirect3D10.h
│ ├── TwDirect3D11.cpp
│ ├── TwDirect3D11.h
│ ├── TwDirect3D11.hlsl
│ ├── TwDirect3D9.cpp
│ ├── TwDirect3D9.h
│ ├── TwEventGLFW.c
│ ├── TwEventGLUT.c
│ ├── TwEventSDL.c
│ ├── TwEventSDL12.c
│ ├── TwEventSDL13.c
│ ├── TwEventSDL20.c
│ ├── TwEventSFML.cpp
│ ├── TwEventWin.c
│ ├── TwEventX11.c
│ ├── TwFonts.cpp
│ ├── TwFonts.h
│ ├── TwGraph.h
│ ├── TwMgr.cpp
│ ├── TwMgr.h
│ ├── TwOpenGL.cpp
│ ├── TwOpenGL.h
│ ├── TwOpenGLCore.cpp
│ ├── TwOpenGLCore.h
│ ├── TwPrecomp.cpp
│ ├── TwPrecomp.h
│ ├── d3d10vs2003.h
│ ├── res
│ ├── FontChars.txt
│ ├── FontFixed1.pgm
│ ├── FontLargeAA.pgm
│ ├── FontNormal.pgm
│ ├── FontNormalAA.pgm
│ ├── FontSmall.pgm
│ ├── RuFont.txt
│ ├── TwXCursors.h
│ ├── cur00000.cur
│ ├── cur00001.cur
│ ├── cur00002.cur
│ ├── cur00003.cur
│ ├── cur00004.cur
│ ├── cur00005.cur
│ ├── cur00006.cur
│ ├── cur00007.cur
│ ├── cur00008.cur
│ ├── cur00009.cur
│ ├── cur00010.cur
│ ├── cur00011.cur
│ ├── cur00012.cur
│ ├── cur00013.cur
│ ├── curs00.pbm
│ ├── curs01.pbm
│ ├── curs02.pbm
│ ├── curs03.pbm
│ ├── curs04.pbm
│ ├── curs05.pbm
│ ├── curs06.pbm
│ ├── curs07.pbm
│ ├── curs08.pbm
│ ├── curs09.pbm
│ ├── curs10.pbm
│ ├── curs11.pbm
│ ├── curs12.pbm
│ ├── curs13.pbm
│ ├── mask00.pbm
│ ├── mask01.pbm
│ ├── mask02.pbm
│ ├── mask03.pbm
│ ├── mask04.pbm
│ ├── mask05.pbm
│ ├── mask06.pbm
│ ├── mask07.pbm
│ ├── mask08.pbm
│ ├── mask09.pbm
│ ├── mask10.pbm
│ ├── mask11.pbm
│ ├── mask12.pbm
│ └── mask13.pbm
│ └── resource.h
├── readme.md
└── twsimplesdl.nim
/.gitignore:
--------------------------------------------------------------------------------
1 | nimcache/bin/
2 | bin/
3 | nimcache
4 | AntTweakBar
5 | /twsimplesdl
6 |
--------------------------------------------------------------------------------
/AntTweakBar.nimble:
--------------------------------------------------------------------------------
1 | # Package
2 |
3 | version = "1.0.2"
4 | author = "Arne Döring"
5 | description = "nim wrapper around the AntTweakBar c library"
6 | license = "MIT"
7 | installFiles = @[
8 | "AntTweakBar.nim",
9 | "cAntTweakBar/include/AntTweakBar.h",
10 | "cAntTweakBar/src/TwEventGLFW.c",
11 | "cAntTweakBar/src/TwEventGLUT.c",
12 | "cAntTweakBar/src/TwEventSDL12.c",
13 | "cAntTweakBar/src/TwEventSDL13.c",
14 | "cAntTweakBar/src/TwEventSDL20.c",
15 | "cAntTweakBar/src/TwEventSDL.c",
16 | "cAntTweakBar/src/TwEventWin.c",
17 | "cAntTweakBar/src/TwEventX11.c",
18 | "cAntTweakBar/src/AntPerfTimer.h",
19 | "cAntTweakBar/src/d3d10vs2003.h",
20 | "cAntTweakBar/src/LoadOGLCore.h",
21 | "cAntTweakBar/src/LoadOGL.h",
22 | "cAntTweakBar/src/MiniGLFW.h",
23 | "cAntTweakBar/src/MiniGLUT.h",
24 | "cAntTweakBar/src/MiniSDL12.h",
25 | "cAntTweakBar/src/MiniSDL13.h",
26 | "cAntTweakBar/src/MiniSDL20.h",
27 | "cAntTweakBar/src/MiniSFML16.h",
28 | "cAntTweakBar/src/resource.h",
29 | "cAntTweakBar/src/TwBar.h",
30 | "cAntTweakBar/src/TwColors.h",
31 | "cAntTweakBar/src/TwDirect3D10.h",
32 | "cAntTweakBar/src/TwDirect3D11.h",
33 | "cAntTweakBar/src/TwDirect3D9.h",
34 | "cAntTweakBar/src/TwFonts.h",
35 | "cAntTweakBar/src/TwGraph.h",
36 | "cAntTweakBar/src/TwMgr.h",
37 | "cAntTweakBar/src/TwOpenGLCore.h",
38 | "cAntTweakBar/src/TwOpenGL.h",
39 | "cAntTweakBar/src/TwPrecomp.h",
40 | "cAntTweakBar/src/LoadOGLCore.cpp",
41 | "cAntTweakBar/src/LoadOGL.cpp",
42 | "cAntTweakBar/src/TwBar.cpp",
43 | "cAntTweakBar/src/TwColors.cpp",
44 | "cAntTweakBar/src/TwDirect3D10.cpp",
45 | "cAntTweakBar/src/TwDirect3D11.cpp",
46 | "cAntTweakBar/src/TwDirect3D9.cpp",
47 | "cAntTweakBar/src/TwEventSFML.cpp",
48 | "cAntTweakBar/src/TwFonts.cpp",
49 | "cAntTweakBar/src/TwMgr.cpp",
50 | "cAntTweakBar/src/TwOpenGLCore.cpp",
51 | "cAntTweakBar/src/TwOpenGL.cpp",
52 | "cAntTweakBar/src/TwPrecomp.cpp",
53 | "cAntTweakBar/src/res/cur00000.cur",
54 | "cAntTweakBar/src/res/cur00001.cur",
55 | "cAntTweakBar/src/res/cur00002.cur",
56 | "cAntTweakBar/src/res/cur00003.cur",
57 | "cAntTweakBar/src/res/cur00004.cur",
58 | "cAntTweakBar/src/res/cur00005.cur",
59 | "cAntTweakBar/src/res/cur00006.cur",
60 | "cAntTweakBar/src/res/cur00007.cur",
61 | "cAntTweakBar/src/res/cur00008.cur",
62 | "cAntTweakBar/src/res/cur00009.cur",
63 | "cAntTweakBar/src/res/cur00010.cur",
64 | "cAntTweakBar/src/res/cur00011.cur",
65 | "cAntTweakBar/src/res/cur00012.cur",
66 | "cAntTweakBar/src/res/cur00013.cur",
67 | "cAntTweakBar/src/res/curs00.pbm",
68 | "cAntTweakBar/src/res/curs01.pbm",
69 | "cAntTweakBar/src/res/curs02.pbm",
70 | "cAntTweakBar/src/res/curs03.pbm",
71 | "cAntTweakBar/src/res/curs04.pbm",
72 | "cAntTweakBar/src/res/curs05.pbm",
73 | "cAntTweakBar/src/res/curs06.pbm",
74 | "cAntTweakBar/src/res/curs07.pbm",
75 | "cAntTweakBar/src/res/curs08.pbm",
76 | "cAntTweakBar/src/res/curs09.pbm",
77 | "cAntTweakBar/src/res/curs10.pbm",
78 | "cAntTweakBar/src/res/curs11.pbm",
79 | "cAntTweakBar/src/res/curs12.pbm",
80 | "cAntTweakBar/src/res/curs13.pbm",
81 | "cAntTweakBar/src/res/FontChars.txt",
82 | "cAntTweakBar/src/res/FontFixed1.pgm",
83 | "cAntTweakBar/src/res/FontLargeAA.pgm",
84 | "cAntTweakBar/src/res/FontNormalAA.pgm",
85 | "cAntTweakBar/src/res/FontNormal.pgm",
86 | "cAntTweakBar/src/res/FontSmall.pgm",
87 | "cAntTweakBar/src/res/mask00.pbm",
88 | "cAntTweakBar/src/res/mask01.pbm",
89 | "cAntTweakBar/src/res/mask02.pbm",
90 | "cAntTweakBar/src/res/mask03.pbm",
91 | "cAntTweakBar/src/res/mask04.pbm",
92 | "cAntTweakBar/src/res/mask05.pbm",
93 | "cAntTweakBar/src/res/mask06.pbm",
94 | "cAntTweakBar/src/res/mask07.pbm",
95 | "cAntTweakBar/src/res/mask08.pbm",
96 | "cAntTweakBar/src/res/mask09.pbm",
97 | "cAntTweakBar/src/res/mask10.pbm",
98 | "cAntTweakBar/src/res/mask11.pbm",
99 | "cAntTweakBar/src/res/mask12.pbm",
100 | "cAntTweakBar/src/res/mask13.pbm",
101 | "cAntTweakBar/src/res/RuFont.txt",
102 | "cAntTweakBar/src/res/TwXCursors.h"
103 | ]
104 | # Dependencies
105 |
106 | requires "nim >= 0.12.0"
107 |
--------------------------------------------------------------------------------
/cAntTweakBar/.gitignore:
--------------------------------------------------------------------------------
1 | *.[oa]
2 | *~
3 | *.ncb
4 | *.sdf
5 | *.suo
6 | *.user
7 | *.asp
8 | *.pch
9 | /src/debug32
10 | /src/debug64
11 | /src/release32
12 | /src/release64
13 | /src/ipch
14 | /examples/debug32
15 | /examples/debug64
16 | /examples/tmp
17 | /examples/bin32/*.exe
18 | /examples/bin32/*.out
19 | /examples/bin32/AntTweakBar.dll
20 | /examples/bin64/*.exe
21 | /examples/bin64/*.out
22 | /examples/bin64/AntTweakBar64.dll
23 | lib/debug
24 | lib/*.lib
25 | lib/*.dll
26 | lib/*.exp
27 | lib/*.so
28 | lib/*.so.*
29 |
--------------------------------------------------------------------------------
/cAntTweakBar/AntTweakBar_Doc.url:
--------------------------------------------------------------------------------
1 | [InternetShortcut]
2 | URL=http://anttweakbar.sourceforge.net/doc
3 | Modified=C043A0DCA0FFC801E7
4 | HotKey=0
5 | IDList=
6 | [{000214A0-0000-0000-C000-000000000046}]
7 | Prop3=19,2
8 |
--------------------------------------------------------------------------------
/cAntTweakBar/Clean.bat:
--------------------------------------------------------------------------------
1 | RMDIR /S /Q src\debug32
2 | RMDIR /S /Q src\debug64
3 | RMDIR /S /Q src\release32
4 | RMDIR /S /Q src\release64
5 | RMDIR /S /Q src\ipch
6 | CD src
7 | DEL *.ncb *.aps *.o *.bak *.user *.sdf
8 | DEL /A:h *.suo
9 | CD ..
10 | RMDIR /S /Q lib\debug
11 | RMDIR /S /Q examples\debug32
12 | RMDIR /S /Q examples\debug64
13 | RMDIR /S /Q examples\tmp
14 | DEL lib\*.exp
15 | CD examples
16 | DEL *.ncb *.aps *.o *.bak *.user *.sdf
17 | DEL /A:h *.suo
18 | DEL /S BuildLog.htm
19 | CD ..
20 |
21 | PAUSE
22 |
23 |
24 |
--------------------------------------------------------------------------------
/cAntTweakBar/License.txt:
--------------------------------------------------------------------------------
1 | --- AntTweakBar license ---
2 |
3 | Copyright (C) 2005-2013 Philippe Decaudin
4 |
5 | This software is provided 'as-is', without any express or implied warranty.
6 | In no event will the authors be held liable for any damages arising from the
7 | use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose, including
10 | commercial applications, and to alter it and redistribute it freely, subject to
11 | the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not claim
14 | that you wrote the original software. If you use this software in a product,
15 | an acknowledgment in the product documentation would be appreciated but is not
16 | required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source distribution.
22 |
23 |
--------------------------------------------------------------------------------
/cAntTweakBar/Readme.txt:
--------------------------------------------------------------------------------
1 | AntTweakBar development library
2 | -------------------------------
3 |
4 |
5 | AntTweakBar is a small and easy-to-use C/C++ library that allows programmers
6 | to quickly add a light and intuitive GUI into OpenGL and DirectX based
7 | graphic programs to interactively tweak parameters.
8 |
9 | This package includes the development version of the AntTweakBar library
10 | for Windows, GNU/Linux and OSX, and some program examples (sources + binaries).
11 |
12 | For installation and documentation please refer to:
13 | http://anttweakbar.sourceforge.net/doc
14 |
15 |
16 |
--------------------------------------------------------------------------------
/cAntTweakBar/examples/Makefile:
--------------------------------------------------------------------------------
1 | ####### Compiler, tools and options
2 |
3 |
4 | #---- Release
5 | CXXCFG = -O3
6 | LFLAGS = -L../lib
7 | OUT_DIR = bin64
8 | #---- Debug
9 | #CXXCFG = -g -D_DEBUG
10 | #LFLAGS = -Wl -L../lib/debug64
11 | #OUT_DIR = debug64
12 |
13 |
14 | CXX = g++
15 | CXXFLAGS = $(CXXCFG) -Wall -fno-strict-aliasing
16 | INCPATH = -I../include -I/usr/local/include -I/usr/X11R6/include -I/usr/include
17 | LIBS = -L/usr/X11R6/lib -lAntTweakBar -lGL -lGLU -lX11 -lXext -lXmu -lXrandr -lpthread -lm
18 |
19 | DEL_FILE = rm -f
20 | DEL_DIR = rmdir
21 | NO_STDERR = 2> /dev/null
22 | EXP_SH = '\#!/bin/sh'
23 | EXP_PATH = 'export LD_LIBRARY_PATH=`dirname $$0`/../../lib ; $$0.out'
24 |
25 | ####### Files
26 |
27 |
28 | SRC_FILES = TwSimpleGLFW.c TwSimpleGLUT.c TwSimpleSDL.c TwAdvanced1.cpp TwString.cpp TwDualGLUT.c
29 |
30 |
31 | ####### Build rules
32 |
33 |
34 | #first: depend all
35 | first: all
36 |
37 | all: Makefile $(SRC_FILES)
38 |
39 | @echo "===== Build TwSimpleGLUT ===="
40 | $(CXX) $(CXXFLAGS) $(INCPATH) TwSimpleGLUT.c $(LFLAGS) -lglut $(LIBS) -o $(OUT_DIR)/TwSimpleGLUT.out
41 | @echo $(EXP_SH) > $(OUT_DIR)/TwSimpleGLUT
42 | @echo $(EXP_PATH) >> $(OUT_DIR)/TwSimpleGLUT
43 | @chmod +x $(OUT_DIR)/TwSimpleGLUT
44 | @echo "To execute the example, run " $(OUT_DIR)/TwSimpleGLUT
45 |
46 | @echo "===== Build TwSimpleSDL ===="
47 | $(CXX) $(CXXFLAGS) $(INCPATH) TwSimpleSDL.c $(LFLAGS) -lSDL $(LIBS) -o $(OUT_DIR)/TwSimpleSDL.out
48 | @echo $(EXP_SH) > $(OUT_DIR)/TwSimpleSDL
49 | @echo $(EXP_PATH) >> $(OUT_DIR)/TwSimpleSDL
50 | @chmod +x $(OUT_DIR)/TwSimpleSDL
51 | @echo "To execute the example, run " $(OUT_DIR)/TwSimpleSDL
52 |
53 | @echo "===== Build TwSimpleGLFW ===="
54 | $(CXX) $(CXXFLAGS) $(INCPATH) TwSimpleGLFW.c $(LFLAGS) -lglfw $(LIBS) -o $(OUT_DIR)/TwSimpleGLFW.out
55 | @echo $(EXP_SH) > $(OUT_DIR)/TwSimpleGLFW
56 | @echo $(EXP_PATH) >> $(OUT_DIR)/TwSimpleGLFW
57 | @chmod +x $(OUT_DIR)/TwSimpleGLFW
58 | @echo "To execute the example, run " $(OUT_DIR)/TwSimpleGLFW
59 |
60 | @echo "===== Build TwDualGLUT ===="
61 | $(CXX) $(CXXFLAGS) $(INCPATH) TwDualGLUT.c $(LFLAGS) -lglut $(LIBS) -o $(OUT_DIR)/TwDualGLUT.out
62 | @echo $(EXP_SH) > $(OUT_DIR)/TwDualGLUT
63 | @echo $(EXP_PATH) >> $(OUT_DIR)/TwDualGLUT
64 | @chmod +x $(OUT_DIR)/TwDualGLUT
65 | @echo "To execute the example, run " $(OUT_DIR)/TwDualGLUT
66 |
67 | @echo "===== Build TwAdvanced1 ===="
68 | $(CXX) $(CXXFLAGS) $(INCPATH) TwAdvanced1.cpp $(LFLAGS) -lglfw $(LIBS) -o $(OUT_DIR)/TwAdvanced1.out
69 | @echo $(EXP_SH) > $(OUT_DIR)/TwAdvanced1
70 | @echo $(EXP_PATH) >> $(OUT_DIR)/TwAdvanced1
71 | @chmod +x $(OUT_DIR)/TwAdvanced1
72 | @echo "To execute the example, run " $(OUT_DIR)/TwAdvanced1
73 |
74 | @echo "===== Build TwString ===="
75 | $(CXX) $(CXXFLAGS) $(INCPATH) TwString.cpp $(LFLAGS) -lglut $(LIBS) -o $(OUT_DIR)/TwString.out
76 | @echo $(EXP_SH) > $(OUT_DIR)/TwString
77 | @echo $(EXP_PATH) >> $(OUT_DIR)/TwString
78 | @chmod +x $(OUT_DIR)/TwString
79 | @echo "To execute the example, run " $(OUT_DIR)/TwString
80 |
81 | # append dependencies to this Makefile
82 | #depend:
83 | # @echo "===== Make dependencies ====="
84 | # makedepend -Y
85 | # makedepend -a -Y -- $(CXXFLAGS) $(INCPATH) -- $(SRC_FILES) $(NO_STDERR)
86 |
87 |
88 | # clean temporary files
89 | clean:
90 | @echo "===== Clean ====="
91 | -$(DEL_FILE) *.o
92 | -$(DEL_FILE) *~ core *.core *.stackdump
93 | -$(DEL_FILE) debug64/*
94 | -$(DEL_DIR) debug64
95 |
96 |
97 | ####### DEPENDENCIES
98 |
99 | TwSimpleGLFW.o: ../include/AntTweakBar.h
100 | TwSimpleGLUT.o: ../include/AntTweakBar.h
101 | TwDualGLUT.o: ../include/AntTweakBar.h
102 | TwSimpleSDL.o: ../include/AntTweakBar.h
103 | TwAdvanced1.o: ../include/AntTweakBar.h
104 | TwString.o: ../include/AntTweakBar.h
105 |
--------------------------------------------------------------------------------
/cAntTweakBar/examples/Makefile.osx:
--------------------------------------------------------------------------------
1 | ####### Compiler, tools and options
2 |
3 |
4 | #---- Release
5 | CXXCFG = -O3
6 | LFLAGS = -L../lib
7 | OUT_DIR = bin64
8 | #---- Debug
9 | #CXXCFG = -g -D_DEBUG
10 | #LFLAGS = -Wl -L../lib/debug64
11 | #OUT_DIR = debug64
12 |
13 |
14 | #BASE = /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks
15 | CXX = g++
16 | CXXFLAGS = $(CXXCFG) -Wall -fno-strict-aliasing -D_MACOSX
17 | INCPATH = -I../include -I/usr/local/include -I/usr/X11R6/include -I/usr/include
18 | #-I$(BASE)/OpenGL.framework/Headers/ -I$(BASE)/AppKit.framework/Headers/
19 |
20 | LIBS = ../lib/libAntTweakBar.dylib -lpthread -lm -framework AppKit -framework OpenGL
21 |
22 | DEL_FILE = rm -f
23 | DEL_DIR = rmdir
24 | NO_STDERR = 2> /dev/null
25 | EXP_PATH = 'export DYLD_LIBRARY_PATH=`dirname $$0`/../../lib ; $$0.out'
26 |
27 |
28 | ####### Files
29 |
30 |
31 | SRC_FILES = TwSimpleGLUT.c TwSimpleSDL.c TwSimpleGLFW.c TwAdvanced1.cpp TwString.cpp TwDualGLUT.c TwGLCoreSDL.c
32 |
33 |
34 | ####### Build rules
35 |
36 |
37 | #first: depend all
38 | first: all
39 |
40 | all: Makefile $(SRC_FILES)
41 |
42 | @echo "===== Build TwSimpleGLUT ===="
43 | $(CXX) $(CXXFLAGS) $(INCPATH) -I$(BASE)/GLUT.framework/Headers/ TwSimpleGLUT.c $(LFLAGS) $(LIBS) -framework GLUT -o $(OUT_DIR)/TwSimpleGLUT.out
44 | @echo $(EXP_PATH) > $(OUT_DIR)/TwSimpleGLUT
45 | @chmod +x $(OUT_DIR)/TwSimpleGLUT
46 | @echo "To execute the example, run " $(OUT_DIR)/TwSimpleGLUT
47 |
48 | @echo "===== Build TwDualGLUT ===="
49 | $(CXX) $(CXXFLAGS) $(INCPATH) -I$(BASE)/GLUT.framework/Headers/ TwDualGLUT.c $(LFLAGS) $(LIBS) -framework GLUT -o $(OUT_DIR)/TwDualGLUT.out
50 | @echo $(EXP_PATH) > $(OUT_DIR)/TwDualGLUT
51 | @chmod +x $(OUT_DIR)/TwDualGLUT
52 | @echo "To execute the example, run " $(OUT_DIR)/TwDualGLUT
53 |
54 | @echo "===== Build TwString ===="
55 | $(CXX) $(CXXFLAGS) $(INCPATH) -I$(BASE)/GLUT.framework/Headers/ TwString.cpp $(LFLAGS) $(LIBS) -framework GLUT -o $(OUT_DIR)/TwString.out
56 | @echo $(EXP_PATH) > $(OUT_DIR)/TwString
57 | @chmod +x $(OUT_DIR)/TwString
58 | @echo "To execute the example, run " $(OUT_DIR)/TwString
59 |
60 | # @echo "===== Build TwSimpleSDL ===="
61 | # $(CXX) $(CXXFLAGS) $(INCPATH) -I$(BASE)/SDL.framework/Headers/ TwSimpleSDL.c $(LFLAGS) -framework SDL $(LIBS) -o $(OUT_DIR)/TwSimpleSDL.out
62 | # @echo $(EXP_PATH) > $(OUT_DIR)/TwSimpleSDL
63 | # @chmod +x $(OUT_DIR)/TwSimpleSDL
64 |
65 | # @echo "===== Build TwSimpleGLFW ===="
66 | # $(CXX) $(CXXFLAGS) $(INCPATH) TwSimpleGLFW.c $(LFLAGS) -lglfw -framework AGL -framework Carbon $(LIBS) -o $(OUT_DIR)/TwSimpleGLFW.out
67 | # @echo $(EXP_PATH) > $(OUT_DIR)/TwSimpleGLFW
68 | # @chmod +x $(OUT_DIR)/TwSimpleGLFW
69 |
70 | # @echo "===== Build TwAdvanced1 ===="
71 | # $(CXX) $(CXXFLAGS) $(INCPATH) TwAdvanced1.cpp $(LFLAGS) -lglfw -framework AGL -framework Carbon $(LIBS) -o $(OUT_DIR)/TwAdvanced1.out
72 | # @echo $(EXP_PATH) > $(OUT_DIR)/TwAdvanced1
73 | # @chmod +x $(OUT_DIR)/TwSimpleAdvanced1
74 |
75 |
76 | # append dependencies to this Makefile
77 | #depend:
78 | # @echo "===== Make dependencies ====="
79 | # makedepend -Y
80 | # makedepend -a -Y -- $(CXXFLAGS) $(INCPATH) -- $(SRC_FILES) $(NO_STDERR)
81 |
82 |
83 | # clean temporary files
84 | clean:
85 | @echo "===== Clean ====="
86 | -$(DEL_FILE) *.o
87 | -$(DEL_FILE) *~ core *.core *.stackdump
88 | -$(DEL_FILE) debug64/*
89 | -$(DEL_DIR) debug64
90 |
91 |
92 | ####### DEPENDENCIES
93 |
94 | TwSimpleGLFW.o: ../include/AntTweakBar.h
95 | TwSimpleGLUT.o: ../include/AntTweakBar.h
96 | TwDualGLUT.o: ../include/AntTweakBar.h
97 | TwSimpleSDL.o: ../include/AntTweakBar.h
98 | TwAdvanced1.o: ../include/AntTweakBar.h
99 | TwString.o: ../include/AntTweakBar.h
100 | TwGLCoreSDL.o: ../include/AntTweakBar.h
101 |
--------------------------------------------------------------------------------
/cAntTweakBar/examples/Readme.txt:
--------------------------------------------------------------------------------
1 | Compiled versions of the examples for 32-bit and 64-bit systems can be found in
2 | the examples/bin32 and examples/bin64 directories.
3 |
4 | Under GNU/Linux and OSX, you may need to rebuild the library and the examples.
5 | To do so, under GNU/Linux, open a terminal, go in the src directory and type
6 | make, then go in the examples directory and type make. Under OSX do the same
7 | but type make -f Makefile.osx instead of make.
8 |
9 | To recompile the examples you also need the following external libraries
10 | (for convenience Windows versions are included in the examples directory).
11 |
12 | - GLFW : http://www.glfw.org
13 |
14 | - GLUT : http://opengl.org/resources/libraries/glut
15 | the windows version can be found at
16 | http://www.xmission.com/~nate/glut.html
17 |
18 | - SDL : http://www.libsdl.org
19 |
20 | - SFML : http://www.sfml-dev.org
21 |
22 | - DirectX SDK if you want to recompile the Windows library & DX examples
23 | http://msdn.microsoft.com/directx
24 | The path to the DirectX shader compiler fxc.exe (included in the DirectX SDK)
25 | must be listed in the VC++ directories.
26 |
27 |
--------------------------------------------------------------------------------
/cAntTweakBar/examples/SDL-1.3.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/krux02/nimAntTweakBar/5edfe9a0c019674dba3260dc6b112611d6619c5b/cAntTweakBar/examples/SDL-1.3.lib
--------------------------------------------------------------------------------
/cAntTweakBar/examples/SDL.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/krux02/nimAntTweakBar/5edfe9a0c019674dba3260dc6b112611d6619c5b/cAntTweakBar/examples/SDL.lib
--------------------------------------------------------------------------------
/cAntTweakBar/examples/TwCopyDLL.vcproj:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
14 |
17 |
18 |
19 |
20 |
21 |
29 |
33 |
36 |
39 |
42 |
43 |
51 |
55 |
58 |
62 |
65 |
66 |
74 |
78 |
81 |
84 |
87 |
88 |
96 |
100 |
103 |
107 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/cAntTweakBar/examples/TwCopyDLL.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Debug
10 | x64
11 |
12 |
13 | Release
14 | Win32
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | {AB180E0E-0EFA-4AD4-8F08-4492D144D963}
23 | Win32Proj
24 |
25 |
26 |
27 | Utility
28 | v110
29 | MultiByte
30 |
31 |
32 | Utility
33 | v110
34 | MultiByte
35 |
36 |
37 | Utility
38 | v110
39 | MultiByte
40 |
41 |
42 | Utility
43 | v110
44 | MultiByte
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | <_ProjectFileVersion>11.0.50727.1
68 |
69 |
70 | debug32\
71 | tmp\debug32\
72 |
73 |
74 | debug64\
75 | tmp\debug64\
76 |
77 |
78 | bin32\
79 | tmp\bin32\
80 |
81 |
82 | bin64\
83 | tmp\bin64\
84 |
85 |
86 |
87 | if exist ..\lib\debug\AntTweakBar.dll ( xcopy /y /f ..\lib\debug\AntTweakBar.dll debug32 ) else ( xcopy /y /f ..\lib\AntTweakBar.dll debug32 )
88 |
89 |
90 |
91 |
92 |
93 | if exist ..\lib\debug\AntTweakBar64.dll ( xcopy /y /f ..\lib\debug\AntTweakBar64.dll debug64 ) else ( xcopy /y /f ..\lib\AntTweakBar64.dll debug64 )
94 |
95 |
96 |
97 | X64
98 |
99 |
100 |
101 |
102 | xcopy /y /f ..\lib\AntTweakBar.dll bin32
103 |
104 |
105 |
106 |
107 | xcopy /y /f ..\lib\AntTweakBar64.dll bin64
108 |
109 |
110 | X64
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/cAntTweakBar/examples/TwSimpleDX11.hlsl:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwSimpleDX11.hlsl
4 | // @brief Shaders used by the TwSimpleDX11 example
5 | //
6 | // ---------------------------------------------------------------------------
7 |
8 | cbuffer Constants : register(b0)
9 | {
10 | row_major float4x4 g_WorldViewProj;
11 | row_major float4x4 g_WorldNorm;
12 | float3 g_LightDir;
13 | float g_LightCoeff;
14 | };
15 |
16 | struct PSInput
17 | {
18 | float4 Pos : SV_POSITION;
19 | float4 Color : COLOR0;
20 | };
21 |
22 | PSInput MainVS(float4 pos : POSITION, float3 norm : NORMAL, float4 color : COLOR)
23 | {
24 | PSInput ps;
25 | ps.Pos = mul(pos, g_WorldViewProj);
26 | float3 n = normalize(mul(float4(norm, 0), g_WorldNorm).xyz);
27 | ps.Color.rgb = color.rgb * ((1 - g_LightCoeff) + g_LightCoeff * dot(n, -g_LightDir));
28 | ps.Color.a = color.a;
29 | return ps;
30 | }
31 |
32 | float4 MainPS(PSInput input) : SV_TARGET
33 | {
34 | return input.Color;
35 | }
36 |
--------------------------------------------------------------------------------
/cAntTweakBar/examples/bin32/GLFW.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/krux02/nimAntTweakBar/5edfe9a0c019674dba3260dc6b112611d6619c5b/cAntTweakBar/examples/bin32/GLFW.dll
--------------------------------------------------------------------------------
/cAntTweakBar/examples/bin32/Readme.txt:
--------------------------------------------------------------------------------
1 |
2 | This directory contains binaries of integration examples of the AntTweakBar
3 | library with some common windowing toolkits, so that you can directly try
4 | the library. GNU/Linux and OSX examples require recompilation depending on your
5 | configuration.
6 |
7 | Files with .exe extension are Windows versions.
8 | Files without extension are GNU/Linux versions (they run the .out files)
9 |
10 |
11 | ---
12 |
13 |
14 | License & copyright notices
15 |
16 |
17 | - AntTweakBar
18 |
19 | AntTweakBar.dll and Tw* files are part of the AntTweakBar library.
20 | hhttp://anttweakbar.sourceforge.net/doc
21 |
22 | AntTweakBar is a free software released under the zlib license.
23 | For conditions of distribution and use, see ../../License.txt
24 |
25 |
26 | - glfw.dll
27 |
28 | GLFW is licensed under the zlib/libpng license:
29 | http://www.glfw.org/license.html
30 |
31 |
32 | - SDL.dll / SDL-1.3.dll
33 |
34 | SDL (http://www.libsdl.org):
35 |
36 | This library is distributed under the terms of the GNU LGPL license:
37 | http://www.gnu.org/copyleft/lesser.html
38 |
39 |
40 | - glut32.dll / glut64.dll
41 |
42 | GLUT (http://opengl.org/resources/libraries/glut):
43 |
44 | The OpenGL Utility Toolkit distribution for Win32 (Windows NT & Windows 95)
45 | contains source code modified from the original source code for GLUT
46 | version 3.3 which was developed by Mark J. Kilgard. The original source code
47 | for GLUT is Copyright 1997 by Mark J. Kilgard. GLUT for Win32 is Copyright 1997
48 | by Nate Robins and is not in the public domain, but it is freely
49 | distributable without licensing fees. It is provided without guarantee or
50 | warrantee expressed or implied. It was ported with the permission of
51 | Mark J. Kilgard by Nate Robins. 64-bits support by Alexander Reshetov.
52 |
53 |
54 | - SFML
55 |
56 | This library is distributed under the terms of the zlib/libpng license:
57 | http://www.sfml-dev.org/license.php
58 |
--------------------------------------------------------------------------------
/cAntTweakBar/examples/bin32/SDL-1.3.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/krux02/nimAntTweakBar/5edfe9a0c019674dba3260dc6b112611d6619c5b/cAntTweakBar/examples/bin32/SDL-1.3.dll
--------------------------------------------------------------------------------
/cAntTweakBar/examples/bin32/SDL.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/krux02/nimAntTweakBar/5edfe9a0c019674dba3260dc6b112611d6619c5b/cAntTweakBar/examples/bin32/SDL.dll
--------------------------------------------------------------------------------
/cAntTweakBar/examples/bin32/glut32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/krux02/nimAntTweakBar/5edfe9a0c019674dba3260dc6b112611d6619c5b/cAntTweakBar/examples/bin32/glut32.dll
--------------------------------------------------------------------------------
/cAntTweakBar/examples/bin64/Readme.txt:
--------------------------------------------------------------------------------
1 |
2 | This directory contains binaries of integration examples of the AntTweakBar
3 | library with some common windowing toolkits, so that you can directly try
4 | the library. GNU/Linux and OSX examples require recompilation depending on your
5 | configuration.
6 |
7 | Files with .exe extension are Windows versions.
8 | Files without extension are GNU/Linux versions (they run the .out files)
9 |
10 |
11 | ---
12 |
13 |
14 | License & copyright notices
15 |
16 |
17 | - AntTweakBar
18 |
19 | AntTweakBar.dll and Tw* files are part of the AntTweakBar library.
20 | http://anttweakbar.sourceforge.net/doc
21 |
22 | AntTweakBar is a free software released under the zlib license.
23 | For conditions of distribution and use, see ../../License.txt
24 |
25 |
26 | - glfw.dll
27 |
28 | GLFW is licensed under the zlib/libpng license:
29 | http://www.glfw.org/license.html
30 |
31 |
32 | - SDL.dll / SDL-1.3.dll
33 |
34 | SDL (http://www.libsdl.org):
35 |
36 | This library is distributed under the terms of the GNU LGPL license:
37 | http://www.gnu.org/copyleft/lesser.html
38 |
39 |
40 | - glut32.dll / glut64.dll
41 |
42 | GLUT (http://opengl.org/resources/libraries/glut):
43 |
44 | The OpenGL Utility Toolkit distribution for Win32 (Windows NT & Windows 95)
45 | contains source code modified from the original source code for GLUT
46 | version 3.3 which was developed by Mark J. Kilgard. The original source code
47 | for GLUT is Copyright 1997 by Mark J. Kilgard. GLUT for Win32 is Copyright 1997
48 | by Nate Robins and is not in the public domain, but it is freely
49 | distributable without licensing fees. It is provided without guarantee or
50 | warrantee expressed or implied. It was ported with the permission of
51 | Mark J. Kilgard by Nate Robins. 64-bits support by Alexander Reshetov.
52 |
53 |
54 | - SFML
55 |
56 | This library is distributed under the terms of the zlib/libpng license:
57 | http://www.sfml-dev.org/license.php
58 |
--------------------------------------------------------------------------------
/cAntTweakBar/examples/bin64/glut64.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/krux02/nimAntTweakBar/5edfe9a0c019674dba3260dc6b112611d6619c5b/cAntTweakBar/examples/bin64/glut64.dll
--------------------------------------------------------------------------------
/cAntTweakBar/examples/d3d10vs2003.h:
--------------------------------------------------------------------------------
1 | // Workaround to include D3D10.h with VS2003
2 | #ifndef __out
3 | #define __out
4 | #endif
5 | #ifndef __in
6 | #define __in
7 | #endif
8 | #ifndef __inout
9 | #define __inout
10 | #endif
11 | #ifndef __in_opt
12 | #define __in_opt
13 | #endif
14 | #ifndef __out_opt
15 | #define __out_opt
16 | #endif
17 | #ifndef __inout_opt
18 | #define __inout_opt
19 | #endif
20 | #ifndef __in_ecount
21 | #define __in_ecount(x)
22 | #endif
23 | #ifndef __in_ecount_opt
24 | #define __in_ecount_opt(x)
25 | #endif
26 | #ifndef __out_ecount
27 | #define __out_ecount(x)
28 | #endif
29 | #ifndef __out_ecount_opt
30 | #define __out_ecount_opt(x)
31 | #endif
32 | #ifndef __inout_ecount
33 | #define __inout_ecount(x)
34 | #endif
35 | #ifndef __inout_ecount_opt
36 | #define __inout_ecount_opt(x)
37 | #endif
38 | #ifndef __in_bcount_opt
39 | #define __in_bcount_opt(x)
40 | #endif
41 | #ifndef __out_bcount_opt
42 | #define __out_bcount_opt(x)
43 | #endif
44 | #ifndef __inout_bcount_opt
45 | #define __inout_bcount_opt(x)
46 | #endif
47 |
--------------------------------------------------------------------------------
/cAntTweakBar/examples/glfwdll.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/krux02/nimAntTweakBar/5edfe9a0c019674dba3260dc6b112611d6619c5b/cAntTweakBar/examples/glfwdll.lib
--------------------------------------------------------------------------------
/cAntTweakBar/examples/glut32.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/krux02/nimAntTweakBar/5edfe9a0c019674dba3260dc6b112611d6619c5b/cAntTweakBar/examples/glut32.lib
--------------------------------------------------------------------------------
/cAntTweakBar/examples/glut64.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/krux02/nimAntTweakBar/5edfe9a0c019674dba3260dc6b112611d6619c5b/cAntTweakBar/examples/glut64.lib
--------------------------------------------------------------------------------
/cAntTweakBar/examples/sfml-graphics-s.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/krux02/nimAntTweakBar/5edfe9a0c019674dba3260dc6b112611d6619c5b/cAntTweakBar/examples/sfml-graphics-s.lib
--------------------------------------------------------------------------------
/cAntTweakBar/examples/sfml-system-s.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/krux02/nimAntTweakBar/5edfe9a0c019674dba3260dc6b112611d6619c5b/cAntTweakBar/examples/sfml-system-s.lib
--------------------------------------------------------------------------------
/cAntTweakBar/examples/sfml-window-s.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/krux02/nimAntTweakBar/5edfe9a0c019674dba3260dc6b112611d6619c5b/cAntTweakBar/examples/sfml-window-s.lib
--------------------------------------------------------------------------------
/cAntTweakBar/lib/Readme.txt:
--------------------------------------------------------------------------------
1 | These files are part of the AntTweakBar library.
2 | http://anttweakbar.sourceforge.net/doc
3 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/AntPerfTimer.h:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file AntPerfTimer.h
4 | // @brief A performance (precision) timer for benchs
5 | // @author Philippe Decaudin
6 | // @license This file is part of the AntTweakBar library.
7 | // For conditions of distribution and use, see License.txt
8 | //
9 | // note: No cpp file is needed, everything is defined in this header
10 | //
11 | // ---------------------------------------------------------------------------
12 |
13 | #if !defined ANT_PERF_TIMER_INCLUDED
14 | #define ANT_PERF_TIMER_INCLUDED
15 |
16 | #ifndef __cplusplus
17 | # error This is a C++ header
18 | #endif // __cplusplus
19 |
20 |
21 | #if defined(WIN32) || defined(WIN64) || defined(_WIN32) || defined(_WIN64)
22 |
23 | #include
24 | #include
25 |
26 | struct PerfTimer
27 | {
28 | inline PerfTimer() { if( !QueryPerformanceFrequency(&Freq) ) MessageBox(NULL, _T("Precision timer not supported"), _T("Problem"), MB_ICONEXCLAMATION); Reset(); }
29 | inline void Reset() { QueryPerformanceCounter(&Start); }
30 | inline double GetTime() { if( QueryPerformanceCounter(&End) ) return ((double)End.QuadPart - (double)Start.QuadPart)/((double)Freq.QuadPart); else return 0; }
31 | protected:
32 | LARGE_INTEGER Start, End, Freq;
33 | };
34 |
35 | #else // !_WIN (-> LINUX)
36 |
37 | #include
38 | #include
39 |
40 | struct PerfTimer
41 | {
42 | inline PerfTimer() { Reset(); }
43 | inline void Reset() { gettimeofday(&Start, &TZ); }
44 | inline double GetTime() { gettimeofday(&End,&TZ);
45 | double t1 = (double)Start.tv_sec + (double)Start.tv_usec/(1000*1000);
46 | double t2 = (double)End.tv_sec + (double)End.tv_usec/(1000*1000);
47 | return t2-t1; }
48 | protected:
49 | struct timeval Start, End;
50 | struct timezone TZ;
51 | };
52 |
53 | #endif // _WIN
54 |
55 |
56 | #endif // ANT_PERF_TIMER_INCLUDED
57 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/AntTweakBar.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/krux02/nimAntTweakBar/5edfe9a0c019674dba3260dc6b112611d6619c5b/cAntTweakBar/src/AntTweakBar.rc
--------------------------------------------------------------------------------
/cAntTweakBar/src/AntTweakBar.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {f83ca079-8ea0-4739-a811-1271c1da7b99}
6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat
7 |
8 |
9 | {9fa95835-d0ac-461f-9e15-970d83af4629}
10 | h;hpp;hxx;hm;inl
11 |
12 |
13 | {87a5b5f8-eb1d-4589-96fd-f8e516fc15e7}
14 |
15 |
16 | {d4d938bf-b5f6-43d3-896f-a3fff1885877}
17 |
18 |
19 |
20 |
21 | Source Files
22 |
23 |
24 | Source Files
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files
31 |
32 |
33 | Source Files
34 |
35 |
36 | Source Files
37 |
38 |
39 | Source Files
40 |
41 |
42 | Source Files
43 |
44 |
45 | Source Files
46 |
47 |
48 | Source Files
49 |
50 |
51 | Source Files
52 |
53 |
54 | Source Files
55 |
56 |
57 | Source Files
58 |
59 |
60 | Source Files
61 |
62 |
63 | Source Files
64 |
65 |
66 | Source Files
67 |
68 |
69 | Source Files
70 |
71 |
72 | Source Files
73 |
74 |
75 | Source Files
76 |
77 |
78 |
79 |
80 | Public Header Files
81 |
82 |
83 | Private Header Files
84 |
85 |
86 | Private Header Files
87 |
88 |
89 | Private Header Files
90 |
91 |
92 | Private Header Files
93 |
94 |
95 | Private Header Files
96 |
97 |
98 | Private Header Files
99 |
100 |
101 | Private Header Files
102 |
103 |
104 | Private Header Files
105 |
106 |
107 | Private Header Files
108 |
109 |
110 | Private Header Files
111 |
112 |
113 | Private Header Files
114 |
115 |
116 | Private Header Files
117 |
118 |
119 | Private Header Files
120 |
121 |
122 | Private Header Files
123 |
124 |
125 | Private Header Files
126 |
127 |
128 | Private Header Files
129 |
130 |
131 | Private Header Files
132 |
133 |
134 | Private Header Files
135 |
136 |
137 | Private Header Files
138 |
139 |
140 | Private Header Files
141 |
142 |
143 | Private Header Files
144 |
145 |
146 |
147 |
148 | Resource Files
149 |
150 |
151 |
152 |
153 | Resource Files
154 |
155 |
156 | Resource Files
157 |
158 |
159 | Resource Files
160 |
161 |
162 | Resource Files
163 |
164 |
165 | Resource Files
166 |
167 |
168 | Resource Files
169 |
170 |
171 | Resource Files
172 |
173 |
174 | Resource Files
175 |
176 |
177 | Resource Files
178 |
179 |
180 | Resource Files
181 |
182 |
183 | Resource Files
184 |
185 |
186 | Resource Files
187 |
188 |
189 | Resource Files
190 |
191 |
192 | Resource Files
193 |
194 |
195 | Resource Files
196 |
197 |
198 | Resource Files
199 |
200 |
201 | Resource Files
202 |
203 |
204 | Resource Files
205 |
206 |
207 |
208 |
209 | Resource Files
210 |
211 |
212 |
213 |
214 | Source Files
215 |
216 |
217 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/AntTweakBar_VS2008.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 10.00
2 | # Visual C++ Express 2008
3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AntTweakBar", "AntTweakBar.vcproj", "{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}"
4 | EndProject
5 | Global
6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
7 | Debug|Win32 = Debug|Win32
8 | Debug|x64 = Debug|x64
9 | Release|Win32 = Release|Win32
10 | Release|x64 = Release|x64
11 | EndGlobalSection
12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
13 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|Win32.ActiveCfg = Debug|Win32
14 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|Win32.Build.0 = Debug|Win32
15 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|x64.ActiveCfg = Debug|x64
16 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|x64.Build.0 = Debug|x64
17 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|Win32.ActiveCfg = Release|Win32
18 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|Win32.Build.0 = Release|Win32
19 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|x64.ActiveCfg = Release|x64
20 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|x64.Build.0 = Release|x64
21 | EndGlobalSection
22 | GlobalSection(SolutionProperties) = preSolution
23 | HideSolutionNode = FALSE
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/AntTweakBar_VS2012.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 12.00
2 | # Visual Studio Express 2012 for Windows Desktop
3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AntTweakBar", "AntTweakBar.vcxproj", "{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}"
4 | EndProject
5 | Global
6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
7 | Debug|Win32 = Debug|Win32
8 | Debug|x64 = Debug|x64
9 | Release|Win32 = Release|Win32
10 | Release|x64 = Release|x64
11 | EndGlobalSection
12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
13 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|Win32.ActiveCfg = Debug|Win32
14 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|Win32.Build.0 = Debug|Win32
15 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|x64.ActiveCfg = Debug|x64
16 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|x64.Build.0 = Debug|x64
17 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|Win32.ActiveCfg = Release|Win32
18 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|Win32.Build.0 = Release|Win32
19 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|x64.ActiveCfg = Release|x64
20 | {B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|x64.Build.0 = Release|x64
21 | EndGlobalSection
22 | GlobalSection(SolutionProperties) = preSolution
23 | HideSolutionNode = FALSE
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/Makefile:
--------------------------------------------------------------------------------
1 |
2 |
3 | #---- LINUX
4 | SO_EXT = .so
5 | SO_VERSION = 1
6 | AR_EXT = .a
7 |
8 | #---- Release
9 | CXXCFG = -O3
10 | LFLAGS =
11 | OUT_DIR = ../lib
12 | #---- Debug
13 | #CXXCFG = -g -D_DEBUG
14 | #LFLAGS =
15 | #OUT_DIR = ../lib/debug
16 |
17 |
18 | CXX = gcc
19 | CXXFLAGS = $(CXXCFG) -Wall -fPIC -fno-strict-aliasing -D_UNIX -D__PLACEMENT_NEW_INLINE
20 | INCPATH = -I../include -I/usr/local/include -I/usr/X11R6/include -I/usr/include
21 | LINK = gcc
22 | #LIBS = -L/usr/X11R6/lib -L. -lglfw -lGL -lGLU -lX11 -lXxf86vm -lXext -lpthread -lm
23 | #LIBS = -L/usr/X11R6/lib -lGL -lX11 -lXxf86vm -lXext -lpthread -lm
24 | LIBS = -lGL -lstdc++
25 | AR = ar cqs
26 | RANLIB =
27 | TAR = tar -cf
28 | GZIP = gzip -9f
29 | COPY = cp -f
30 | COPY_FILE = $(COPY) -p
31 | COPY_DIR = $(COPY) -pR
32 | DEL_FILE = rm -f
33 | SYMLINK = ln -sf
34 | DEL_DIR = rmdir
35 | MOVE = mv
36 | NO_STDERR = 2> /dev/null
37 |
38 |
39 | ####### Files
40 |
41 |
42 | # name of the application:
43 | TARGET = AntTweakBar
44 |
45 | # source files without extension:
46 | SRC_FILES = TwColors.cpp TwFonts.cpp TwOpenGL.cpp TwOpenGLCore.cpp TwBar.cpp TwMgr.cpp TwPrecomp.cpp LoadOGL.cpp LoadOGLCore.cpp TwEventGLFW.c TwEventGLUT.c TwEventSDL.c TwEventSDL12.c TwEventSDL13.c TwEventSDL20.c TwEventSFML.cpp TwEventX11.c
47 |
48 | # build object list from source files
49 | OBJS_1 = $(SRC_FILES:.c=.o)
50 | OBJS = $(OBJS_1:.cpp=.o)
51 |
52 |
53 | ####### Build rules
54 |
55 |
56 | #first: depend all
57 | first: all
58 |
59 | all: Makefile $(TARGET)
60 |
61 | # append dependencies to this Makefile
62 | #depend:
63 | # @echo "==== Make dependencies ====="
64 | # makedepend -Y
65 | # makedepend -a -Y -- $(CXXFLAGS) $(INCPATH) -- $(SRC_FILES) $(NO_STDERR)
66 |
67 | $(TARGET): $(OBJS)
68 | @echo "===== Link $@ ====="
69 | $(LINK) $(LFLAGS) -shared -Wl,-soname,lib$(TARGET)$(SO_EXT).$(SO_VERSION) -o $(OUT_DIR)/lib$(TARGET)$(SO_EXT) $(OBJS) $(LIBS)
70 | $(SYMLINK) $(OUT_DIR)/lib$(TARGET)$(SO_EXT) $(OUT_DIR)/lib$(TARGET)$(SO_EXT).$(SO_VERSION)
71 | $(AR) $(OUT_DIR)/lib$(TARGET)$(AR_EXT) $(OBJS)
72 |
73 | .cpp.o:
74 | @echo "===== Compile $< ====="
75 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
76 |
77 | .c.o:
78 | @echo "===== Compile $< ====="
79 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
80 |
81 | clean:
82 | @echo "===== Clean ====="
83 | -$(DEL_FILE) *.o
84 | -$(DEL_FILE) *~ core *.core *.stackdump
85 |
86 |
87 | ####### DEPENDENCIES
88 |
89 | TwColors.o: TwPrecomp.h TwColors.h
90 | TwFonts.o: TwPrecomp.h ../include/AntTweakBar.h TwFonts.h TwMgr.h TwColors.h TwGraph.h AntPerfTimer.h
91 | TwOpenGL.o: TwPrecomp.h ../include/AntTweakBar.h TwOpenGL.h LoadOGL.h TwGraph.h TwColors.h TwFonts.h TwMgr.h AntPerfTimer.h
92 | TwOpenGLCore.o: TwPrecomp.h ../include/AntTweakBar.h TwOpenGLCore.h LoadOGLCore.h TwGraph.h TwColors.h TwFonts.h TwMgr.h AntPerfTimer.h
93 | TwBar.o: TwPrecomp.h ../include/AntTweakBar.h TwBar.h TwMgr.h TwColors.h TwFonts.h TwGraph.h AntPerfTimer.h
94 | TwMgr.o: TwPrecomp.h ../include/AntTweakBar.h TwMgr.h TwColors.h TwFonts.h TwGraph.h AntPerfTimer.h TwBar.h TwOpenGL.h res/TwXCursors.h
95 | TwPrecomp.o: TwPrecomp.h
96 | LoadOGL.o: TwPrecomp.h LoadOGL.h
97 | TwEventGLFW.o: ../include/AntTweakBar.h MiniGLFW.h
98 | TwEventGLUT.o: ../include/AntTweakBar.h MiniGLUT.h
99 | TwEventSDL.o: ../include/AntTweakBar.h
100 | TwEventSDL12.o: ../include/AntTweakBar.h MiniSDL12.h
101 | TwEventSDL13.o: ../include/AntTweakBar.h MiniSDL13.h
102 | TwEventSDL20.o: ../include/AntTweakBar.h MiniSDL20.h
103 | TwEventX11.o: ../include/AntTweakBar.h
104 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/Makefile.osx:
--------------------------------------------------------------------------------
1 | ####### Compiler, tools and options
2 |
3 | SO_EXT = .dylib
4 | AR_EXT = .a
5 |
6 | #---- Release
7 | CXXCFG = -O3
8 | LFLAGS =
9 | OUT_DIR = ../lib
10 | #---- Debug
11 | #CXXCFG = -g -D_DEBUG
12 | #LFLAGS =
13 | #OUT_DIR = ../lib/debug
14 |
15 | #BASE = /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks
16 | CXX = g++
17 | CXXFLAGS = $(CXXCFG) -Wall -fPIC -fno-strict-aliasing -D_MACOSX -ObjC++ -D__PLACEMENT_NEW_INLINE
18 | INCPATH = -I../include -I/usr/local/include -I/usr/X11R6/include -I/usr/include
19 | #-I$(BASE)/OpenGL.framework/Headers/ -I$(BASE)/GLUT.framework/Headers/ -I$(BASE)/AppKit.framework/Headers/
20 | LINK = g++
21 | LIBS = -framework OpenGL -framework GLUT -framework AppKit
22 | AR = ar cqs
23 | RANLIB =
24 | TAR = tar -cf
25 | GZIP = gzip -9f
26 | COPY = cp -f
27 | COPY_FILE = $(COPY) -p
28 | COPY_DIR = $(COPY) -pR
29 | DEL_FILE = rm -f
30 | SYMLINK = ln -sf
31 | DEL_DIR = rmdir
32 | MOVE = mv
33 | NO_STDERR = 2> /dev/null
34 |
35 |
36 | ####### Files
37 |
38 |
39 | # name of the application:
40 | TARGET = AntTweakBar
41 |
42 | # source files without extension:
43 | SRC_FILES = TwColors.cpp TwFonts.cpp TwOpenGL.cpp TwOpenGLCore.cpp TwBar.cpp TwMgr.cpp LoadOGL.cpp LoadOGLCore.cpp TwEventGLFW.c TwEventGLUT.c TwEventSDL.c TwEventSDL12.c TwEventSDL13.c TwEventSFML.cpp
44 |
45 | # build object list from source files
46 | OBJS_1 = $(SRC_FILES:.c=.o)
47 | OBJS = $(OBJS_1:.cpp=.o)
48 |
49 |
50 | ####### Build rules
51 |
52 |
53 | #first: depend all
54 | first: all
55 |
56 | all: Makefile $(TARGET)
57 |
58 | # append dependencies to this Makefile
59 | #depend:
60 | # @echo "==== Make dependencies ====="
61 | # makedepend -Y
62 | # makedepend -a -Y -- $(CXXFLAGS) $(INCPATH) -- $(SRC_FILES) $(NO_STDERR)
63 |
64 | $(TARGET): $(OBJS)
65 | @echo "===== Link $@ ====="
66 | $(LINK) $(LFLAGS) -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -o $(OUT_DIR)/lib$(TARGET)$(SO_EXT) $(OBJS) $(LIBS)
67 | $(AR) $(OUT_DIR)/lib$(TARGET)$(AR_EXT) $(OBJS)
68 |
69 | .cpp.o:
70 | @echo "===== Compile $< ====="
71 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
72 |
73 | .c.o:
74 | @echo "===== Compile $< ====="
75 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
76 |
77 | clean:
78 | @echo "===== Clean ====="
79 | -$(DEL_FILE) *.o
80 | -$(DEL_FILE) *~ core *.core *.stackdump
81 |
82 |
83 | ####### DEPENDENCIES
84 |
85 | TwColors.o: TwPrecomp.h TwColors.h
86 | TwFonts.o: TwPrecomp.h ../include/AntTweakBar.h TwFonts.h TwMgr.h TwColors.h TwGraph.h AntPerfTimer.h
87 | TwOpenGL.o: TwPrecomp.h ../include/AntTweakBar.h TwOpenGL.h LoadOGL.h TwGraph.h TwColors.h TwFonts.h TwMgr.h AntPerfTimer.h
88 | TwOpenGLCore.o: TwPrecomp.h ../include/AntTweakBar.h TwOpenGLCore.h LoadOGLCore.h TwGraph.h TwColors.h TwFonts.h TwMgr.h AntPerfTimer.h
89 | TwBar.o: TwPrecomp.h ../include/AntTweakBar.h TwBar.h TwMgr.h TwColors.h TwFonts.h TwGraph.h AntPerfTimer.h
90 | TwMgr.o: TwPrecomp.h ../include/AntTweakBar.h TwMgr.h TwColors.h TwFonts.h TwGraph.h AntPerfTimer.h TwBar.h TwOpenGL.h res/TwXCursors.h
91 | TwPrecomp.o: TwPrecomp.h
92 | LoadOGL.o: TwPrecomp.h LoadOGL.h
93 | TwEventGLFW.o: ../include/AntTweakBar.h MiniGLFW.h
94 | TwEventGLUT.o: ../include/AntTweakBar.h MiniGLUT.h
95 | TwEventSDL.o: ../include/AntTweakBar.h
96 | TwEventSDL12.o: ../include/AntTweakBar.h MiniSDL12.h
97 | TwEventSDL13.o: ../include/AntTweakBar.h MiniSDL13.h
98 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/MiniGLFW.h:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file MiniGLFW.h
4 | // @brief A subset of GLFW definitions needed to compile helper functions
5 | // implemented in TwEventGLFW.c
6 | //
7 | // notes: - Private header
8 | // - AntTweakBar.dll does not need to link with GLFW,
9 | // it just needs some definitions for its helper functions.
10 | // - This header is provided to avoid the need of having GLFW
11 | // installed to recompile AntTweakBar.
12 | // - Do not use this header in your own programs, better use the
13 | // glfw.h header from the actual GLFW library SDK :
14 | // http://www.glfw.org
15 | //
16 | // ---------------------------------------------------------------------------
17 |
18 | #if !defined MINI_GLFW_INCLUDED
19 | #define MINI_GLFW_INCLUDED
20 |
21 | #ifdef __cplusplus
22 | extern "C" {
23 | #endif
24 |
25 |
26 | // Key and button state/action definitions
27 | #define GLFW_RELEASE 0
28 | #define GLFW_PRESS 1
29 |
30 | // Keyboard key definitions
31 | #define GLFW_KEY_UNKNOWN -1
32 | #define GLFW_KEY_SPACE 32
33 | #define GLFW_KEY_SPECIAL 256
34 | #define GLFW_KEY_ESC (GLFW_KEY_SPECIAL+1)
35 | #define GLFW_KEY_F1 (GLFW_KEY_SPECIAL+2)
36 | #define GLFW_KEY_F2 (GLFW_KEY_SPECIAL+3)
37 | #define GLFW_KEY_F3 (GLFW_KEY_SPECIAL+4)
38 | #define GLFW_KEY_F4 (GLFW_KEY_SPECIAL+5)
39 | #define GLFW_KEY_F5 (GLFW_KEY_SPECIAL+6)
40 | #define GLFW_KEY_F6 (GLFW_KEY_SPECIAL+7)
41 | #define GLFW_KEY_F7 (GLFW_KEY_SPECIAL+8)
42 | #define GLFW_KEY_F8 (GLFW_KEY_SPECIAL+9)
43 | #define GLFW_KEY_F9 (GLFW_KEY_SPECIAL+10)
44 | #define GLFW_KEY_F10 (GLFW_KEY_SPECIAL+11)
45 | #define GLFW_KEY_F11 (GLFW_KEY_SPECIAL+12)
46 | #define GLFW_KEY_F12 (GLFW_KEY_SPECIAL+13)
47 | #define GLFW_KEY_F13 (GLFW_KEY_SPECIAL+14)
48 | #define GLFW_KEY_F14 (GLFW_KEY_SPECIAL+15)
49 | #define GLFW_KEY_F15 (GLFW_KEY_SPECIAL+16)
50 | #define GLFW_KEY_F16 (GLFW_KEY_SPECIAL+17)
51 | #define GLFW_KEY_F17 (GLFW_KEY_SPECIAL+18)
52 | #define GLFW_KEY_F18 (GLFW_KEY_SPECIAL+19)
53 | #define GLFW_KEY_F19 (GLFW_KEY_SPECIAL+20)
54 | #define GLFW_KEY_F20 (GLFW_KEY_SPECIAL+21)
55 | #define GLFW_KEY_F21 (GLFW_KEY_SPECIAL+22)
56 | #define GLFW_KEY_F22 (GLFW_KEY_SPECIAL+23)
57 | #define GLFW_KEY_F23 (GLFW_KEY_SPECIAL+24)
58 | #define GLFW_KEY_F24 (GLFW_KEY_SPECIAL+25)
59 | #define GLFW_KEY_F25 (GLFW_KEY_SPECIAL+26)
60 | #define GLFW_KEY_UP (GLFW_KEY_SPECIAL+27)
61 | #define GLFW_KEY_DOWN (GLFW_KEY_SPECIAL+28)
62 | #define GLFW_KEY_LEFT (GLFW_KEY_SPECIAL+29)
63 | #define GLFW_KEY_RIGHT (GLFW_KEY_SPECIAL+30)
64 | #define GLFW_KEY_LSHIFT (GLFW_KEY_SPECIAL+31)
65 | #define GLFW_KEY_RSHIFT (GLFW_KEY_SPECIAL+32)
66 | #define GLFW_KEY_LCTRL (GLFW_KEY_SPECIAL+33)
67 | #define GLFW_KEY_RCTRL (GLFW_KEY_SPECIAL+34)
68 | #define GLFW_KEY_LALT (GLFW_KEY_SPECIAL+35)
69 | #define GLFW_KEY_RALT (GLFW_KEY_SPECIAL+36)
70 | #define GLFW_KEY_TAB (GLFW_KEY_SPECIAL+37)
71 | #define GLFW_KEY_ENTER (GLFW_KEY_SPECIAL+38)
72 | #define GLFW_KEY_BACKSPACE (GLFW_KEY_SPECIAL+39)
73 | #define GLFW_KEY_INSERT (GLFW_KEY_SPECIAL+40)
74 | #define GLFW_KEY_DEL (GLFW_KEY_SPECIAL+41)
75 | #define GLFW_KEY_PAGEUP (GLFW_KEY_SPECIAL+42)
76 | #define GLFW_KEY_PAGEDOWN (GLFW_KEY_SPECIAL+43)
77 | #define GLFW_KEY_HOME (GLFW_KEY_SPECIAL+44)
78 | #define GLFW_KEY_END (GLFW_KEY_SPECIAL+45)
79 | #define GLFW_KEY_KP_0 (GLFW_KEY_SPECIAL+46)
80 | #define GLFW_KEY_KP_1 (GLFW_KEY_SPECIAL+47)
81 | #define GLFW_KEY_KP_2 (GLFW_KEY_SPECIAL+48)
82 | #define GLFW_KEY_KP_3 (GLFW_KEY_SPECIAL+49)
83 | #define GLFW_KEY_KP_4 (GLFW_KEY_SPECIAL+50)
84 | #define GLFW_KEY_KP_5 (GLFW_KEY_SPECIAL+51)
85 | #define GLFW_KEY_KP_6 (GLFW_KEY_SPECIAL+52)
86 | #define GLFW_KEY_KP_7 (GLFW_KEY_SPECIAL+53)
87 | #define GLFW_KEY_KP_8 (GLFW_KEY_SPECIAL+54)
88 | #define GLFW_KEY_KP_9 (GLFW_KEY_SPECIAL+55)
89 | #define GLFW_KEY_KP_DIVIDE (GLFW_KEY_SPECIAL+56)
90 | #define GLFW_KEY_KP_MULTIPLY (GLFW_KEY_SPECIAL+57)
91 | #define GLFW_KEY_KP_SUBTRACT (GLFW_KEY_SPECIAL+58)
92 | #define GLFW_KEY_KP_ADD (GLFW_KEY_SPECIAL+59)
93 | #define GLFW_KEY_KP_DECIMAL (GLFW_KEY_SPECIAL+60)
94 | #define GLFW_KEY_KP_EQUAL (GLFW_KEY_SPECIAL+61)
95 | #define GLFW_KEY_KP_ENTER (GLFW_KEY_SPECIAL+62)
96 | #define GLFW_KEY_LAST GLFW_KEY_KP_ENTER
97 |
98 | // Mouse button
99 | #define GLFW_MOUSE_BUTTON_LEFT 0
100 | #define GLFW_MOUSE_BUTTON_RIGHT 1
101 | #define GLFW_MOUSE_BUTTON_MIDDLE 2
102 |
103 |
104 | #ifdef __cplusplus
105 | }
106 | #endif
107 |
108 | #endif // !defined MINI_GLFW_INCLUDED
109 |
110 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/MiniGLUT.h:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file MiniGLUT.h
4 | // @brief A subset of GLUT definitions needed to compile helper functions
5 | // implemented in TwEventGLUT.c
6 | //
7 | // notes: - Private header
8 | // - AntTweakBar.dll does not need to link with GLUT,
9 | // it just needs some definitions for its helper functions.
10 | // - This header is provided to avoid the need of having GLUT
11 | // installed to recompile AntTweakBar.
12 | // - Do not use this header in your own programs, better use the
13 | // GLUT.h header from the actual GLUT library SDK :
14 | // http://opengl.org/resources/libraries/glut
15 | //
16 | // ---------------------------------------------------------------------------
17 |
18 | #if !defined MINI_GLUT_INCLUDED
19 | #define MINI_GLUT_INCLUDED
20 |
21 | #if defined(_WIN32) || defined(_WIN64)
22 | # define WIN32_LEAN_AND_MEAN
23 | # include // needed by gl.h
24 | # define GLUT_CALL __stdcall
25 | # define GLUT_CALLBACK __cdecl
26 | # define GLUT_API __declspec(dllimport)
27 | #else
28 | # define GLUT_CALL
29 | # define GLUT_CALLBACK
30 | # define GLUT_API extern
31 | #endif
32 |
33 | #if defined(_MACOSX)
34 | # include
35 | # include
36 | #else
37 | # include // must be included after windows.h
38 | # include
39 | #endif
40 |
41 | #ifdef __cplusplus
42 | extern "C" {
43 | #endif
44 |
45 |
46 | // Mouse buttons
47 | #define GLUT_LEFT_BUTTON 0
48 | #define GLUT_MIDDLE_BUTTON 1
49 | #define GLUT_RIGHT_BUTTON 2
50 |
51 | // Mouse button state
52 | #define GLUT_DOWN 0
53 | #define GLUT_UP 1
54 |
55 | // glutGetModifiers return mask
56 | #define GLUT_ACTIVE_SHIFT 1
57 | #define GLUT_ACTIVE_CTRL 2
58 | #define GLUT_ACTIVE_ALT 4
59 |
60 | // function keys
61 | #define GLUT_KEY_F1 1
62 | #define GLUT_KEY_F2 2
63 | #define GLUT_KEY_F3 3
64 | #define GLUT_KEY_F4 4
65 | #define GLUT_KEY_F5 5
66 | #define GLUT_KEY_F6 6
67 | #define GLUT_KEY_F7 7
68 | #define GLUT_KEY_F8 8
69 | #define GLUT_KEY_F9 9
70 | #define GLUT_KEY_F10 10
71 | #define GLUT_KEY_F11 11
72 | #define GLUT_KEY_F12 12
73 |
74 | // directional keys
75 | #define GLUT_KEY_LEFT 100
76 | #define GLUT_KEY_UP 101
77 | #define GLUT_KEY_RIGHT 102
78 | #define GLUT_KEY_DOWN 103
79 | #define GLUT_KEY_PAGE_UP 104
80 | #define GLUT_KEY_PAGE_DOWN 105
81 | #define GLUT_KEY_HOME 106
82 | #define GLUT_KEY_END 107
83 | #define GLUT_KEY_INSERT 108
84 |
85 | // display mode bit masks
86 | #define GLUT_RGB 0
87 | #define GLUT_RGBA GLUT_RGB
88 | #define GLUT_INDEX 1
89 | #define GLUT_SINGLE 0
90 | #define GLUT_DOUBLE 2
91 | #define GLUT_ACCUM 4
92 | #define GLUT_ALPHA 8
93 | #define GLUT_DEPTH 16
94 | #define GLUT_STENCIL 32
95 |
96 | // timer
97 | #define GLUT_ELAPSED_TIME ((GLenum) 700)
98 |
99 |
100 | // functions subset
101 | GLUT_API void GLUT_CALL glutInit(int *argcp, char **argv);
102 | GLUT_API void GLUT_CALL glutInitDisplayMode(unsigned int mode);
103 | GLUT_API int GLUT_CALL glutCreateWindow(const char *title);
104 | GLUT_API int GLUT_CALL glutGetWindow(void);
105 | GLUT_API void GLUT_CALL glutSetWindow(int win);
106 | GLUT_API int GLUT_CALL glutCreateSubWindow(int win, int x, int y, int width, int height);
107 | GLUT_API int GLUT_CALL glutGet(GLenum type);
108 | GLUT_API void GLUT_CALL glutSwapBuffers();
109 | GLUT_API void GLUT_CALL glutPostRedisplay();
110 | GLUT_API void GLUT_CALL glutInitWindowPosition(int x, int y);
111 | GLUT_API void GLUT_CALL glutInitWindowSize(int width, int height);
112 | GLUT_API void GLUT_CALL glutPositionWindow(int x, int y);
113 | GLUT_API void GLUT_CALL glutReshapeWindow(int width, int height);
114 | GLUT_API void GLUT_CALL glutMainLoop();
115 | GLUT_API int GLUT_CALL glutCreateMenu(void (GLUT_CALLBACK *func)(int));
116 | GLUT_API void GLUT_CALL glutDisplayFunc(void (GLUT_CALLBACK *func)(void));
117 | GLUT_API void GLUT_CALL glutReshapeFunc(void (GLUT_CALLBACK *func)(int width, int height));
118 | GLUT_API void GLUT_CALL glutKeyboardFunc(void (GLUT_CALLBACK *func)(unsigned char key, int x, int y));
119 | GLUT_API void GLUT_CALL glutMouseFunc(void (GLUT_CALLBACK *func)(int button, int state, int x, int y));
120 | GLUT_API void GLUT_CALL glutMotionFunc(void (GLUT_CALLBACK *func)(int x, int y));
121 | GLUT_API void GLUT_CALL glutPassiveMotionFunc(void (GLUT_CALLBACK *func)(int x, int y));
122 | GLUT_API void GLUT_CALL glutSpecialFunc(void (GLUT_CALLBACK *func)(int key, int x, int y));
123 | GLUT_API int GLUT_CALL glutGetModifiers(void);
124 | GLUT_API void GLUT_CALL glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
125 | GLUT_API void GLUT_CALL glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
126 | GLUT_API void GLUT_CALL glutSolidTeapot(GLdouble size);
127 |
128 | // GLUT exit problem workaround (see glut.h)
129 | #if (defined(_WIN32) || defined(_WIN64)) && !defined(GLUT_DISABLE_ATEXIT_HACK)
130 | extern void __cdecl exit(int);
131 | GLUT_API void GLUT_CALL __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
132 | static void GLUT_CALL glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
133 | #define glutInit glutInit_ATEXIT_HACK
134 | #endif
135 |
136 |
137 | #ifdef __cplusplus
138 | }
139 | #endif
140 |
141 | #endif // !defined MINI_GLUT_INCLUDED
142 |
143 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/Readme.txt:
--------------------------------------------------------------------------------
1 | Under Windows, it is not necessary to rebuild AntTweakBar since a precompiled
2 | version is provided in the lib directory. But if you want to recompile it,
3 | you can use the provided Visual Studio solution. You'd also need the DirectX
4 | SDK (http://msdn.microsoft.com/directx) and the path to the DirectX shader
5 | compiler fxc.exe (included in the DirectX SDK) must be listed in the VC++
6 | directories.
7 |
8 | To build the library on Linux, open a terminal, go in the src directory and
9 | type make
10 |
11 | To build the library on MacOSX, open a terminal, go in the src directory and
12 | type make -f Makefile.osx
13 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwColors.cpp:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwColors.cpp
4 | // @author Philippe Decaudin
5 | // @license This file is part of the AntTweakBar library.
6 | // For conditions of distribution and use, see License.txt
7 | //
8 | // ---------------------------------------------------------------------------
9 |
10 |
11 | #include "TwPrecomp.h"
12 | #include "TwColors.h"
13 |
14 |
15 | void ColorRGBToHLSf(float _R, float _G, float _B, float *_Hue, float *_Light, float *_Saturation)
16 | {
17 | // Compute HLS from RGB. The r,g,b triplet is between [0,1],
18 | // hue is between [0,360], light and saturation are [0,1].
19 |
20 | float rnorm, gnorm, bnorm, minval, maxval, msum, mdiff, r, g, b;
21 | r = g = b = 0;
22 | if(_R>0) r = _R; if(r>1) r = 1;
23 | if(_G>0) g = _G; if(g>1) g = 1;
24 | if(_B>0) b = _B; if(b>1) b = 1;
25 |
26 | minval = r;
27 | if(gmaxval) maxval = g;
31 | if(b>maxval) maxval = b;
32 |
33 | rnorm = gnorm = bnorm = 0;
34 | mdiff = maxval - minval;
35 | msum = maxval + minval;
36 | float l = 0.5f * msum;
37 | if(_Light)
38 | *_Light = l;
39 | if(maxval!=minval)
40 | {
41 | rnorm = (maxval - r)/mdiff;
42 | gnorm = (maxval - g)/mdiff;
43 | bnorm = (maxval - b)/mdiff;
44 | }
45 | else
46 | {
47 | if(_Saturation)
48 | *_Saturation = 0;
49 | if(_Hue)
50 | *_Hue = 0;
51 | return;
52 | }
53 |
54 | if(_Saturation)
55 | {
56 | if(l<0.5f)
57 | *_Saturation = mdiff/msum;
58 | else
59 | *_Saturation = mdiff/(2.0f - msum);
60 | }
61 |
62 | if(_Hue)
63 | {
64 | if(r==maxval)
65 | *_Hue = 60.0f * (6.0f + bnorm - gnorm);
66 | else if(g==maxval)
67 | *_Hue = 60.0f * (2.0f + rnorm - bnorm);
68 | else
69 | *_Hue = 60.0f * (4.0f + gnorm - rnorm);
70 |
71 | if(*_Hue>360.0f)
72 | *_Hue -= 360.0f;
73 | }
74 | }
75 |
76 |
77 | void ColorRGBToHLSi(int _R, int _G, int _B, int *_Hue, int *_Light, int *_Saturation)
78 | {
79 | float h, l, s;
80 | ColorRGBToHLSf((1.0f/255.0f)*float(_R), (1.0f/255.0f)*float(_G), (1.0f/255.0f)*float(_B), &h, &l, &s);
81 | if(_Hue) *_Hue = (int)TClamp(h*(256.0f/360.0f), 0.0f, 255.0f);
82 | if(_Light) *_Light = (int)TClamp(l*256.0f, 0.0f, 255.0f);
83 | if(_Saturation) *_Saturation= (int)TClamp(s*256.0f, 0.0f, 255.0f);
84 | }
85 |
86 |
87 | void ColorHLSToRGBf(float _Hue, float _Light, float _Saturation, float *_R, float *_G, float *_B)
88 | {
89 | // Compute RGB from HLS. The light and saturation are between [0,1]
90 | // and hue is between [0,360]. The returned r,g,b triplet is between [0,1].
91 |
92 | // a local auxiliary function
93 | struct CLocal
94 | {
95 | static float HLSToRGB(float _Rn1, float _Rn2, float _Huei)
96 | {
97 | float hue = _Huei;
98 | if(hue>360) hue = hue - 360;
99 | if(hue<0) hue = hue + 360;
100 | if(hue<60 ) return _Rn1 + (_Rn2-_Rn1)*hue/60;
101 | if(hue<180) return _Rn2;
102 | if(hue<240) return _Rn1 + (_Rn2-_Rn1)*(240-hue)/60;
103 | return _Rn1;
104 | }
105 | };
106 |
107 | float rh, rl, rs, rm1, rm2;
108 | rh = rl = rs = 0;
109 | if(_Hue>0) rh = _Hue; if(rh>360) rh = 360;
110 | if(_Light>0) rl = _Light; if(rl>1) rl = 1;
111 | if(_Saturation>0) rs = _Saturation; if(rs>1) rs = 1;
112 |
113 | if(rl<=0.5f)
114 | rm2 = rl*(1.0f + rs);
115 | else
116 | rm2 = rl + rs - rl*rs;
117 | rm1 = 2.0f*rl - rm2;
118 |
119 | if(!rs)
120 | {
121 | if(_R) *_R = rl;
122 | if(_G) *_G = rl;
123 | if(_B) *_B = rl;
124 | }
125 | else
126 | {
127 | if(_R) *_R = CLocal::HLSToRGB(rm1, rm2, rh+120);
128 | if(_G) *_G = CLocal::HLSToRGB(rm1, rm2, rh);
129 | if(_B) *_B = CLocal::HLSToRGB(rm1, rm2, rh-120);
130 | }
131 | }
132 |
133 |
134 | void ColorHLSToRGBi(int _Hue, int _Light, int _Saturation, int *_R, int *_G, int *_B)
135 | {
136 | float r, g, b;
137 | ColorHLSToRGBf((360.0f/255.0f)*float(_Hue), (1.0f/255.0f)*float(_Light), (1.0f/255.0f)*float(_Saturation), &r, &g, &b);
138 | if(_R) *_R = (int)TClamp(r*256.0f, 0.0f, 255.0f);
139 | if(_G) *_G = (int)TClamp(g*256.0f, 0.0f, 255.0f);
140 | if(_B) *_B = (int)TClamp(b*256.0f, 0.0f, 255.0f);
141 | }
142 |
143 |
144 | color32 ColorBlend(color32 _Color1, color32 _Color2, float _S)
145 | {
146 | float a1, r1, g1, b1, a2, r2, g2, b2;
147 | Color32ToARGBf(_Color1, &a1, &r1, &g1, &b1);
148 | Color32ToARGBf(_Color2, &a2, &r2, &g2, &b2);
149 | float t = 1.0f-_S;
150 | return Color32FromARGBf(t*a1+_S*a2, t*r1+_S*r2, t*g1+_S*g2, t*b1+_S*b2);
151 | }
152 |
153 |
154 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwColors.h:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwColors.h
4 | // @brief Color conversions
5 | // @author Philippe Decaudin
6 | // @license This file is part of the AntTweakBar library.
7 | // For conditions of distribution and use, see License.txt
8 | //
9 | // note: Private header
10 | //
11 | // ---------------------------------------------------------------------------
12 |
13 |
14 | #if !defined ANT_TW_COLORS_INCLUDED
15 | #define ANT_TW_COLORS_INCLUDED
16 |
17 |
18 | // ---------------------------------------------------------------------------
19 |
20 |
21 | typedef unsigned int color32;
22 |
23 |
24 | const color32 COLOR32_BLACK = 0xff000000; // Black
25 | const color32 COLOR32_WHITE = 0xffffffff; // White
26 | const color32 COLOR32_ZERO = 0x00000000; // Zero
27 | const color32 COLOR32_RED = 0xffff0000; // Red
28 | const color32 COLOR32_GREEN = 0xff00ff00; // Green
29 | const color32 COLOR32_BLUE = 0xff0000ff; // Blue
30 |
31 |
32 | template inline const _T& TClamp(const _T& _X, const _T& _Limit1, const _T& _Limit2)
33 | {
34 | if( _Limit1<_Limit2 )
35 | return (_X<=_Limit1) ? _Limit1 : ( (_X>=_Limit2) ? _Limit2 : _X );
36 | else
37 | return (_X<=_Limit2) ? _Limit2 : ( (_X>=_Limit1) ? _Limit1 : _X );
38 | }
39 |
40 | inline color32 Color32FromARGBi(int _A, int _R, int _G, int _B)
41 | {
42 | return (((color32)TClamp(_A, 0, 255))<<24) | (((color32)TClamp(_R, 0, 255))<<16) | (((color32)TClamp(_G, 0, 255))<<8) | ((color32)TClamp(_B, 0, 255));
43 | }
44 |
45 | inline color32 Color32FromARGBf(float _A, float _R, float _G, float _B)
46 | {
47 | return (((color32)TClamp(_A*256.0f, 0.0f, 255.0f))<<24) | (((color32)TClamp(_R*256.0f, 0.0f, 255.0f))<<16) | (((color32)TClamp(_G*256.0f, 0.0f, 255.0f))<<8) | ((color32)TClamp(_B*256.0f, 0.0f, 255.0f));
48 | }
49 |
50 | inline void Color32ToARGBi(color32 _Color, int *_A, int *_R, int *_G, int *_B)
51 | {
52 | if(_A) *_A = (_Color>>24)&0xff;
53 | if(_R) *_R = (_Color>>16)&0xff;
54 | if(_G) *_G = (_Color>>8)&0xff;
55 | if(_B) *_B = _Color&0xff;
56 | }
57 |
58 | inline void Color32ToARGBf(color32 _Color, float *_A, float *_R, float *_G, float *_B)
59 | {
60 | if(_A) *_A = (1.0f/255.0f)*float((_Color>>24)&0xff);
61 | if(_R) *_R = (1.0f/255.0f)*float((_Color>>16)&0xff);
62 | if(_G) *_G = (1.0f/255.0f)*float((_Color>>8)&0xff);
63 | if(_B) *_B = (1.0f/255.0f)*float(_Color&0xff);
64 | }
65 |
66 | void ColorRGBToHLSf(float _R, float _G, float _B, float *_Hue, float *_Light, float *_Saturation);
67 |
68 | void ColorRGBToHLSi(int _R, int _G, int _B, int *_Hue, int *_Light, int *_Saturation);
69 |
70 | void ColorHLSToRGBf(float _Hue, float _Light, float _Saturation, float *_R, float *_G, float *_B);
71 |
72 | void ColorHLSToRGBi(int _Hue, int _Light, int _Saturation, int *_R, int *_G, int *_B);
73 |
74 | color32 ColorBlend(color32 _Color1, color32 _Color2, float _S);
75 |
76 |
77 | // ---------------------------------------------------------------------------
78 |
79 |
80 | #endif // !defined ANT_TW_COLORS_INCLUDED
81 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwDirect3D10.h:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwDirect3D10.h
4 | // @brief Direct3D10 graph functions
5 | // @author Philippe Decaudin
6 | // @license This file is part of the AntTweakBar library.
7 | // For conditions of distribution and use, see License.txt
8 | //
9 | // note: Private header
10 | //
11 | // ---------------------------------------------------------------------------
12 |
13 |
14 | #if !defined ANT_TW_DIRECT3D10_INCLUDED
15 | #define ANT_TW_DIRECT3D10_INCLUDED
16 |
17 | #include "TwGraph.h"
18 |
19 | // ---------------------------------------------------------------------------
20 |
21 | class CTwGraphDirect3D10 : public ITwGraph
22 | {
23 | public:
24 | virtual int Init();
25 | virtual int Shut();
26 | virtual void BeginDraw(int _WndWidth, int _WndHeight);
27 | virtual void EndDraw();
28 | virtual bool IsDrawing();
29 | virtual void Restore();
30 | virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased=false);
31 | virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color, bool _AntiAliased=false) { DrawLine(_X0, _Y0, _X1, _Y1, _Color, _Color, _AntiAliased); }
32 | virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11);
33 | virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color) { DrawRect(_X0, _Y0, _X1, _Y1, _Color, _Color, _Color, _Color); }
34 | virtual void DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode);
35 |
36 | virtual void * NewTextObj();
37 | virtual void DeleteTextObj(void *_TextObj);
38 | virtual void BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth);
39 | virtual void DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor);
40 |
41 | virtual void ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY);
42 | virtual void RestoreViewport();
43 | virtual void SetScissor(int _X0, int _Y0, int _Width, int _Height);
44 |
45 | protected:
46 | struct ID3D10Device * m_D3DDev;
47 | unsigned int m_D3DDevInitialRefCount;
48 | bool m_Drawing;
49 | const CTexFont * m_FontTex;
50 | struct ID3D10ShaderResourceView *m_FontD3DTexRV;
51 | int m_WndWidth;
52 | int m_WndHeight;
53 | int m_OffsetX;
54 | int m_OffsetY;
55 | void * m_ViewportInit;
56 | RECT m_ViewportAndScissorRects[2];
57 |
58 | struct CLineRectVtx
59 | {
60 | float m_Pos[3];
61 | color32 m_Color;
62 | };
63 | struct CTextVtx
64 | {
65 | float m_Pos[3];
66 | color32 m_Color;
67 | float m_UV[2];
68 | };
69 |
70 | struct CTextObj
71 | {
72 | struct ID3D10Buffer * m_TextVertexBuffer;
73 | struct ID3D10Buffer * m_BgVertexBuffer;
74 | int m_NbTextVerts;
75 | int m_NbBgVerts;
76 | int m_TextVertexBufferSize;
77 | int m_BgVertexBufferSize;
78 | bool m_LineColors;
79 | bool m_LineBgColors;
80 | };
81 |
82 | struct CState10 * m_State;
83 | struct ID3D10DepthStencilState *m_DepthStencilState;
84 | struct ID3D10BlendState * m_BlendState;
85 | struct ID3D10RasterizerState * m_RasterState;
86 | struct ID3D10RasterizerState * m_RasterStateAntialiased;
87 | struct ID3D10RasterizerState * m_RasterStateCullCW;
88 | struct ID3D10RasterizerState * m_RasterStateCullCCW;
89 | struct ID3D10Effect * m_Effect;
90 | struct ID3D10EffectTechnique* m_LineRectTech;
91 | struct ID3D10EffectTechnique* m_LineRectCstColorTech;
92 | struct ID3D10InputLayout * m_LineRectVertexLayout;
93 | struct ID3D10Buffer * m_LineVertexBuffer;
94 | struct ID3D10Buffer * m_RectVertexBuffer;
95 | struct ID3D10Buffer * m_TrianglesVertexBuffer;
96 | int m_TrianglesVertexBufferCount;
97 | struct ID3D10EffectTechnique* m_TextTech;
98 | struct ID3D10EffectTechnique* m_TextCstColorTech;
99 | struct ID3D10InputLayout * m_TextVertexLayout;
100 | struct ID3D10EffectShaderResourceVariable *m_FontD3DResVar;
101 | struct ID3D10EffectVectorVariable *m_OffsetVar;
102 | struct ID3D10EffectVectorVariable *m_CstColorVar;
103 | };
104 |
105 | // ---------------------------------------------------------------------------
106 |
107 |
108 | #endif // !defined ANT_TW_DIRECT3D10_INCLUDED
109 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwDirect3D11.h:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwDirect3D11.h
4 | // @brief Direct3D11 graphic functions
5 | // @author Philippe Decaudin
6 | // @license This file is part of the AntTweakBar library.
7 | // For conditions of distribution and use, see License.txt
8 | //
9 | // note: Private header
10 | //
11 | // ---------------------------------------------------------------------------
12 |
13 |
14 | #if !defined ANT_TW_DIRECT3D11_INCLUDED
15 | #define ANT_TW_DIRECT3D11_INCLUDED
16 |
17 | #include "TwGraph.h"
18 |
19 | // ---------------------------------------------------------------------------
20 |
21 | class CTwGraphDirect3D11 : public ITwGraph
22 | {
23 | public:
24 | virtual int Init();
25 | virtual int Shut();
26 | virtual void BeginDraw(int _WndWidth, int _WndHeight);
27 | virtual void EndDraw();
28 | virtual bool IsDrawing();
29 | virtual void Restore();
30 | virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased=false);
31 | virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color, bool _AntiAliased=false) { DrawLine(_X0, _Y0, _X1, _Y1, _Color, _Color, _AntiAliased); }
32 | virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11);
33 | virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color) { DrawRect(_X0, _Y0, _X1, _Y1, _Color, _Color, _Color, _Color); }
34 | virtual void DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode);
35 |
36 | virtual void * NewTextObj();
37 | virtual void DeleteTextObj(void *_TextObj);
38 | virtual void BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth);
39 | virtual void DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor);
40 |
41 | virtual void ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY);
42 | virtual void RestoreViewport();
43 | virtual void SetScissor(int _X0, int _Y0, int _Width, int _Height);
44 |
45 | protected:
46 | struct ID3D11Device * m_D3DDev;
47 | struct ID3D11DeviceContext *m_D3DDevImmContext;
48 | unsigned int m_D3DDevInitialRefCount;
49 | bool m_Drawing;
50 | const CTexFont * m_FontTex;
51 | struct ID3D11Texture2D * m_FontD3DTex;
52 | struct ID3D11ShaderResourceView *m_FontD3DTexRV;
53 | int m_WndWidth;
54 | int m_WndHeight;
55 | int m_OffsetX;
56 | int m_OffsetY;
57 | void * m_ViewportInit;
58 | RECT m_ViewportAndScissorRects[2];
59 |
60 | struct CLineRectVtx
61 | {
62 | float m_Pos[3];
63 | color32 m_Color;
64 | };
65 | struct CTextVtx
66 | {
67 | float m_Pos[3];
68 | color32 m_Color;
69 | float m_UV[2];
70 | };
71 | struct CConstants
72 | {
73 | float m_Offset[4];
74 | float m_CstColor[4];
75 | };
76 |
77 | struct CTextObj
78 | {
79 | struct ID3D11Buffer * m_TextVertexBuffer;
80 | struct ID3D11Buffer * m_BgVertexBuffer;
81 | int m_NbTextVerts;
82 | int m_NbBgVerts;
83 | int m_TextVertexBufferSize;
84 | int m_BgVertexBufferSize;
85 | bool m_LineColors;
86 | bool m_LineBgColors;
87 | };
88 |
89 | struct CState11 * m_State;
90 | struct ID3D11DepthStencilState *m_DepthStencilState;
91 | struct ID3D11BlendState * m_BlendState;
92 | struct ID3D11RasterizerState * m_RasterState;
93 | struct ID3D11RasterizerState * m_RasterStateAntialiased;
94 | struct ID3D11RasterizerState * m_RasterStateMultisample;
95 | struct ID3D11RasterizerState * m_RasterStateCullCW;
96 | struct ID3D11RasterizerState * m_RasterStateCullCCW;
97 |
98 | struct ID3D11VertexShader * m_LineRectVS;
99 | struct ID3D11VertexShader * m_LineRectCstColorVS;
100 | struct ID3D11PixelShader * m_LineRectPS;
101 | struct ID3D11InputLayout * m_LineRectVertexLayout;
102 | struct ID3D11VertexShader * m_TextVS;
103 | struct ID3D11VertexShader * m_TextCstColorVS;
104 | struct ID3D11PixelShader * m_TextPS;
105 | struct ID3D11InputLayout * m_TextVertexLayout;
106 | struct ID3D11Buffer * m_LineVertexBuffer;
107 | struct ID3D11Buffer * m_RectVertexBuffer;
108 | struct ID3D11Buffer * m_TrianglesVertexBuffer;
109 | int m_TrianglesVertexBufferCount;
110 | struct ID3D11Buffer * m_ConstantBuffer;
111 | struct ID3D11SamplerState * m_SamplerState;
112 | };
113 |
114 | // ---------------------------------------------------------------------------
115 |
116 |
117 | #endif // !defined ANT_TW_DIRECT3D11_INCLUDED
118 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwDirect3D11.hlsl:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwDirect3D11.hlsl
4 | // @author Philippe Decaudin
5 | // @brief AntTweakBar shaders and techniques for Direct3D11 support
6 | // @license This file is part of the AntTweakBar library.
7 | // For conditions of distribution and use, see License.txt
8 | //
9 | // ---------------------------------------------------------------------------
10 |
11 | float4 g_Offset : register(c0) = 0;
12 | float4 g_CstColor : register(c1) = 1;
13 |
14 | // Shaders for lines and rectangles
15 |
16 | struct LineRectPSInput
17 | {
18 | float4 Pos : SV_POSITION;
19 | float4 Color : COLOR0;
20 | };
21 |
22 | LineRectPSInput LineRectVS(float4 pos : POSITION, float4 color : COLOR)
23 | {
24 | LineRectPSInput ps;
25 | ps.Pos = pos + g_Offset;
26 | ps.Color = color;
27 | return ps;
28 | }
29 |
30 | LineRectPSInput LineRectCstColorVS(float4 pos : POSITION, float4 color : COLOR)
31 | {
32 | LineRectPSInput ps;
33 | ps.Pos = pos + g_Offset;
34 | ps.Color = g_CstColor;
35 | return ps;
36 | }
37 |
38 | float4 LineRectPS(LineRectPSInput input) : SV_TARGET
39 | {
40 | return input.Color;
41 | }
42 |
43 | // Shaders for text
44 |
45 | Texture2D g_Font : register(t0);
46 |
47 | SamplerState g_FontSampler : register(s0)
48 | {
49 | Filter = MIN_MAG_MIP_POINT;
50 | AddressU = BORDER;
51 | AddressV = BORDER;
52 | BorderColor = float4(0, 0, 0, 0);
53 | };
54 |
55 | struct TextPSInput
56 | {
57 | float4 Pos : SV_POSITION;
58 | float4 Color : COLOR0;
59 | float2 Tex : TEXCOORD0;
60 | };
61 |
62 | TextPSInput TextVS(float4 pos : POSITION, float4 color : COLOR, float2 tex : TEXCOORD0)
63 | {
64 | TextPSInput ps;
65 | ps.Pos = pos + g_Offset;
66 | ps.Color = color;
67 | ps.Tex = tex;
68 | return ps;
69 | }
70 |
71 | TextPSInput TextCstColorVS(float4 pos : POSITION, float4 color : COLOR, float2 tex : TEXCOORD0)
72 | {
73 | TextPSInput ps;
74 | ps.Pos = pos + g_Offset;
75 | ps.Color = g_CstColor;
76 | ps.Tex = tex;
77 | return ps;
78 | }
79 |
80 | float4 TextPS(TextPSInput input) : SV_TARGET
81 | {
82 | return g_Font.Sample(g_FontSampler, input.Tex) * input.Color;
83 | }
84 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwDirect3D9.h:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwDirect3D9.h
4 | // @brief Direct3D9 graph functions
5 | // @author Philippe Decaudin
6 | // @license This file is part of the AntTweakBar library.
7 | // For conditions of distribution and use, see License.txt
8 | //
9 | // note: Private header
10 | //
11 | // ---------------------------------------------------------------------------
12 |
13 |
14 | #if !defined ANT_TW_DIRECT3D9_INCLUDED
15 | #define ANT_TW_DIRECT3D9_INCLUDED
16 |
17 | #include "TwGraph.h"
18 |
19 | // ---------------------------------------------------------------------------
20 |
21 | class CTwGraphDirect3D9 : public ITwGraph
22 | {
23 | public:
24 | virtual int Init();
25 | virtual int Shut();
26 | virtual void BeginDraw(int _WndWidth, int _WndHeight);
27 | virtual void EndDraw();
28 | virtual bool IsDrawing();
29 | virtual void Restore();
30 | virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased=false);
31 | virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color, bool _AntiAliased=false) { DrawLine(_X0, _Y0, _X1, _Y1, _Color, _Color, _AntiAliased); }
32 | virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11);
33 | virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color) { DrawRect(_X0, _Y0, _X1, _Y1, _Color, _Color, _Color, _Color); }
34 | virtual void DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode);
35 |
36 | virtual void * NewTextObj();
37 | virtual void DeleteTextObj(void *_TextObj);
38 | virtual void BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth);
39 | virtual void DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor);
40 |
41 | virtual void ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY);
42 | virtual void RestoreViewport();
43 | virtual void SetScissor(int _X0, int _Y0, int _Width, int _Height);
44 |
45 | protected:
46 | struct IDirect3DDevice9 * m_D3DDev;
47 | bool m_Drawing;
48 | const CTexFont * m_FontTex;
49 | struct IDirect3DTexture9 * m_FontD3DTex;
50 | bool m_PureDevice;
51 | int m_WndWidth;
52 | int m_WndHeight;
53 | void * m_ViewportInit;
54 | int m_OffsetX;
55 | int m_OffsetY;
56 |
57 | struct CTextVtx
58 | {
59 | float m_Pos[4];
60 | color32 m_Color;
61 | float m_UV[2];
62 | };
63 | struct CBgVtx
64 | {
65 | float m_Pos[4];
66 | color32 m_Color;
67 | };
68 |
69 | struct CTextObj
70 | {
71 | std::vector m_TextVerts;
72 | std::vector m_BgVerts;
73 | bool m_LineColors;
74 | bool m_LineBgColors;
75 | };
76 |
77 | struct CTriVtx
78 | {
79 | float m_Pos[4];
80 | DWORD m_Color;
81 | };
82 | std::vector m_TriVertices;
83 |
84 | struct CState * m_State;
85 | };
86 |
87 | // ---------------------------------------------------------------------------
88 |
89 |
90 | #endif // !defined ANT_TW_DIRECT3D9_INCLUDED
91 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwEventGLFW.c:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwEventGLFW.c
4 | // @brief Helper:
5 | // translate and re-send mouse and keyboard events
6 | // from GLFW event callbacks to AntTweakBar
7 | //
8 | // @author Philippe Decaudin
9 | // @license This file is part of the AntTweakBar library.
10 | // For conditions of distribution and use, see License.txt
11 | //
12 | // ---------------------------------------------------------------------------
13 |
14 | // #include
15 | #include "MiniGLFW.h" // a subset of GLFW.h needed to compile TwEventGLFW.c
16 | // note: AntTweakBar.dll does not need to link with GLFW,
17 | // it just needs some definitions for its helper functions.
18 |
19 | #include
20 |
21 |
22 | int TW_CALL TwEventMouseButtonGLFW(int glfwButton, int glfwAction)
23 | {
24 | int handled = 0;
25 | TwMouseAction action = (glfwAction==GLFW_PRESS) ? TW_MOUSE_PRESSED : TW_MOUSE_RELEASED;
26 |
27 | if( glfwButton==GLFW_MOUSE_BUTTON_LEFT )
28 | handled = TwMouseButton(action, TW_MOUSE_LEFT);
29 | else if( glfwButton==GLFW_MOUSE_BUTTON_RIGHT )
30 | handled = TwMouseButton(action, TW_MOUSE_RIGHT);
31 | else if( glfwButton==GLFW_MOUSE_BUTTON_MIDDLE )
32 | handled = TwMouseButton(action, TW_MOUSE_MIDDLE);
33 |
34 | return handled;
35 | }
36 |
37 |
38 | int g_KMod = 0;
39 |
40 |
41 | int TW_CALL TwEventKeyGLFW(int glfwKey, int glfwAction)
42 | {
43 | int handled = 0;
44 |
45 | // Register of modifiers state
46 | if( glfwAction==GLFW_PRESS )
47 | {
48 | switch( glfwKey )
49 | {
50 | case GLFW_KEY_LSHIFT:
51 | case GLFW_KEY_RSHIFT:
52 | g_KMod |= TW_KMOD_SHIFT;
53 | break;
54 | case GLFW_KEY_LCTRL:
55 | case GLFW_KEY_RCTRL:
56 | g_KMod |= TW_KMOD_CTRL;
57 | break;
58 | case GLFW_KEY_LALT:
59 | case GLFW_KEY_RALT:
60 | g_KMod |= TW_KMOD_ALT;
61 | break;
62 | }
63 | }
64 | else
65 | {
66 | switch( glfwKey )
67 | {
68 | case GLFW_KEY_LSHIFT:
69 | case GLFW_KEY_RSHIFT:
70 | g_KMod &= ~TW_KMOD_SHIFT;
71 | break;
72 | case GLFW_KEY_LCTRL:
73 | case GLFW_KEY_RCTRL:
74 | g_KMod &= ~TW_KMOD_CTRL;
75 | break;
76 | case GLFW_KEY_LALT:
77 | case GLFW_KEY_RALT:
78 | g_KMod &= ~TW_KMOD_ALT;
79 | break;
80 | }
81 | }
82 |
83 | // Process key pressed
84 | if( glfwAction==GLFW_PRESS )
85 | {
86 | int mod = g_KMod;
87 | int testkp = ((mod&TW_KMOD_CTRL) || (mod&TW_KMOD_ALT)) ? 1 : 0;
88 |
89 | if( (mod&TW_KMOD_CTRL) && glfwKey>0 && glfwKey=GLFW_KEY_SPECIAL )
92 | {
93 | int k = 0;
94 |
95 | if( glfwKey>=GLFW_KEY_F1 && glfwKey<=GLFW_KEY_F15 )
96 | k = TW_KEY_F1 + (glfwKey-GLFW_KEY_F1);
97 | else if( testkp && glfwKey>=GLFW_KEY_KP_0 && glfwKey<=GLFW_KEY_KP_9 )
98 | k = '0' + (glfwKey-GLFW_KEY_KP_0);
99 | else
100 | {
101 | switch( glfwKey )
102 | {
103 | case GLFW_KEY_ESC:
104 | k = TW_KEY_ESCAPE;
105 | break;
106 | case GLFW_KEY_UP:
107 | k = TW_KEY_UP;
108 | break;
109 | case GLFW_KEY_DOWN:
110 | k = TW_KEY_DOWN;
111 | break;
112 | case GLFW_KEY_LEFT:
113 | k = TW_KEY_LEFT;
114 | break;
115 | case GLFW_KEY_RIGHT:
116 | k = TW_KEY_RIGHT;
117 | break;
118 | case GLFW_KEY_TAB:
119 | k = TW_KEY_TAB;
120 | break;
121 | case GLFW_KEY_ENTER:
122 | k = TW_KEY_RETURN;
123 | break;
124 | case GLFW_KEY_BACKSPACE:
125 | k = TW_KEY_BACKSPACE;
126 | break;
127 | case GLFW_KEY_INSERT:
128 | k = TW_KEY_INSERT;
129 | break;
130 | case GLFW_KEY_DEL:
131 | k = TW_KEY_DELETE;
132 | break;
133 | case GLFW_KEY_PAGEUP:
134 | k = TW_KEY_PAGE_UP;
135 | break;
136 | case GLFW_KEY_PAGEDOWN:
137 | k = TW_KEY_PAGE_DOWN;
138 | break;
139 | case GLFW_KEY_HOME:
140 | k = TW_KEY_HOME;
141 | break;
142 | case GLFW_KEY_END:
143 | k = TW_KEY_END;
144 | break;
145 | case GLFW_KEY_KP_ENTER:
146 | k = TW_KEY_RETURN;
147 | break;
148 | case GLFW_KEY_KP_DIVIDE:
149 | if( testkp )
150 | k = '/';
151 | break;
152 | case GLFW_KEY_KP_MULTIPLY:
153 | if( testkp )
154 | k = '*';
155 | break;
156 | case GLFW_KEY_KP_SUBTRACT:
157 | if( testkp )
158 | k = '-';
159 | break;
160 | case GLFW_KEY_KP_ADD:
161 | if( testkp )
162 | k = '+';
163 | break;
164 | case GLFW_KEY_KP_DECIMAL:
165 | if( testkp )
166 | k = '.';
167 | break;
168 | case GLFW_KEY_KP_EQUAL:
169 | if( testkp )
170 | k = '=';
171 | break;
172 | }
173 | }
174 |
175 | if( k>0 )
176 | handled = TwKeyPressed(k, mod);
177 | }
178 | }
179 |
180 | return handled;
181 | }
182 |
183 |
184 | int TW_CALL TwEventCharGLFW(int glfwChar, int glfwAction)
185 | {
186 | if( glfwAction==GLFW_PRESS && (glfwChar & 0xff00)==0 )
187 | return TwKeyPressed(glfwChar, g_KMod);
188 |
189 | return 0;
190 | }
191 |
192 | // functions with __cdecl calling convension
193 | TW_API int TW_CDECL_CALL TwEventMouseButtonGLFWcdecl(int glfwButton, int glfwAction)
194 | {
195 | return TwEventMouseButtonGLFW(glfwButton, glfwAction);
196 | }
197 | TW_API int TW_CDECL_CALL TwEventKeyGLFWcdecl(int glfwKey, int glfwAction)
198 | {
199 | return TwEventKeyGLFW(glfwKey, glfwAction);
200 | }
201 | TW_API int TW_CDECL_CALL TwEventCharGLFWcdecl(int glfwChar, int glfwAction)
202 | {
203 | return TwEventCharGLFW(glfwChar, glfwAction);
204 | }
205 | TW_API int TW_CDECL_CALL TwEventMousePosGLFWcdecl(int mouseX, int mouseY)
206 | {
207 | return TwMouseMotion(mouseX, mouseY);
208 | }
209 | TW_API int TW_CDECL_CALL TwEventMouseWheelGLFWcdecl(int wheelPos)
210 | {
211 | return TwMouseWheel(wheelPos);
212 | }
213 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwEventGLUT.c:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwEventGLUT.c
4 | // @brief Helper:
5 | // translate and re-send mouse and keyboard events
6 | // from GLUT event callbacks to AntTweakBar
7 | //
8 | // @author Philippe Decaudin
9 | // @date 2006/05/10
10 | // @license This file is part of the AntTweakBar library.
11 | // For conditions of distribution and use, see License.txt
12 | //
13 | // ---------------------------------------------------------------------------
14 |
15 |
16 | #define GLUT_NO_LIB_PRAGMA // we do not want to force linkage with glut
17 | #ifdef _MSC_VER
18 | # pragma warning(disable: 4505) // glut generates 'unreferenced function' warnings
19 | # pragma warning(disable: 4100) // unreferenced parameter
20 | #endif // _MSC_VER
21 |
22 | // #include
23 | #include "MiniGLUT.h" // a subset of glut.h needed to compile TwEventGLUT.c
24 | // note: AntTweakBar.dll does not need to link with GLUT,
25 | // it just needs some definitions for its helper functions.
26 |
27 | #include
28 |
29 |
30 | int TW_GLUT_CALL TwEventMouseButtonGLUT(int glutButton, int glutState, int mouseX, int mouseY)
31 | {
32 | TwMouseAction action = (glutState==GLUT_DOWN) ? TW_MOUSE_PRESSED : TW_MOUSE_RELEASED;
33 |
34 | TwMouseMotion(mouseX, mouseY);
35 | switch( glutButton )
36 | {
37 | case GLUT_LEFT_BUTTON:
38 | return TwMouseButton(action, TW_MOUSE_LEFT);
39 | case GLUT_RIGHT_BUTTON:
40 | return TwMouseButton(action, TW_MOUSE_RIGHT);
41 | case GLUT_MIDDLE_BUTTON:
42 | return TwMouseButton(action, TW_MOUSE_MIDDLE);
43 | default:
44 | return 0;
45 | }
46 | }
47 |
48 | int TW_GLUT_CALL TwEventMouseMotionGLUT(int mouseX, int mouseY)
49 | {
50 | return TwMouseMotion(mouseX, mouseY);
51 | }
52 |
53 |
54 | // GLUT does not send modifiers state to 'Key' and 'Special' callbacks,
55 | // and we cannot call glutGetModifiers here because we do not want to link
56 | // AntTweakBar with glut, so the following function is used to store
57 | // a pointer to the glutGetModifiers function of the calling application.
58 | // It must be called at initialisation of the application.
59 |
60 | int (TW_CALL *g_GLUTGetModifiers)(void) = NULL;
61 |
62 | int TW_CALL TwGLUTModifiersFunc(int (TW_CALL *glutGetModifiersFunc)(void))
63 | {
64 | g_GLUTGetModifiers = glutGetModifiersFunc;
65 | return (g_GLUTGetModifiers==NULL) ? 0 : 1;
66 | }
67 |
68 |
69 | int TW_GLUT_CALL TwEventKeyboardGLUT(unsigned char glutKey, int mouseX, int mouseY)
70 | {
71 | int kmod = 0;
72 |
73 | if( g_GLUTGetModifiers!=NULL )
74 | {
75 | int glutMod = g_GLUTGetModifiers();
76 |
77 | if( glutMod&GLUT_ACTIVE_SHIFT )
78 | kmod |= TW_KMOD_SHIFT;
79 | if( glutMod&GLUT_ACTIVE_CTRL )
80 | kmod |= TW_KMOD_CTRL;
81 | if( glutMod&GLUT_ACTIVE_ALT )
82 | kmod |= TW_KMOD_ALT;
83 | }
84 |
85 | if( (kmod&TW_KMOD_CTRL) && (glutKey>0 && glutKey<27) ) // CTRL special case
86 | glutKey += 'a'-1;
87 |
88 | return TwKeyPressed((int)glutKey, kmod);
89 | }
90 |
91 |
92 | int TW_GLUT_CALL TwEventSpecialGLUT(int glutKey, int mouseX, int mouseY)
93 | {
94 | int k = 0, kmod = 0;
95 |
96 | if( g_GLUTGetModifiers!=NULL )
97 | {
98 | int glutMod = g_GLUTGetModifiers();
99 |
100 | if( glutMod&GLUT_ACTIVE_SHIFT )
101 | kmod |= TW_KMOD_SHIFT;
102 | if( glutMod&GLUT_ACTIVE_CTRL )
103 | kmod |= TW_KMOD_CTRL;
104 | if( glutMod&GLUT_ACTIVE_ALT )
105 | kmod |= TW_KMOD_ALT;
106 | }
107 |
108 | if( glutKey>=GLUT_KEY_F1 && glutKey<=GLUT_KEY_F12 )
109 | k = TW_KEY_F1 + (glutKey-GLUT_KEY_F1);
110 | else
111 | {
112 | switch( glutKey )
113 | {
114 | case GLUT_KEY_LEFT:
115 | k = TW_KEY_LEFT;
116 | break;
117 | case GLUT_KEY_UP:
118 | k = TW_KEY_UP;
119 | break;
120 | case GLUT_KEY_RIGHT:
121 | k = TW_KEY_RIGHT;
122 | break;
123 | case GLUT_KEY_DOWN:
124 | k = TW_KEY_DOWN;
125 | break;
126 | case GLUT_KEY_PAGE_UP:
127 | k = TW_KEY_PAGE_UP;
128 | break;
129 | case GLUT_KEY_PAGE_DOWN:
130 | k = TW_KEY_PAGE_DOWN;
131 | break;
132 | case GLUT_KEY_HOME:
133 | k = TW_KEY_HOME;
134 | break;
135 | case GLUT_KEY_END:
136 | k = TW_KEY_END;
137 | break;
138 | case GLUT_KEY_INSERT:
139 | k = TW_KEY_INSERT;
140 | break;
141 | }
142 | }
143 |
144 | if( k>0 && k
18 |
19 | int TW_CALL TwEventSDL12(const void *sdlEvent); // implemented in TwEventSDL12.c
20 | int TW_CALL TwEventSDL13(const void *sdlEvent); // implmeneted in TwEventSDL13.c
21 | int TW_CALL TwEventSDL20(const void *sdlEvent); // implemented in TwEventSDL20.c
22 |
23 | #ifdef __cplusplus
24 | extern "C" { int TW_CALL TwSetLastError(const char *staticErrorMessage); }
25 | #else
26 | int TW_CALL TwSetLastError(const char *staticErrorMessage);
27 | #endif // __cplusplus
28 |
29 |
30 | // TwEventSDL returns zero if msg has not been handled or the SDL version
31 | // is not supported, and a non-zero value if it has been handled by the
32 | // AntTweakBar library.
33 | int TW_CALL TwEventSDL(const void *sdlEvent, unsigned char majorVersion, unsigned char minorVersion)
34 | {
35 | if (majorVersion < 1 || (majorVersion == 1 && minorVersion < 2))
36 | {
37 | static const char *g_ErrBadSDLVersion = "Unsupported SDL version";
38 | TwSetLastError(g_ErrBadSDLVersion);
39 | return 0;
40 | }
41 | else if (majorVersion == 1 && minorVersion == 2)
42 | return TwEventSDL12(sdlEvent);
43 | else if( majorVersion==1 && minorVersion==3 )
44 | return TwEventSDL13(sdlEvent);
45 | else
46 | return TwEventSDL20(sdlEvent);
47 | }
48 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwEventSDL12.c:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwEventSDL12.c
4 | // @brief Helper:
5 | // translate and re-send mouse and keyboard events
6 | // from SDL 1.2 event loop to AntTweakBar
7 | //
8 | // @author Philippe Decaudin
9 | // @date 2006/05/10
10 | // @license This file is part of the AntTweakBar library.
11 | // For conditions of distribution and use, see License.txt
12 | //
13 | // ---------------------------------------------------------------------------
14 |
15 |
16 | #include "MiniSDL12.h" // a subset of SDL.h needed to compile TwEventSDL12.c
17 | // note: AntTweakBar.dll does not need to link with SDL,
18 | // it just needs some definitions for its helper functions.
19 |
20 | #include
21 |
22 |
23 | // TwEventSDL12 returns zero if msg has not been handled,
24 | // and a non-zero value if it has been handled by the AntTweakBar library.
25 | int TW_CALL TwEventSDL12(const void *sdlEvent)
26 | {
27 | int handled = 0;
28 | const SDL_Event *event = (const SDL_Event *)sdlEvent;
29 |
30 | if( event==NULL )
31 | return 0;
32 |
33 | switch( event->type )
34 | {
35 | case SDL_KEYDOWN:
36 | if( event->key.keysym.unicode!=0 && (event->key.keysym.unicode & 0xFF00)==0 )
37 | {
38 | if( (event->key.keysym.unicode & 0xFF)<32 && (event->key.keysym.unicode & 0xFF)!=event->key.keysym.sym )
39 | handled = TwKeyPressed((event->key.keysym.unicode & 0xFF)+'a'-1, event->key.keysym.mod);
40 | else
41 | handled = TwKeyPressed(event->key.keysym.unicode & 0xFF, event->key.keysym.mod);
42 | }
43 | else
44 | handled = TwKeyPressed(event->key.keysym.sym, event->key.keysym.mod);
45 | break;
46 | case SDL_MOUSEMOTION:
47 | handled = TwMouseMotion(event->motion.x, event->motion.y);
48 | break;
49 | case SDL_MOUSEBUTTONUP:
50 | case SDL_MOUSEBUTTONDOWN:
51 | if( event->type==SDL_MOUSEBUTTONDOWN && (event->button.button==4 || event->button.button==5) ) // mouse wheel
52 | {
53 | static int s_WheelPos = 0;
54 | if( event->button.button==4 )
55 | ++s_WheelPos;
56 | else
57 | --s_WheelPos;
58 | handled = TwMouseWheel(s_WheelPos);
59 | }
60 | else
61 | handled = TwMouseButton((event->type==SDL_MOUSEBUTTONUP)?TW_MOUSE_RELEASED:TW_MOUSE_PRESSED, (TwMouseButtonID)event->button.button);
62 | break;
63 | case SDL_VIDEORESIZE:
64 | // tell the new size to TweakBar
65 | TwWindowSize(event->resize.w, event->resize.h);
66 | // do not set 'handled', SDL_VIDEORESIZE may be also processed by the calling application
67 | break;
68 | }
69 |
70 | return handled;
71 | }
72 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwEventSDL13.c:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwEventSDL13.c
4 | // @brief Helper:
5 | // translate and re-send mouse and keyboard events
6 | // from SDL 1.3 event loop to AntTweakBar
7 | //
8 | // @author Philippe Decaudin
9 | // @license This file is part of the AntTweakBar library.
10 | // For conditions of distribution and use, see License.txt
11 | //
12 | // ---------------------------------------------------------------------------
13 |
14 |
15 | #include "MiniSDL13.h" // a subset of SDL.h needed to compile TwEventSDL.c
16 | // note: AntTweakBar.dll does not need to link with SDL,
17 | // it just needs some definitions for its helper functions.
18 |
19 | #include
20 |
21 |
22 | // The way SDL handles keyboard events has changed between version 1.2
23 | // and 1.3. It is now more difficult to translate SDL keyboard events to
24 | // AntTweakBar events. The following code is an attempt to do so, but
25 | // it is rather complex and not always accurate (eg, CTRL+1 is not handled).
26 | // If someone knows a better and more robust way to do the keyboard events
27 | // translation, please let me know.
28 |
29 | // TwEventSDL returns zero if msg has not been handled,
30 | // and a non-zero value if it has been handled by the AntTweakBar library.
31 | int TW_CALL TwEventSDL13(const void *sdlEvent)
32 | {
33 | int handled = 0;
34 | static int s_KeyMod = 0;
35 | const SDL_Event *event = (const SDL_Event *)sdlEvent;
36 |
37 | if( event==NULL )
38 | return 0;
39 |
40 | switch( event->type )
41 | {
42 | case SDL_TEXTINPUT:
43 | if( event->text.text[0]!=0 && event->text.text[1]==0 )
44 | {
45 | if( s_KeyMod & TW_KMOD_CTRL && event->text.text[0]<32 )
46 | handled = TwKeyPressed(event->text.text[0]+'a'-1, s_KeyMod);
47 | else
48 | {
49 | if (s_KeyMod & KMOD_RALT)
50 | s_KeyMod &= ~KMOD_CTRL;
51 | handled = TwKeyPressed(event->text.text[0], s_KeyMod);
52 | }
53 | }
54 | s_KeyMod = 0;
55 | break;
56 | case SDL_KEYDOWN:
57 | if( event->key.keysym.sym & SDLK_SCANCODE_MASK )
58 | {
59 | int key = 0;
60 | switch( event->key.keysym.sym )
61 | {
62 | case SDLK_UP:
63 | key = TW_KEY_UP;
64 | break;
65 | case SDLK_DOWN:
66 | key = TW_KEY_DOWN;
67 | break;
68 | case SDLK_RIGHT:
69 | key = TW_KEY_RIGHT;
70 | break;
71 | case SDLK_LEFT:
72 | key = TW_KEY_LEFT;
73 | break;
74 | case SDLK_INSERT:
75 | key = TW_KEY_INSERT;
76 | break;
77 | case SDLK_HOME:
78 | key = TW_KEY_HOME;
79 | break;
80 | case SDLK_END:
81 | key = TW_KEY_END;
82 | break;
83 | case SDLK_PAGEUP:
84 | key = TW_KEY_PAGE_UP;
85 | break;
86 | case SDLK_PAGEDOWN:
87 | key = TW_KEY_PAGE_DOWN;
88 | break;
89 | default:
90 | if( event->key.keysym.sym>=SDLK_F1 && event->key.keysym.sym<=SDLK_F12 )
91 | key = event->key.keysym.sym + TW_KEY_F1 - SDLK_F1;
92 | }
93 | if( key!=0 )
94 | handled = TwKeyPressed(key, event->key.keysym.mod);
95 | }
96 | else if( event->key.keysym.mod & TW_KMOD_ALT )
97 | handled = TwKeyPressed(event->key.keysym.sym & 0xFF, event->key.keysym.mod);
98 | else
99 | s_KeyMod = event->key.keysym.mod;
100 | break;
101 | case SDL_KEYUP:
102 | s_KeyMod = 0;
103 | break;
104 | case SDL_MOUSEMOTION:
105 | handled = TwMouseMotion(event->motion.x, event->motion.y);
106 | break;
107 | case SDL_MOUSEBUTTONUP:
108 | case SDL_MOUSEBUTTONDOWN:
109 | if( event->type==SDL_MOUSEBUTTONDOWN && (event->button.button==4 || event->button.button==5) ) // mouse wheel
110 | {
111 | static int s_WheelPos = 0;
112 | if( event->button.button==4 )
113 | ++s_WheelPos;
114 | else
115 | --s_WheelPos;
116 | handled = TwMouseWheel(s_WheelPos);
117 | }
118 | else
119 | handled = TwMouseButton((event->type==SDL_MOUSEBUTTONUP)?TW_MOUSE_RELEASED:TW_MOUSE_PRESSED, (TwMouseButtonID)event->button.button);
120 | break;
121 | case SDL_VIDEORESIZE:
122 | // tell the new size to TweakBar
123 | TwWindowSize(event->resize.w, event->resize.h);
124 | // do not set 'handled', SDL_VIDEORESIZE may be also processed by the calling application
125 | break;
126 | }
127 |
128 | return handled;
129 | }
130 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwEventSDL20.c:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwEventSDL20.c
4 | // @brief Helper:
5 | // translate and re-send mouse and keyboard events
6 | // from SDL 2.0 event loop to AntTweakBar
7 | //
8 | // @author Philippe Decaudin, Marius Schilder
9 | // @license This file is part of the AntTweakBar library.
10 | // For conditions of distribution and use, see License.txt
11 | //
12 | // ---------------------------------------------------------------------------
13 |
14 |
15 | #include "MiniSDL20.h"
16 | #include
17 | #include
18 |
19 | // The way SDL handles keyboard events has changed between version 1.2
20 | // and 2.0. It is now more difficult to translate SDL keyboard events to
21 | // AntTweakBar events. The following code is an attempt to do so, but
22 | // it is rather complex and not always accurate (eg, CTRL+1 is not handled).
23 | // If someone knows a better and more robust way to do the keyboard events
24 | // translation, please let me know.
25 |
26 | // TwEventSDL returns zero if msg has not been handled,
27 | // and a non-zero value if it has been handled by the AntTweakBar library.
28 | int TW_CALL TwEventSDL20(const void *sdlEvent)
29 | {
30 | int handled = 0;
31 | const SDL_Event *event = (const SDL_Event *)sdlEvent;
32 |
33 | if( event==NULL )
34 | return 0;
35 |
36 | switch( event->type )
37 | {
38 | case SDL_KEYDOWN:
39 | if( event->key.keysym.sym & SDLK_SCANCODE_MASK ) {
40 | int key = 0;
41 | switch( event->key.keysym.scancode ) {
42 | case SDL_SCANCODE_UP:
43 | key = TW_KEY_UP;
44 | break;
45 | case SDL_SCANCODE_DOWN:
46 | key = TW_KEY_DOWN;
47 | break;
48 | case SDL_SCANCODE_RIGHT:
49 | key = TW_KEY_RIGHT;
50 | break;
51 | case SDL_SCANCODE_LEFT:
52 | key = TW_KEY_LEFT;
53 | break;
54 | case SDL_SCANCODE_INSERT:
55 | key = TW_KEY_INSERT;
56 | break;
57 | case SDL_SCANCODE_HOME:
58 | key = TW_KEY_HOME;
59 | break;
60 | case SDL_SCANCODE_END:
61 | key = TW_KEY_END;
62 | break;
63 | case SDL_SCANCODE_PAGEUP:
64 | key = TW_KEY_PAGE_UP;
65 | break;
66 | case SDL_SCANCODE_PAGEDOWN:
67 | key = TW_KEY_PAGE_DOWN;
68 | break;
69 | default:
70 | if( event->key.keysym.scancode >= SDL_SCANCODE_F1 &&
71 | event->key.keysym.scancode <= SDL_SCANCODE_F12 ) {
72 | key = event->key.keysym.scancode + TW_KEY_F1 - SDL_SCANCODE_F1;
73 | }
74 | break;
75 | }
76 | if( key != 0 ) {
77 | handled = TwKeyPressed(key, event->key.keysym.mod);
78 | }
79 | } else {
80 | handled = TwKeyPressed(event->key.keysym.sym /*& 0xFF*/,
81 | event->key.keysym.mod);
82 | }
83 | break;
84 | case SDL_MOUSEMOTION:
85 | handled = TwMouseMotion(event->motion.x, event->motion.y);
86 | break;
87 | case SDL_MOUSEBUTTONUP:
88 | case SDL_MOUSEBUTTONDOWN:
89 | if( event->type == SDL_MOUSEBUTTONDOWN &&
90 | (event->button.button == 4 || event->button.button == 5) ) {
91 | // mouse wheel
92 | static int s_WheelPos = 0;
93 | if( event->button.button == 4 )
94 | ++s_WheelPos;
95 | else
96 | --s_WheelPos;
97 | handled = TwMouseWheel(s_WheelPos);
98 | } else {
99 | handled = TwMouseButton(
100 | (event->type==SDL_MOUSEBUTTONUP) ?
101 | TW_MOUSE_RELEASED : TW_MOUSE_PRESSED,
102 | (TwMouseButtonID)event->button.button);
103 | }
104 | break;
105 | case SDL_WINDOWEVENT:
106 | if (event->window.event == SDL_WINDOWEVENT_RESIZED) {
107 | // tell the new size to TweakBar
108 | TwWindowSize(event->window.data1, event->window.data2);
109 | // do not set 'handled'
110 | // SDL_VIDEORESIZE may be also processed by the calling application
111 | }
112 | break;
113 | }
114 |
115 | return handled;
116 | }
117 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwEventSFML.cpp:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwEventSFML.cpp
4 | // @brief Helper:
5 | // translate and re-send mouse and keyboard events
6 | // from SFML 1.6 event loop to AntTweakBar
7 | //
8 | // @author Philippe Decaudin
9 | // @license This file is part of the AntTweakBar library.
10 | // For conditions of distribution and use, see License.txt
11 | //
12 | // ---------------------------------------------------------------------------
13 |
14 |
15 | #include "MiniSFML16.h" // a subset of SFML 1.6 headers needed to compile TwEventSFML.cpp
16 | // note: AntTweakBar.dll does not need to link with SFML,
17 | // it just needs some definitions for its helper functions.
18 |
19 | #include
20 |
21 |
22 | // TwEventSFML returns zero if msg has not been handled,
23 | // and a non-zero value if it has been handled by the AntTweakBar library.
24 | int TW_CALL TwEventSFML(const void *sfmlEvent, unsigned char majorVersion, unsigned char minorVersion)
25 | {
26 | // Assume version 1.6 (will possibly not work for version != 1.6, but give it a chance)
27 | /*
28 | if (majorVersion > 1 || (majorVersion == 1 && minorVersion > 6)
29 | {
30 | static const char *g_ErrBadSFMLVersion = "Unsupported SFML version";
31 | TwSetLastError(g_ErrBadSFMLVersion);
32 | return 0;
33 | }
34 | */
35 | (void)majorVersion, (void)minorVersion;
36 |
37 | int handled = 0;
38 | const sf::Event *event = (const sf::Event *)sfmlEvent;
39 | TwMouseAction mouseAction;
40 | int key = 0;
41 | static int s_KMod = 0;
42 | static bool s_PreventTextHandling = false;
43 | static int s_WheelPos = 0;
44 |
45 | if (event == NULL)
46 | return 0;
47 |
48 | switch (event->Type)
49 | {
50 | case sf::Event::KeyPressed:
51 | s_PreventTextHandling = false;
52 | s_KMod = 0;
53 | if (event->Key.Shift) s_KMod |= TW_KMOD_SHIFT;
54 | if (event->Key.Alt) s_KMod |= TW_KMOD_ALT;
55 | if (event->Key.Control) s_KMod |= TW_KMOD_CTRL;
56 | key = 0;
57 | switch (event->Key.Code)
58 | {
59 | case sf::Key::Escape:
60 | key = TW_KEY_ESCAPE;
61 | break;
62 | case sf::Key::Return:
63 | key = TW_KEY_RETURN;
64 | break;
65 | case sf::Key::Tab:
66 | key = TW_KEY_TAB;
67 | break;
68 | case sf::Key::Back:
69 | key = TW_KEY_BACKSPACE;
70 | break;
71 | case sf::Key::PageUp:
72 | key = TW_KEY_PAGE_UP;
73 | break;
74 | case sf::Key::PageDown:
75 | key = TW_KEY_PAGE_DOWN;
76 | break;
77 | case sf::Key::Up:
78 | key = TW_KEY_UP;
79 | break;
80 | case sf::Key::Down:
81 | key = TW_KEY_DOWN;
82 | break;
83 | case sf::Key::Left:
84 | key = TW_KEY_LEFT;
85 | break;
86 | case sf::Key::Right:
87 | key = TW_KEY_RIGHT;
88 | break;
89 | case sf::Key::End:
90 | key = TW_KEY_END;
91 | break;
92 | case sf::Key::Home:
93 | key = TW_KEY_HOME;
94 | break;
95 | case sf::Key::Insert:
96 | key = TW_KEY_INSERT;
97 | break;
98 | case sf::Key::Delete:
99 | key = TW_KEY_DELETE;
100 | break;
101 | case sf::Key::Space:
102 | key = TW_KEY_SPACE;
103 | break;
104 | default:
105 | if (event->Key.Code >= sf::Key::F1 && event->Key.Code <= sf::Key::F15)
106 | key = TW_KEY_F1 + event->Key.Code - sf::Key::F1;
107 | else if (s_KMod & TW_KMOD_ALT)
108 | {
109 | if (event->Key.Code >= sf::Key::A && event->Key.Code <= sf::Key::Z)
110 | {
111 | if (s_KMod & TW_KMOD_SHIFT)
112 | key = 'A' + event->Key.Code - sf::Key::A;
113 | else
114 | key = 'a' + event->Key.Code - sf::Key::A;
115 | }
116 | }
117 | }
118 | if (key != 0)
119 | {
120 | handled = TwKeyPressed(key, s_KMod);
121 | s_PreventTextHandling = true;
122 | }
123 | break;
124 | case sf::Event::KeyReleased:
125 | s_PreventTextHandling = false;
126 | s_KMod = 0;
127 | break;
128 | case sf::Event::TextEntered:
129 | if (!s_PreventTextHandling && event->Text.Unicode != 0 && (event->Text.Unicode & 0xFF00) == 0)
130 | {
131 | if ((event->Text.Unicode & 0xFF) < 32) // CTRL+letter
132 | handled = TwKeyPressed((event->Text.Unicode & 0xFF)+'a'-1, TW_KMOD_CTRL|s_KMod);
133 | else
134 | handled = TwKeyPressed(event->Text.Unicode & 0xFF, 0);
135 | }
136 | s_PreventTextHandling = false;
137 | break;
138 | case sf::Event::MouseMoved:
139 | handled = TwMouseMotion(event->MouseMove.X, event->MouseMove.Y);
140 | break;
141 | case sf::Event::MouseButtonPressed:
142 | case sf::Event::MouseButtonReleased:
143 | mouseAction = (event->Type==sf::Event::MouseButtonPressed) ? TW_MOUSE_PRESSED : TW_MOUSE_RELEASED;
144 | switch (event->MouseButton.Button)
145 | {
146 | case sf::Mouse::Left:
147 | handled = TwMouseButton(mouseAction, TW_MOUSE_LEFT);
148 | break;
149 | case sf::Mouse::Middle:
150 | handled = TwMouseButton(mouseAction, TW_MOUSE_MIDDLE);
151 | break;
152 | case sf::Mouse::Right:
153 | handled = TwMouseButton(mouseAction, TW_MOUSE_RIGHT);
154 | break;
155 | default:
156 | break;
157 | }
158 | break;
159 | case sf::Event::MouseWheelMoved:
160 | s_WheelPos += event->MouseWheel.Delta;
161 | handled = TwMouseWheel(s_WheelPos);
162 | break;
163 | case sf::Event::Resized:
164 | // tell the new size to TweakBar
165 | TwWindowSize(event->Size.Width, event->Size.Height);
166 | // do not set 'handled', sf::Event::Resized may be also processed by the client application
167 | break;
168 | default:
169 | break;
170 | }
171 |
172 | return handled;
173 | }
174 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwEventX11.c:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwEventX11.c
4 | // @brief Helper:
5 | // translate and forward mouse and keyboard events
6 | // from X11 to AntTweakBar
7 | //
8 | // @contrib Greg Popovitch
9 | // @license This file is part of the AntTweakBar library.
10 | // For conditions of distribution and use, see License.txt
11 | //
12 | // ---------------------------------------------------------------------------
13 |
14 | #include
15 | #include
16 | #include
17 | #include
18 |
19 | static int s_KMod = 0;
20 | const int buff_sz = 80;
21 |
22 | // ----------------------------------------------------------------------
23 | // ----------------------------------------------------------------------
24 | /*
25 | static int _XKeyRelease(XEvent *event)
26 | {
27 | KeySym keysym;
28 | char buffer[buff_sz];
29 |
30 | XLookupString((XKeyEvent *)event, buffer, buff_sz, &keysym, 0);
31 |
32 | switch (keysym)
33 | {
34 | case XK_Control_L:
35 | case XK_Control_R: s_KMod &= ~TW_KMOD_CTRL; break;
36 |
37 | case XK_Shift_L:
38 | case XK_Shift_R: s_KMod &= ~TW_KMOD_SHIFT; break;
39 |
40 | case XK_Alt_L:
41 | case XK_Alt_R: s_KMod &= ~TW_KMOD_ALT; break;
42 | }
43 | return 0;
44 | }
45 | */
46 |
47 | // ----------------------------------------------------------------------
48 | // ----------------------------------------------------------------------
49 | static int _XKeyPress(XEvent *event)
50 | {
51 | int modifiers = 0; // modifiers sent to AntTweakBar
52 | int k = 0; // key sent to AntTweakBar
53 | KeySym keysym;
54 | char buffer[buff_sz];
55 |
56 | int num_char = XLookupString((XKeyEvent *)event, buffer, buff_sz, &keysym, 0);
57 |
58 | if (event->xkey.state & ControlMask)
59 | modifiers |= TW_KMOD_CTRL;
60 | if (event->xkey.state & ShiftMask)
61 | modifiers |= TW_KMOD_SHIFT;
62 | if (event->xkey.state & Mod1Mask)
63 | modifiers |= TW_KMOD_ALT;
64 |
65 | switch (keysym)
66 | {
67 | case XK_Control_L:
68 | case XK_Control_R: s_KMod |= TW_KMOD_CTRL; break;
69 |
70 | case XK_Shift_L:
71 | case XK_Shift_R: s_KMod |= TW_KMOD_SHIFT; break;
72 |
73 | case XK_Alt_L:
74 | case XK_Alt_R: s_KMod |= TW_KMOD_ALT; break;
75 |
76 | case XK_Escape: k = TW_KEY_ESCAPE; break;
77 | case XK_Help: k = TW_KEY_F1; break;
78 | case XK_F1: k = TW_KEY_F1; break;
79 | case XK_F2: k = TW_KEY_F2; break;
80 | case XK_F3: k = TW_KEY_F3; break;
81 | case XK_F4: k = TW_KEY_F4; break;
82 | case XK_F5: k = TW_KEY_F5; break;
83 | case XK_F6: k = TW_KEY_F6; break;
84 | case XK_F7: k = TW_KEY_F7; break;
85 | case XK_F8: k = TW_KEY_F8; break;
86 | case XK_F9: k = TW_KEY_F9; break;
87 | case XK_F10: k = TW_KEY_F10; break;
88 | case XK_F11: k = TW_KEY_F11; break;
89 | case XK_F12: k = TW_KEY_F12; break;
90 | case XK_Up: k = TW_KEY_UP; break;
91 | case XK_Down: k = TW_KEY_DOWN; break;
92 | case XK_Right: k = TW_KEY_RIGHT; break;
93 | case XK_Left: k = TW_KEY_LEFT; break;
94 | case XK_Return: k = TW_KEY_RETURN; break;
95 | case XK_Insert: k = TW_KEY_INSERT; break;
96 | case XK_Delete: k = TW_KEY_DELETE; break;
97 | case XK_BackSpace: k = TW_KEY_BACKSPACE; break;
98 | case XK_Home: k = TW_KEY_HOME; break;
99 | case XK_Tab: k = TW_KEY_TAB; break;
100 | case XK_End: k = TW_KEY_END; break;
101 |
102 | #ifdef XK_Enter
103 | case XK_Enter: k = TW_KEY_RETURN; break;
104 | #endif
105 |
106 | #ifdef XK_KP_Home
107 | case XK_KP_Home: k = TW_KEY_HOME; break;
108 | case XK_KP_End: k = TW_KEY_END; break;
109 | case XK_KP_Delete: k = TW_KEY_DELETE; break;
110 | #endif
111 |
112 | #ifdef XK_KP_Up
113 | case XK_KP_Up: k = TW_KEY_UP; break;
114 | case XK_KP_Down: k = TW_KEY_DOWN; break;
115 | case XK_KP_Right: k = TW_KEY_RIGHT; break;
116 | case XK_KP_Left: k = TW_KEY_LEFT; break;
117 | #endif
118 |
119 | #ifdef XK_KP_Page_Up
120 | case XK_KP_Page_Up: k = TW_KEY_PAGE_UP; break;
121 | case XK_KP_Page_Down: k = TW_KEY_PAGE_DOWN; break;
122 | #endif
123 |
124 | #ifdef XK_KP_Tab
125 | case XK_KP_Tab: k = TW_KEY_TAB; break;
126 | #endif
127 |
128 | default:
129 | if (0)
130 | {
131 | // should we do that, or rely on the buffer (see code below)
132 | if (keysym > 12 && keysym < 127)
133 | k = keysym;
134 | }
135 | break;
136 | }
137 |
138 | if (k == 0 && num_char)
139 | {
140 | int i, handled = 0;
141 | for (i=0; i 0) ? TwKeyPressed(k, modifiers) : 0;
150 | }
151 |
152 | // ----------------------------------------------------------------------
153 | // ----------------------------------------------------------------------
154 | static int _XButtonEvent(XEvent *event)
155 | {
156 | TwMouseAction action = (event->type == ButtonPress) ? TW_MOUSE_PRESSED : TW_MOUSE_RELEASED;
157 | XButtonEvent *xbe = (XButtonEvent *)event;
158 | return TwMouseButton(action, xbe->button);
159 | }
160 |
161 | // ----------------------------------------------------------------------
162 | // ----------------------------------------------------------------------
163 | static int _XConfigureEvent(XEvent *event)
164 | {
165 | XConfigureEvent *xce = (XConfigureEvent *)event;
166 | TwWindowSize(xce->width, xce->height);
167 | return 0;
168 | }
169 |
170 | // ----------------------------------------------------------------------
171 | // ----------------------------------------------------------------------
172 | static int _XMotionEvent(XEvent *event)
173 | {
174 | XMotionEvent *xme = (XMotionEvent *)event;
175 | return TwMouseMotion(xme->x, xme->y);
176 | }
177 |
178 | // ----------------------------------------------------------------------
179 | // ----------------------------------------------------------------------
180 | TW_API int TW_CDECL_CALL TwEventX11(void *xevent)
181 | {
182 | XEvent *event = (XEvent *)xevent;
183 |
184 | switch (event->type)
185 | {
186 | case KeyPress:
187 | return _XKeyPress(xevent);
188 |
189 | case KeyRelease:
190 | return 0; // _XKeyRelease(xevent);
191 |
192 | case ButtonPress:
193 | case ButtonRelease:
194 | return _XButtonEvent(xevent);
195 |
196 | case MotionNotify:
197 | return _XMotionEvent(xevent);
198 |
199 | case ConfigureNotify:
200 | return _XConfigureEvent(xevent);
201 |
202 | default:
203 | break;
204 | }
205 | return 0;
206 | }
207 |
208 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwFonts.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/krux02/nimAntTweakBar/5edfe9a0c019674dba3260dc6b112611d6619c5b/cAntTweakBar/src/TwFonts.h
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwGraph.h:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwGraph.h
4 | // @brief ITwGraph pure interface
5 | // @author Philippe Decaudin
6 | // @license This file is part of the AntTweakBar library.
7 | // For conditions of distribution and use, see License.txt
8 | //
9 | // note: Private header
10 | //
11 | // ---------------------------------------------------------------------------
12 |
13 |
14 | #if !defined ANT_TW_GRAPH_INCLUDED
15 | #define ANT_TW_GRAPH_INCLUDED
16 |
17 | #include "TwColors.h"
18 | #include "TwFonts.h"
19 |
20 |
21 | // ---------------------------------------------------------------------------
22 |
23 | #ifdef DrawText // DirectX redefines 'DrawText' !!
24 | # undef DrawText
25 | #endif // DrawText
26 |
27 | class ITwGraph
28 | {
29 | public:
30 | virtual int Init() = 0;
31 | virtual int Shut() = 0;
32 | virtual void BeginDraw(int _WndWidth, int _WndHeight) = 0;
33 | virtual void EndDraw() = 0;
34 | virtual bool IsDrawing() = 0;
35 | virtual void Restore() = 0;
36 |
37 | virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased=false) = 0;
38 | virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color, bool _AntiAliased=false) = 0;
39 | virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11) = 0;
40 | virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color) = 0;
41 | enum Cull { CULL_NONE, CULL_CW, CULL_CCW };
42 | virtual void DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode) = 0;
43 |
44 | virtual void * NewTextObj() = 0;
45 | virtual void DeleteTextObj(void *_TextObj) = 0;
46 | virtual void BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth) = 0;
47 | virtual void DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor) = 0;
48 |
49 | virtual void ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY) = 0;
50 | virtual void RestoreViewport() = 0;
51 | virtual void SetScissor(int _X0, int _Y0, int _Width, int _Height) = 0;
52 |
53 | virtual ~ITwGraph() {} // required by gcc
54 | };
55 |
56 | // ---------------------------------------------------------------------------
57 |
58 | #endif // ANT_TW_GRAPH_INCLUDED
59 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwOpenGL.h:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwOpenGL.h
4 | // @brief OpenGL graph functions
5 | // @author Philippe Decaudin
6 | // @license This file is part of the AntTweakBar library.
7 | // For conditions of distribution and use, see License.txt
8 | //
9 | // note: Private header
10 | //
11 | // ---------------------------------------------------------------------------
12 |
13 |
14 | #if !defined ANT_TW_OPENGL_INCLUDED
15 | #define ANT_TW_OPENGL_INCLUDED
16 |
17 | #include "TwGraph.h"
18 |
19 | // ---------------------------------------------------------------------------
20 |
21 | class CTwGraphOpenGL : public ITwGraph
22 | {
23 | public:
24 | virtual int Init();
25 | virtual int Shut();
26 | virtual void BeginDraw(int _WndWidth, int _WndHeight);
27 | virtual void EndDraw();
28 | virtual bool IsDrawing();
29 | virtual void Restore();
30 | virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased=false);
31 | virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color, bool _AntiAliased=false) { DrawLine(_X0, _Y0, _X1, _Y1, _Color, _Color, _AntiAliased); }
32 | virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11);
33 | virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color) { DrawRect(_X0, _Y0, _X1, _Y1, _Color, _Color, _Color, _Color); }
34 | virtual void DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode);
35 |
36 | virtual void * NewTextObj();
37 | virtual void DeleteTextObj(void *_TextObj);
38 | virtual void BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth);
39 | virtual void DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor);
40 |
41 | virtual void ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY);
42 | virtual void RestoreViewport();
43 | virtual void SetScissor(int _X0, int _Y0, int _Width, int _Height);
44 |
45 | protected:
46 | bool m_Drawing;
47 | GLuint m_FontTexID;
48 | const CTexFont * m_FontTex;
49 | GLfloat m_PrevLineWidth;
50 | GLint m_PrevTexEnv;
51 | GLint m_PrevPolygonMode[2];
52 | GLint m_MaxClipPlanes;
53 | GLint m_PrevTexture;
54 | GLint m_PrevArrayBufferARB;
55 | GLint m_PrevElementArrayBufferARB;
56 | GLboolean m_PrevVertexProgramARB;
57 | GLboolean m_PrevFragmentProgramARB;
58 | GLuint m_PrevProgramObjectARB;
59 | GLboolean m_PrevTexture3D;
60 | enum EMaxTextures { MAX_TEXTURES = 128 };
61 | GLboolean m_PrevActiveTexture1D[MAX_TEXTURES];
62 | GLboolean m_PrevActiveTexture2D[MAX_TEXTURES];
63 | GLboolean m_PrevActiveTexture3D[MAX_TEXTURES];
64 | GLboolean m_PrevClientTexCoordArray[MAX_TEXTURES];
65 | GLint m_PrevActiveTextureARB;
66 | GLint m_PrevClientActiveTextureARB;
67 | bool m_SupportTexRect;
68 | GLboolean m_PrevTexRectARB;
69 | GLint m_PrevBlendEquation;
70 | GLint m_PrevBlendEquationRGB;
71 | GLint m_PrevBlendEquationAlpha;
72 | GLint m_PrevBlendSrcRGB;
73 | GLint m_PrevBlendDstRGB;
74 | GLint m_PrevBlendSrcAlpha;
75 | GLint m_PrevBlendDstAlpha;
76 | GLuint m_PrevVertexArray;
77 | GLint m_ViewportInit[4];
78 | GLfloat m_ProjMatrixInit[16];
79 | enum EMaxVtxAttribs { MAX_VERTEX_ATTRIBS = 128 };
80 | GLint m_PrevEnabledVertexAttrib[MAX_VERTEX_ATTRIBS];
81 | int m_WndWidth;
82 | int m_WndHeight;
83 |
84 | struct Vec2 { GLfloat x, y; Vec2(){} Vec2(GLfloat _X, GLfloat _Y):x(_X),y(_Y){} Vec2(int _X, int _Y):x(GLfloat(_X)),y(GLfloat(_Y)){} };
85 | struct CTextObj
86 | {
87 | std::vector m_TextVerts;
88 | std::vector m_TextUVs;
89 | std::vector m_BgVerts;
90 | std::vectorm_Colors;
91 | std::vectorm_BgColors;
92 | };
93 | };
94 |
95 | // ---------------------------------------------------------------------------
96 |
97 |
98 | #endif // !defined ANT_TW_OPENGL_INCLUDED
99 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwOpenGLCore.h:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwOpenGLCore.h
4 | // @brief OpenGL Core graph functions
5 | // @author Philippe Decaudin
6 | // @license This file is part of the AntTweakBar library.
7 | // For conditions of distribution and use, see License.txt
8 | //
9 | // note: Private header
10 | //
11 | // ---------------------------------------------------------------------------
12 |
13 |
14 | #if !defined ANT_TW_OPENGL_CORE_INCLUDED
15 | #define ANT_TW_OPENGL_CORE_INCLUDED
16 |
17 | #include "TwGraph.h"
18 |
19 | // ---------------------------------------------------------------------------
20 |
21 | class CTwGraphOpenGLCore : public ITwGraph
22 | {
23 | public:
24 | virtual int Init();
25 | virtual int Shut();
26 | virtual void BeginDraw(int _WndWidth, int _WndHeight);
27 | virtual void EndDraw();
28 | virtual bool IsDrawing();
29 | virtual void Restore();
30 | virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased=false);
31 | virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color, bool _AntiAliased=false) { DrawLine(_X0, _Y0, _X1, _Y1, _Color, _Color, _AntiAliased); }
32 | virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11);
33 | virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color) { DrawRect(_X0, _Y0, _X1, _Y1, _Color, _Color, _Color, _Color); }
34 | virtual void DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode);
35 |
36 | virtual void * NewTextObj();
37 | virtual void DeleteTextObj(void *_TextObj);
38 | virtual void BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth);
39 | virtual void DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor);
40 |
41 | virtual void ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY);
42 | virtual void RestoreViewport();
43 | virtual void SetScissor(int _X0, int _Y0, int _Width, int _Height);
44 |
45 | protected:
46 | bool m_Drawing;
47 | GLuint m_FontTexID;
48 | const CTexFont * m_FontTex;
49 |
50 | GLfloat m_PrevLineWidth;
51 | GLint m_PrevActiveTexture;
52 | GLint m_PrevTexture;
53 | GLint m_PrevVArray;
54 | GLboolean m_PrevLineSmooth;
55 | GLboolean m_PrevCullFace;
56 | GLboolean m_PrevDepthTest;
57 | GLboolean m_PrevBlend;
58 | GLint m_PrevSrcBlend;
59 | GLint m_PrevDstBlend;
60 | GLboolean m_PrevScissorTest;
61 | GLint m_PrevScissorBox[4];
62 | GLint m_PrevViewport[4];
63 | GLuint m_PrevProgramObject;
64 |
65 | GLuint m_LineRectVS;
66 | GLuint m_LineRectFS;
67 | GLuint m_LineRectProgram;
68 | GLuint m_LineRectVArray;
69 | GLuint m_LineRectVertices;
70 | GLuint m_LineRectColors;
71 | GLuint m_TriVS;
72 | GLuint m_TriFS;
73 | GLuint m_TriProgram;
74 | GLuint m_TriUniVS;
75 | GLuint m_TriUniFS;
76 | GLuint m_TriUniProgram;
77 | GLuint m_TriTexVS;
78 | GLuint m_TriTexFS;
79 | GLuint m_TriTexProgram;
80 | GLuint m_TriTexUniVS;
81 | GLuint m_TriTexUniFS;
82 | GLuint m_TriTexUniProgram;
83 | GLuint m_TriVArray;
84 | GLuint m_TriVertices;
85 | GLuint m_TriUVs;
86 | GLuint m_TriColors;
87 | GLint m_TriLocationOffset;
88 | GLint m_TriLocationWndSize;
89 | GLint m_TriUniLocationOffset;
90 | GLint m_TriUniLocationWndSize;
91 | GLint m_TriUniLocationColor;
92 | GLint m_TriTexLocationOffset;
93 | GLint m_TriTexLocationWndSize;
94 | GLint m_TriTexLocationTexture;
95 | GLint m_TriTexUniLocationOffset;
96 | GLint m_TriTexUniLocationWndSize;
97 | GLint m_TriTexUniLocationColor;
98 | GLint m_TriTexUniLocationTexture;
99 | size_t m_TriBufferSize;
100 |
101 | int m_WndWidth;
102 | int m_WndHeight;
103 | int m_OffsetX;
104 | int m_OffsetY;
105 |
106 | struct Vec2 { GLfloat x, y; Vec2(){} Vec2(GLfloat _X, GLfloat _Y):x(_X),y(_Y){} Vec2(int _X, int _Y):x(GLfloat(_X)),y(GLfloat(_Y)){} };
107 | struct CTextObj
108 | {
109 | std::vector m_TextVerts;
110 | std::vector m_TextUVs;
111 | std::vector m_BgVerts;
112 | std::vectorm_Colors;
113 | std::vectorm_BgColors;
114 | };
115 | void ResizeTriBuffers(size_t _NewSize);
116 | };
117 |
118 | // ---------------------------------------------------------------------------
119 |
120 |
121 | #endif // !defined ANT_TW_OPENGL_CORE_INCLUDED
122 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwPrecomp.cpp:
--------------------------------------------------------------------------------
1 | #include "TwPrecomp.h"
2 |
--------------------------------------------------------------------------------
/cAntTweakBar/src/TwPrecomp.h:
--------------------------------------------------------------------------------
1 | // ---------------------------------------------------------------------------
2 | //
3 | // @file TwPrecomp.h
4 | // @brief Precompiled header
5 | // @author Philippe Decaudin
6 | // @license This file is part of the AntTweakBar library.
7 | // For conditions of distribution and use, see License.txt
8 | //
9 | // note: Private header
10 | //
11 | // ---------------------------------------------------------------------------
12 |
13 |
14 | #if !defined ANT_TW_PRECOMP_INCLUDED
15 | #define ANT_TW_PRECOMP_INCLUDED
16 |
17 |
18 | #if defined _MSC_VER
19 | # pragma warning(disable: 4514) // unreferenced inline function has been removed
20 | # pragma warning(disable: 4710) // function not inlined
21 | # pragma warning(disable: 4786) // template name truncated
22 | # pragma warning(disable: 4530) // exceptions not handled
23 | # define _CRT_SECURE_NO_DEPRECATE // visual 8 secure crt warning
24 | #endif
25 |
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 |
34 | #if defined(_MSC_VER) && _MSC_VER<=1200
35 | # pragma warning(push, 3)
36 | #endif
37 | #include
38 | #include
39 | #include
40 | #include