Skip to content

Commit

Permalink
Initial commit with cleaned history
Browse files Browse the repository at this point in the history
  • Loading branch information
fam007e committed Oct 7, 2024
0 parents commit 66868f2
Show file tree
Hide file tree
Showing 49 changed files with 806 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG] "
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. Linux Arch]
- Kernel version [e.g. 6.10.10-arch1-1]

**Additional context**
Add any other context about the problem here.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Bug Report
url: https://github.com/fam007e/TacticsBoard/issues/new?template=bug_report.md
about: File a bug report for the project.
- name: Feature Request
url: https://github.com/fam007e/TacticsBoard/issues/new?template=feature_request.md
about: Suggest a new feature for the project.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[FEATURE] "
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex: I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Fixes # (issue)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update

## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] Any dependent changes have been merged and published in downstream modules
35 changes: 35 additions & 0 deletions .github/workflows/build-tact-board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: C/C++ CI

on:
push:
branches: [ "main" ]

jobs:
build-and-release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
/var/cache/apt/archives
key: ${{ runner.os }}-apt-${{ hashFiles('**/Makefile') }}
restore-keys: |
${{ runner.os }}-apt-
- name: Install dependencies
run: sudo apt-get update && sudo apt-get upgrade -y && sudo apt install -y build-essential libconfig-dev libdbus-1-dev libegl-dev libev-dev libgl-dev libepoxy-dev libpcre2-dev libpixman-1-dev libx11-xcb-dev libxcb1-dev libxcb-composite0-dev libxcb-damage0-dev libxcb-dpms0-dev libxcb-glx0-dev libxcb-image0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-shape0-dev libxcb-util-dev libxcb-xfixes0-dev libxext-dev meson ninja-build uthash-dev cmake libxft-dev libimlib2-dev libxinerama-dev libxcb-res0-dev

- name: Clean Previous Build
run: make clean

- name: Build
run: make
continue-on-error: true

- name: Check Build Failure
if: ${{ failure() }}
run: echo "Build failed. Investigate the logs for details." && exit 1
80 changes: 80 additions & 0 deletions .github/workflows/discord-webhook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Discord Webhook Notification

on:
push:
branches:
- main
pull_request:
types: [opened, closed, reopened]
pull_request_review:
types: [submitted, edited, dismissed]
issues:
types: [opened, closed, reopened]
release:
types: [published, edited, released]
check_run:
types: [completed]
check_suite:
types: [completed]
deployment:
types: [created, completed]

jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Send notification to Discord for Push
if: github.event_name == 'push'
run: |
curl -H "Content-Type: application/json" \
-d "{\"content\": \"New push event in repository: ${{ github.repository }} by ${{ github.actor }}.\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}
- name: Send notification to Discord for Pull Request
if: github.event_name == 'pull_request'
run: |
curl -H "Content-Type: application/json" \
-d "{\"content\": \"New pull request event in repository: ${{ github.repository }} by ${{ github.actor }}.\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}
- name: Send notification to Discord for Pull Request Review
if: github.event_name == 'pull_request_review'
run: |
curl -H "Content-Type: application/json" \
-d "{\"content\": \"New pull request review event in repository: ${{ github.repository }} by ${{ github.actor }}.\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}
- name: Send notification to Discord for Issues
if: github.event_name == 'issues'
run: |
curl -H "Content-Type: application/json" \
-d "{\"content\": \"New issue event in repository: ${{ github.repository }} by ${{ github.actor }}.\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}
- name: Send notification to Discord for Release
if: github.event_name == 'release'
run: |
curl -H "Content-Type: application/json" \
-d "{\"content\": \"New release event in repository: ${{ github.repository }} by ${{ github.actor }}.\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}
- name: Send notification to Discord for Check Run
if: github.event_name == 'check_run'
run: |
curl -H "Content-Type: application/json" \
-d "{\"content\": \"New check run completed in repository: ${{ github.repository }}.\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}
- name: Send notification to Discord for Check Suite
if: github.event_name == 'check_suite'
run: |
curl -H "Content-Type: application/json" \
-d "{\"content\": \"New check suite completed in repository: ${{ github.repository }}.\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}
- name: Send notification to Discord for Deployment
if: github.event_name == 'deployment'
run: |
curl -H "Content-Type: application/json" \
-d "{\"content\": \"New deployment event in repository: ${{ github.repository }}.\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}
73 changes: 73 additions & 0 deletions .github/workflows/issue-slash-cmd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Close issue on /close

on:
issue_comment:
types: [created, edited]

jobs:
closeIssueOnClose:
# Skip this job if the comment was created/edited on a PR
if: ${{ !github.event.issue.pull_request }}
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: none
contents: read

steps:
- run: echo "command=false" >> $GITHUB_ENV

