├── SFML
├── SFML
│ ├── config.txt
│ ├── SFML.APS
│ ├── SFML.rc
│ ├── base.png
│ ├── icon1.ico
│ ├── base_0001.png
│ ├── base_0010.png
│ ├── base_0011.png
│ ├── base_0100.png
│ ├── base_1000.png
│ ├── base_1100.png
│ ├── base_left.png
│ ├── base_right.png
│ ├── openal32.dll
│ ├── Release
│ │ ├── SFML.res
│ │ ├── Source.obj
│ │ ├── vc141.pdb
│ │ ├── SFML.tlog
│ │ │ ├── CL.read.1.tlog
│ │ │ ├── CL.write.1.tlog
│ │ │ ├── link.read.1.tlog
│ │ │ ├── rc.read.1.tlog
│ │ │ ├── rc.write.1.tlog
│ │ │ ├── CL.command.1.tlog
│ │ │ ├── SFML.write.1u.tlog
│ │ │ ├── link.write.1.tlog
│ │ │ ├── rc.command.1.tlog
│ │ │ ├── link.command.1.tlog
│ │ │ └── SFML.lastbuildstate
│ │ └── SFML.log
│ ├── sfml-audio-2.dll
│ ├── sfml-audio-d-2.dll
│ ├── sfml-graphics-2.dll
│ ├── sfml-network-2.dll
│ ├── sfml-system-2.dll
│ ├── sfml-system-d-2.dll
│ ├── sfml-window-2.dll
│ ├── sfml-window-d-2.dll
│ ├── sfml-graphics-d-2.dll
│ ├── sfml-network-d-2.dll
│ ├── SFML.vcxproj.user
│ ├── resource.h
│ ├── SFML.vcxproj.filters
│ ├── Source.cpp
│ └── SFML.vcxproj
├── Release
│ ├── config.txt
│ ├── SFML.exe
│ ├── SFML.pdb
│ ├── base.png
│ ├── SFML.iobj
│ ├── SFML.ipdb
│ ├── base_0001.png
│ ├── base_0010.png
│ ├── base_0011.png
│ ├── base_0100.png
│ ├── base_1000.png
│ ├── base_1100.png
│ ├── base_left.png
│ ├── base_right.png
│ ├── sfml-system-2.dll
│ ├── sfml-window-2.dll
│ └── sfml-graphics-2.dll
└── SFML.sln
└── README.md
/SFML/SFML/config.txt:
--------------------------------------------------------------------------------
1 | key1=z
2 | key2=x
3 | key3=,
4 | key4=.
--------------------------------------------------------------------------------
/SFML/Release/config.txt:
--------------------------------------------------------------------------------
1 | key1=z
2 | key2=x
3 | key3=,
4 | key4=.
--------------------------------------------------------------------------------
/SFML/SFML/SFML.APS:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/SFML.APS
--------------------------------------------------------------------------------
/SFML/SFML/SFML.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/SFML.rc
--------------------------------------------------------------------------------
/SFML/SFML/base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/base.png
--------------------------------------------------------------------------------
/SFML/SFML/icon1.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/icon1.ico
--------------------------------------------------------------------------------
/SFML/Release/SFML.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/SFML.exe
--------------------------------------------------------------------------------
/SFML/Release/SFML.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/SFML.pdb
--------------------------------------------------------------------------------
/SFML/Release/base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/base.png
--------------------------------------------------------------------------------
/SFML/Release/SFML.iobj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/SFML.iobj
--------------------------------------------------------------------------------
/SFML/Release/SFML.ipdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/SFML.ipdb
--------------------------------------------------------------------------------
/SFML/SFML/base_0001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/base_0001.png
--------------------------------------------------------------------------------
/SFML/SFML/base_0010.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/base_0010.png
--------------------------------------------------------------------------------
/SFML/SFML/base_0011.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/base_0011.png
--------------------------------------------------------------------------------
/SFML/SFML/base_0100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/base_0100.png
--------------------------------------------------------------------------------
/SFML/SFML/base_1000.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/base_1000.png
--------------------------------------------------------------------------------
/SFML/SFML/base_1100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/base_1100.png
--------------------------------------------------------------------------------
/SFML/SFML/base_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/base_left.png
--------------------------------------------------------------------------------
/SFML/SFML/base_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/base_right.png
--------------------------------------------------------------------------------
/SFML/SFML/openal32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/openal32.dll
--------------------------------------------------------------------------------
/SFML/Release/base_0001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/base_0001.png
--------------------------------------------------------------------------------
/SFML/Release/base_0010.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/base_0010.png
--------------------------------------------------------------------------------
/SFML/Release/base_0011.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/base_0011.png
--------------------------------------------------------------------------------
/SFML/Release/base_0100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/base_0100.png
--------------------------------------------------------------------------------
/SFML/Release/base_1000.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/base_1000.png
--------------------------------------------------------------------------------
/SFML/Release/base_1100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/base_1100.png
--------------------------------------------------------------------------------
/SFML/Release/base_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/base_left.png
--------------------------------------------------------------------------------
/SFML/SFML/Release/SFML.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/Release/SFML.res
--------------------------------------------------------------------------------
/SFML/SFML/sfml-audio-2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/sfml-audio-2.dll
--------------------------------------------------------------------------------
/SFML/Release/base_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/base_right.png
--------------------------------------------------------------------------------
/SFML/SFML/Release/Source.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/Release/Source.obj
--------------------------------------------------------------------------------
/SFML/SFML/Release/vc141.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/Release/vc141.pdb
--------------------------------------------------------------------------------
/SFML/SFML/sfml-audio-d-2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/sfml-audio-d-2.dll
--------------------------------------------------------------------------------
/SFML/SFML/sfml-graphics-2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/sfml-graphics-2.dll
--------------------------------------------------------------------------------
/SFML/SFML/sfml-network-2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/sfml-network-2.dll
--------------------------------------------------------------------------------
/SFML/SFML/sfml-system-2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/sfml-system-2.dll
--------------------------------------------------------------------------------
/SFML/SFML/sfml-system-d-2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/sfml-system-d-2.dll
--------------------------------------------------------------------------------
/SFML/SFML/sfml-window-2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/sfml-window-2.dll
--------------------------------------------------------------------------------
/SFML/SFML/sfml-window-d-2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/sfml-window-d-2.dll
--------------------------------------------------------------------------------
/SFML/Release/sfml-system-2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/sfml-system-2.dll
--------------------------------------------------------------------------------
/SFML/Release/sfml-window-2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/sfml-window-2.dll
--------------------------------------------------------------------------------
/SFML/SFML/sfml-graphics-d-2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/sfml-graphics-d-2.dll
--------------------------------------------------------------------------------
/SFML/SFML/sfml-network-d-2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/sfml-network-d-2.dll
--------------------------------------------------------------------------------
/SFML/Release/sfml-graphics-2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/Release/sfml-graphics-2.dll
--------------------------------------------------------------------------------
/SFML/SFML/Release/SFML.tlog/CL.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/Release/SFML.tlog/CL.read.1.tlog
--------------------------------------------------------------------------------
/SFML/SFML/Release/SFML.tlog/CL.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/Release/SFML.tlog/CL.write.1.tlog
--------------------------------------------------------------------------------
/SFML/SFML/Release/SFML.tlog/link.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/Release/SFML.tlog/link.read.1.tlog
--------------------------------------------------------------------------------
/SFML/SFML/Release/SFML.tlog/rc.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/Release/SFML.tlog/rc.read.1.tlog
--------------------------------------------------------------------------------
/SFML/SFML/Release/SFML.tlog/rc.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/Release/SFML.tlog/rc.write.1.tlog
--------------------------------------------------------------------------------
/SFML/SFML/Release/SFML.tlog/CL.command.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/Release/SFML.tlog/CL.command.1.tlog
--------------------------------------------------------------------------------
/SFML/SFML/Release/SFML.tlog/SFML.write.1u.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/Release/SFML.tlog/SFML.write.1u.tlog
--------------------------------------------------------------------------------
/SFML/SFML/Release/SFML.tlog/link.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/Release/SFML.tlog/link.write.1.tlog
--------------------------------------------------------------------------------
/SFML/SFML/Release/SFML.tlog/rc.command.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/Release/SFML.tlog/rc.command.1.tlog
--------------------------------------------------------------------------------
/SFML/SFML/Release/SFML.tlog/link.command.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malad1211/Mania-Cat/HEAD/SFML/SFML/Release/SFML.tlog/link.command.1.tlog
--------------------------------------------------------------------------------
/SFML/SFML/SFML.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/SFML/SFML/Release/SFML.tlog/SFML.lastbuildstate:
--------------------------------------------------------------------------------
1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17134.0
2 | Release|Win32|E:\SFML\|
3 |
--------------------------------------------------------------------------------
/SFML/SFML/Release/SFML.log:
--------------------------------------------------------------------------------
1 | Source.cpp
2 | Generating code
3 | All 242 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
4 | Finished generating code
5 | SFML.vcxproj -> E:\SFML\Release\SFML.exe
6 |
--------------------------------------------------------------------------------
/SFML/SFML/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by SFML.rc
4 | //
5 | #define IDI_ICON2 102
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 103
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Mania-Cat
2 | Bongo cat overlay for VSRG
3 |
4 | Credits: u/PunyFlash and their bongo cat key tracker. It was helpful to see how they built theirs when trying to optimize this project.
5 |
6 | Link to u/PunyFlash 's project: https://github.com/PunyFlash/Bongo-Cat
7 |
8 | Now supports up to 8 keys. Make sure it is not minimized or it won't work. To change the config, open the Config 4/8k.exe and input the keys you want to set in order. If you want to change the config directly, google the virtual keycodes of the keys you want to set (https://docs.microsoft.com/en-us/windows/desktop/inputdev/virtual-key-codes , or if you don't have time, https://keycode.info/ NOTE: Some browsers, ie: Firefox, give a different keycode than the virtual keycode of some characters on this site). Use the (stays on top) .exes when you want to see the cat in-game (ONLY works in borderless). You can also edit the sprites if you don't like my shitty mspaint skill, just don't change their names. To record with fullscreen, use Game Capture instead of Window Capture for the bongo cat. All thanks to SoroCario for this solution.
9 |
10 | Download:
11 | https://github.com/malad1211/Mania-Cat/releases
12 |
13 | Gameplay:
14 | https://www.youtube.com/watch?v=dzJBNSbxG8I
15 |
16 | Make it shows up in-game borderless example:
17 | https://www.youtube.com/watch?v=AI8HFvQQLxY
18 |
19 | Borderless Gameplay (recorded separately because OBS display capture kills my framerate even harder):
20 | https://www.youtube.com/watch?v=mW64zBShEt8
21 |
--------------------------------------------------------------------------------
/SFML/SFML.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.28010.2036
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SFML", "SFML\SFML.vcxproj", "{EBA6D571-D189-4CE1-8125-E5FE6201CFAB}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {EBA6D571-D189-4CE1-8125-E5FE6201CFAB}.Debug|x64.ActiveCfg = Debug|x64
17 | {EBA6D571-D189-4CE1-8125-E5FE6201CFAB}.Debug|x64.Build.0 = Debug|x64
18 | {EBA6D571-D189-4CE1-8125-E5FE6201CFAB}.Debug|x86.ActiveCfg = Debug|Win32
19 | {EBA6D571-D189-4CE1-8125-E5FE6201CFAB}.Debug|x86.Build.0 = Debug|Win32
20 | {EBA6D571-D189-4CE1-8125-E5FE6201CFAB}.Release|x64.ActiveCfg = Release|x64
21 | {EBA6D571-D189-4CE1-8125-E5FE6201CFAB}.Release|x64.Build.0 = Release|x64
22 | {EBA6D571-D189-4CE1-8125-E5FE6201CFAB}.Release|x86.ActiveCfg = Release|Win32
23 | {EBA6D571-D189-4CE1-8125-E5FE6201CFAB}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {F20E5321-C2ED-4177-B134-D093930CB93F}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/SFML/SFML/SFML.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
23 |
24 | Header Files
25 |
26 |
27 |
28 |
29 | Resource Files
30 |
31 |
32 |
33 |
34 | Resource Files
35 |
36 |
37 | Resource Files
38 |
39 |
40 |
--------------------------------------------------------------------------------
/SFML/SFML/Source.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | int key[4] = { 0x5A, 0x58 , VK_OEM_COMMA, VK_OEM_PERIOD };
10 | bool last_keystroke[4] = { FALSE , FALSE , FALSE , FALSE };
11 | bool keystroke[4] = { FALSE , FALSE , FALSE , FALSE };
12 | bool display = FALSE;
13 | HHOOK keyboardHook;
14 | sf::Texture texture[9];
15 | sf::Sprite Cat, LeftPaw, RightPaw;
16 | sf::RenderWindow window(sf::VideoMode(1189, 669), "Mania Cat");
17 |
18 | // Get window handle
19 | sf::WindowHandle handle = window.getSystemHandle();
20 |
21 | void Keypress(bool UP, int i) {
22 | bool changed = FALSE;
23 | if (UP == FALSE) keystroke[i] = TRUE;
24 | else if (UP == TRUE) keystroke[i] = FALSE;
25 |
26 | if (last_keystroke[i] != keystroke[i]) {
27 | changed = TRUE;
28 | last_keystroke[i] = keystroke[i];
29 | }
30 |
31 | if (changed) {
32 | display = TRUE;
33 | //std::this_thread::sleep_for(std::chrono::milliseconds(50));
34 |
35 | int temp = (keystroke[0] * 10) + keystroke[1];
36 | switch (temp) {
37 | case 10:
38 | LeftPaw.setTexture(texture[1]);
39 | break;
40 | case 11:
41 | LeftPaw.setTexture(texture[2]);
42 | break;
43 | case 01:
44 | LeftPaw.setTexture(texture[3]);
45 | break;
46 | case 0:
47 | LeftPaw.setTexture(texture[7]);
48 | }
49 |
50 | temp = (keystroke[3] * 10) + keystroke[2];
51 | temp = 20;
52 | switch (temp) {
53 | case 10:
54 | RightPaw.setTexture(texture[4]);
55 | break;
56 | case 11:
57 | RightPaw.setTexture(texture[5]);
58 | break;
59 | case 01:
60 | RightPaw.setTexture(texture[6]);
61 | break;
62 | case 0:
63 | RightPaw.setTexture(texture[8]);
64 | }
65 | window.clear();
66 | window.draw(Cat);
67 | window.draw(LeftPaw);
68 | window.draw(RightPaw);
69 | window.display();
70 | }
71 | }
72 |
73 | void DrawHand(int state) {
74 | switch (state) {
75 | case 10:
76 | LeftPaw.setTexture(texture[1]);
77 | break;
78 | case 11:
79 | LeftPaw.setTexture(texture[2]);
80 | break;
81 | case 01:
82 | LeftPaw.setTexture(texture[3]);
83 | break;
84 | case 00:
85 | LeftPaw.setTexture(texture[7]);
86 | break;
87 | case 32:
88 | RightPaw.setTexture(texture[4]);
89 | break;
90 | case 33:
91 | RightPaw.setTexture(texture[5]);
92 | break;
93 | case 23:
94 | RightPaw.setTexture(texture[6]);
95 | break;
96 | case 22:
97 | RightPaw.setTexture(texture[8]);
98 | break;
99 | }
100 | }
101 |
102 | LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
103 | WPARAM wParam,
104 | LPARAM lParam)
105 |
106 | {
107 | if (nCode == HC_ACTION)
108 | {
109 | PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT)lParam;
110 | switch (wParam)
111 | {
112 | case WM_KEYDOWN:
113 | for (int i = 0; i < 4; i++) {
114 | if (p->vkCode == key[i]) {
115 | bool changed = FALSE;
116 | keystroke[i] = TRUE;
117 | if (last_keystroke[i] != keystroke[i]) {
118 | changed = TRUE;
119 | last_keystroke[i] = TRUE;
120 | }
121 | if (changed)
122 | {
123 | int state;
124 | if (i < 2)
125 | state = (keystroke[0] * 10) + keystroke[1];
126 | else
127 | state = ((keystroke[3] + 2) * 10) + keystroke[2] + 2;
128 | DrawHand(state);
129 | }
130 | break;
131 | }
132 | }
133 | break;
134 | case WM_KEYUP:
135 | for (int i = 0; i < 4; i++) {
136 | if (p->vkCode == key[i]) {
137 | bool changed = FALSE;
138 | keystroke[i] = FALSE;
139 | if (last_keystroke[i] != keystroke[i]) {
140 | changed = TRUE;
141 | last_keystroke[i] = FALSE;
142 | }
143 | if (changed)
144 | {
145 | int state;
146 | if (i < 2)
147 | state = (keystroke[0] * 10) + keystroke[1];
148 | else
149 | state = ((keystroke[3] + 2) * 10) + keystroke[2] + 2;
150 | DrawHand(state);
151 | }
152 | break;
153 | }
154 | }
155 | break;
156 | }
157 | }
158 | return(CallNextHookEx(NULL, nCode, wParam, lParam));
159 | }
160 |
161 |
162 | void KeyboardListener() {
163 | keyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL,
164 | LowLevelKeyboardProc,
165 | NULL,
166 | NULL);
167 |
168 | MSG message{ 0 };
169 | //Waits for user input
170 | while (GetMessage(&message, NULL, 0, 0) != 0)
171 | {
172 | }
173 | // Unhook
174 | UnhookWindowsHookEx(keyboardHook);
175 | //std::cout << "dead\n";
176 | }
177 |
178 |
179 | int main()
180 | {
181 | std::ifstream config;
182 | std::string string;
183 |
184 |
185 | // lazy config lol
186 | config.open("config.txt");
187 | if (!config.fail())
188 | {
189 | int c = 0;
190 | while (std::getline(config, string)) {
191 | for (std::string::size_type i = 0; i < string.size(); i++)
192 | {
193 | if (string[i] == '=') {
194 | key[c] = VkKeyScan(string[i+1]);
195 | c++;
196 | }
197 | }
198 | }
199 | config.close();
200 | }
201 |
202 | if (!texture[0].loadFromFile("base.png"))
203 | return EXIT_FAILURE;
204 | if (!texture[1].loadFromFile("base_1000.png"))
205 | return EXIT_FAILURE;
206 | if (!texture[2].loadFromFile("base_1100.png"))
207 | return EXIT_FAILURE;
208 | if (!texture[3].loadFromFile("base_0100.png"))
209 | return EXIT_FAILURE;
210 | if (!texture[4].loadFromFile("base_0001.png"))
211 | return EXIT_FAILURE;
212 | if (!texture[5].loadFromFile("base_0011.png"))
213 | return EXIT_FAILURE;
214 | if (!texture[6].loadFromFile("base_0010.png"))
215 | return EXIT_FAILURE;
216 | if (!texture[7].loadFromFile("base_left.png"))
217 | return EXIT_FAILURE;
218 | if (!texture[8].loadFromFile("base_right.png"))
219 | return EXIT_FAILURE;
220 | Cat.setTexture(texture[0]);
221 | LeftPaw.setTexture(texture[7]);
222 | RightPaw.setTexture(texture[8]);
223 | window.clear();
224 | window.draw(Cat);
225 | window.draw(LeftPaw);
226 | window.draw(RightPaw);
227 | window.display();
228 | window.setFramerateLimit(60);
229 |
230 |
231 | // Set window to topmost
232 | // Uncomment the code and rebuild if you want the window to stay on top
233 | //SetWindowPos(handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
234 |
235 | // Install the low-level keyboard hook
236 | /*keyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL,
237 | LowLevelKeyboardProc,
238 | NULL,
239 | NULL);*/
240 |
241 | std::thread hook(KeyboardListener);
242 | hook.detach();
243 |
244 | while (window.isOpen())
245 | {
246 | sf::Event event;
247 | while (window.pollEvent(event))
248 | {
249 | switch (event.type)
250 | {
251 | case sf::Event::Closed:
252 | UnhookWindowsHookEx(keyboardHook);
253 | window.close();
254 | break;
255 | case (sf::Event::Resized || sf::Event::GainedFocus || sf::Event::LostFocus):
256 |
257 | break;
258 | }
259 | }
260 | window.clear();
261 | window.draw(Cat);
262 | window.draw(LeftPaw);
263 | window.draw(RightPaw);
264 | window.display();
265 | sf::sleep(sf::milliseconds(15));
266 | }
267 | return EXIT_SUCCESS;
268 | }
269 |
--------------------------------------------------------------------------------
/SFML/SFML/SFML.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | 15.0
23 | {EBA6D571-D189-4CE1-8125-E5FE6201CFAB}
24 | SFML
25 | 10.0.17134.0
26 |
27 |
28 |
29 | Application
30 | true
31 | v141
32 | MultiByte
33 |
34 |
35 | Application
36 | false
37 | v141
38 | true
39 | MultiByte
40 |
41 |
42 | Application
43 | true
44 | v141
45 | MultiByte
46 |
47 |
48 | Application
49 | false
50 | v141
51 | true
52 | MultiByte
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | Level3
76 | Disabled
77 | true
78 | true
79 | D:\Visual Studio 2017\lib\SFML-2.5.0-32-bit\include;%(AdditionalIncludeDirectories)
80 |
81 |
82 | D:\Visual Studio 2017\lib\SFML-2.5.0-32-bit\lib;%(AdditionalLibraryDirectories)
83 | sfml-graphics.lib;sfml-audio.lib;sfml-window.lib;sfml-system.lib;sfml-main.lib;%(AdditionalDependencies)
84 |
85 |
86 |
87 |
88 | Level3
89 | Disabled
90 | true
91 | true
92 |
93 |
94 |
95 |
96 | Level3
97 | MaxSpeed
98 | true
99 | true
100 | true
101 | true
102 | D:\Visual Studio 2017\lib\SFML-2.5.0-32-bit\include;%(AdditionalIncludeDirectories)
103 |
104 |
105 | true
106 | true
107 | D:\Visual Studio 2017\lib\SFML-2.5.0-32-bit\lib;%(AdditionalLibraryDirectories)
108 | sfml-graphics.lib;sfml-audio.lib;sfml-window.lib;sfml-system.lib;sfml-main.lib;%(AdditionalDependencies)
109 | Windows
110 |
111 |
112 |
113 |
114 | Level3
115 | MaxSpeed
116 | true
117 | true
118 | true
119 | true
120 |
121 |
122 | true
123 | true
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
--------------------------------------------------------------------------------