Skip to content

Commit

Permalink
Smoother paddle operation
Browse files Browse the repository at this point in the history
  • Loading branch information
makuke1234 committed Jan 1, 2022
1 parent 2c7bdaa commit cb3a3ab
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 29 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PongD2D

![Release version](https://img.shields.io/badge/release-v1.0.0-green.svg)
![Release version](https://img.shields.io/badge/release-v1.0.1-green.svg)
![C version](https://img.shields.io/badge/version-C20-blue.svg)
![C++ version](https://img.shields.io/badge/version-C++20-blue.svg)

Expand All @@ -9,7 +9,7 @@ A pong fork written in C utilising Direct2D API (similar to my other project [Sn

# Obtaining

Windows binaries can be downloaded [here](https://github.com/makuke1234/PongD2D/releases/tag/Release_1.0.0).
Windows binaries can be downloaded [here](https://github.com/makuke1234/PongD2D/releases/tag/Release_1.0.1).


# Controls
Expand Down
22 changes: 22 additions & 0 deletions src/logic.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,28 @@ DWORD WINAPI PongLogic_thread(LPVOID param)
{
case GameMode_normal:
{
// Left pad up
if (GetAsyncKeyState(L'W') & 0x8000)
{
logic->scoring.relLeftPad = clamp(logic->scoring.relLeftPad - 10.0f, -PONG_WALL_MAX, PONG_WALL_MAX);
}
// Left pad down
else if (GetAsyncKeyState('S') & 0x8000)
{
logic->scoring.relLeftPad = clamp(logic->scoring.relLeftPad + 10.0f, -PONG_WALL_MAX, PONG_WALL_MAX);
}
// Right pad up
if (GetAsyncKeyState(VK_UP) & 0x8000)
{
logic->scoring.relRightPad = clamp(logic->scoring.relRightPad - 10.0f, -PONG_WALL_MAX, PONG_WALL_MAX);
}
// Right pad down
else if (GetAsyncKeyState(VK_DOWN) & 0x8000)
{
logic->scoring.relRightPad = clamp(logic->scoring.relRightPad + 10.0f, -PONG_WALL_MAX, PONG_WALL_MAX);
}


logic->scoring.time += delta;
// Create left & right pad geometries, ball geometry

Expand Down
8 changes: 4 additions & 4 deletions src/resource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ IDI_APPLICATION ICON "assets/icon.ico"
// Version info
#include <winver.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0
PRODUCTVERSION 1,0,0
FILEVERSION 1,0,1
PRODUCTVERSION 1,0,1
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG | VS_FF_PRERELEASE
Expand All @@ -30,12 +30,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Maku Maku"
VALUE "FileDescription", "A version of Pong written in C and using Direct2D"
VALUE "FileVersion", "1.0.0"
VALUE "FileVersion", "1.0.1"
VALUE "InternalName", "Win32App"
VALUE "LegalCopyright", "\xA92021 Maku Maku"
VALUE "OriginalFileName", "PongD2D.exe"
VALUE "ProductName", "PongD2D"
VALUE "ProductVersion", "1.0.0"
VALUE "ProductVersion", "1.0.1"
END
END
BLOCK "VarFileInfo"
Expand Down
23 changes: 0 additions & 23 deletions src/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,29 +831,6 @@ void PongWnd_onKeyPress(PongWnd_t * restrict pong, WPARAM wp, LPARAM lp)
}
break;
}

if (pong->logic.scoring.notPaused)
{
switch (wp)
{
// Left pad up
case L'W':
pong->logic.scoring.relLeftPad = clamp(pong->logic.scoring.relLeftPad - 10.0f, -PONG_WALL_MAX, PONG_WALL_MAX);
break;
// Left pad down
case L'S':
pong->logic.scoring.relLeftPad = clamp(pong->logic.scoring.relLeftPad + 10.0f, -PONG_WALL_MAX, PONG_WALL_MAX);
break;
// Right pad up
case VK_UP:
pong->logic.scoring.relRightPad = clamp(pong->logic.scoring.relRightPad - 10.0f, -PONG_WALL_MAX, PONG_WALL_MAX);
break;
// Right pad down
case VK_DOWN:
pong->logic.scoring.relRightPad = clamp(pong->logic.scoring.relRightPad + 10.0f, -PONG_WALL_MAX, PONG_WALL_MAX);
break;
}
}
}
void PongWnd_onKeyRelease(PongWnd_t * restrict pong, WPARAM wp, LPARAM lp)
{
Expand Down

0 comments on commit cb3a3ab

Please sign in to comment.