- name: Check for /close command
id: check_close_command
run: |
if [[ "${{ contains(github.event.comment.body, '/close') }}" == "true" ]]; then
echo "command=true" >> $GITHUB_ENV
echo "close_command=true" >> $GITHUB_ENV
echo "reopen_command=false" >> $GITHUB_ENV
else
echo "close_command=false" >> $GITHUB_ENV
fi
- name: Check for /open or /reopen command
id: check_reopen_command
run: |
if [[ "${{ contains(github.event.comment.body, '/open') }}" == "true" ]] || [[ "${{ contains(github.event.comment.body, '/reopen') }}" == "true" ]]; then
echo "command=true" >> $GITHUB_ENV
echo "reopen_command=true" >> $GITHUB_ENV
echo "close_command=false" >> $GITHUB_ENV
else
echo "reopen_command=false" >> $GITHUB_ENV
fi
- name: Check if the user is allowed
id: check_user
if: env.command == 'true'
run: |
ALLOWED_USERS=("fam007e")
if [[ " ${ALLOWED_USERS[@]} " =~ " ${{ github.event.comment.user.login }} " ]]; then
echo "user=true" >> $GITHUB_ENV
else
echo "user=false" >> $GITHUB_ENV
fi
- name: Close issue if conditions are met
if: env.close_command == 'true' && env.user == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
echo Closing the issue...
if [[ "${{ contains(github.event.comment.body, 'not planned') }}" == "true" ]]; then
gh issue close $ISSUE_NUMBER --repo ${{ github.repository }} --reason 'not planned'
else
gh issue close $ISSUE_NUMBER --repo ${{ github.repository }}
fi
- name: Reopen issue if conditions are met
if: env.reopen_command == 'true' && env.user == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
echo Reopening the issue...
gh issue reopen $ISSUE_NUMBER --repo ${{ github.repository }}
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.10)
project(TacticsBoard)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

include_directories(include)

file(GLOB SOURCES "source/*.cpp")
add_executable(tactics_board ${SOURCES})

find_package(SFML 2.5 COMPONENTS graphics window system REQUIRED)
target_link_libraries(tactics_board sfml-graphics sfml-window sfml-system)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# TacticsBoard
Football Tactics Board
28 changes: 28 additions & 0 deletions include/Menu.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef MENU_HPP
#define MENU_HPP

#include <SFML/Graphics.hpp>
#include <vector>
#include <string>

class Menu {
public:
struct Icon {
sf::Texture texture;
sf::Sprite sprite;
sf::Sprite shadow; // Add shadow sprite
};

Menu();
void initialize(const sf::Vector2u& windowSize);
void handleMouseClick(const sf::Vector2i& mousePos, bool& menuVisible, bool& dragging, int& selectedTool);
void draw(sf::RenderWindow& window, bool menuVisible);
bool isPointInSprite(const sf::Sprite& sprite, const sf::Vector2i& point);

private:
std::vector<Icon> icons;
void initializeIcon(Icon& icon, const std::string& filepath, float scale, const sf::Vector2f& position);
void generateShadow(Icon& icon); // Declare the shadow generation method
};

#endif // MENU_HPP
25 changes: 25 additions & 0 deletions include/Player.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef PLAYER_HPP
#define PLAYER_HPP

#include <SFML/Graphics.hpp>
#include <string>

class Player {
public:
Player(const sf::Vector2f& position, const std::string& name, int number);

void draw(sf::RenderWindow& window);
void setPosition(const sf::Vector2f& position);
bool contains(const sf::Vector2i& point) const;
const sf::Vector2f& getPosition() const;

private:
sf::CircleShape shape;
sf::Text nameText;
sf::Text numberText;
sf::Font font;
std::string name;
int number;
};

#endif // PLAYER_HPP
32 changes: 32 additions & 0 deletions include/TacticsBoard.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef TACTICSBOARD_HPP
#define TACTICSBOARD_HPP

#include <SFML/Graphics.hpp>
#include <vector>
#include "Player.hpp"
#include "Menu.hpp"

class TacticsBoard {
public:
TacticsBoard();
void run();

private:
sf::Texture pitchTexture;
sf::Sprite pitchSprite;

std::vector<Player> players;
bool menuVisible;
bool dragging;
Player* selectedPlayer;
int selectedTool;
sf::Vector2f oldMousePosition;

Menu menu;

void handleMouseEvent(sf::Event& event, sf::RenderWindow& window);
void update();
void render(sf::RenderWindow& window);
};

#endif // TACTICSBOARD_HPP
Binary file added resources/fonts/FiraCodeNerdFont-Bold.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFont-Light.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFont-Medium.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFont-Regular.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFont-Retina.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFont-SemiBold.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFontMono-Bold.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFontMono-Light.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFontMono-Medium.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFontMono-Regular.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFontMono-Retina.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFontMono-SemiBold.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFontPropo-Bold.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFontPropo-Light.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFontPropo-Medium.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFontPropo-Regular.ttf
Binary file not shown.
Binary file added resources/fonts/FiraCodeNerdFontPropo-Retina.ttf
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 66868f2

Please sign in to comment.