Skip to content

codingburgas/LogicPro

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation


 _      ___ ____  ____      _    ____ __   __
| |    |_ _| __ )|  _ \    / \  |  _ \\ \ / /
| |     | ||  _ \| |_) |  / _ \ | |_) |\ V /
| |___  | || |_) |  _ <  / ___ \|  _ <  | |
|_____||___|____/|_| \_\/_/   \_\_| \_\ |_|

Library Management System - a minimalist desktop application for library management with a dark GUI powered by Raylib.


C++ Raylib CMake Windows License


✨ What is this

A full-fledged library management system with a graphical user interface. Written in C++17 using Raylib 5.0. No browsers, no Electron — a native binary that launches instantly. It features two user roles, a full lifecycle for book management, and a fine system for overdue returns.

🚀 Quick Start

Requirements

Windows

git clone https://github.com/YOUR_USERNAME/library-app.git
cd library-app

mkdir build && cd build
cmake .. -G "Visual Studio 17 2022" -DCMAKE_POLICY_VERSION_MINIMUM=3.5
cmake --build . --config Release

Release\library.exe

macOS

brew install raylib cmake
git clone https://github.com/YOUR_USERNAME/library-app.git
cd library-app && make
./library

Linux (Ubuntu/Debian)

sudo apt update && sudo apt install libraylib-dev cmake build-essential
git clone https://github.com/YOUR_USERNAME/library-app.git
cd library-app && make
./library

Note: On the first build on Windows, CMake will download Raylib (~5 MB) from GitHub. Subsequent builds work offline.


🔐 Default Credentials

Role Login Password
👑 Administrator admin 12345
👤 User registration your choice

⚙️ Features

👑 Administrator Mode

📚 Catalog Management
  ├── Add a book            (title, author, genre, date)
  ├── Delete a book         (with confirmation)
  └── View catalog          (with filters)

🗄️  Archive
  └── History of all issued and deleted books

💸 Fine System
  ├── Assign fine to a user
  ├── Calculation: 5 BGN × number of overdue days
  └── Automatic bill creation

👤 User Mode

🔍 View Books
  └── Filter by: author / genre / date / title

📖 Borrow a Book
  └── Return period — 7 days

🧾 My Bills
  └── View accrued fines with the total amount

🗂️ Project Structure

library/
│
├── 📄 CMakeLists.txt          # Build (automatically downloads Raylib)
├── 📄 Makefile                # Alternative for Linux/macOS
│
├── include/
│   ├── 🔷 types.h             # Data structures: Book, User, Bill, AppState
│   ├── 🔷 ui.h                # UI primitives: buttons, input fields, toasts
│   ├── 🔷 logic.h             # Business logic: login, search, fines
│   └── 🔷 screens.h           # Declarations of all screens
│
└── src/
    ├── 🔶 main.cpp            # Entry point, game loop, screen routing
    ├── 🔶 ui.cpp              # Implementation of UI components
    ├── 🔶 screens.cpp         # All application screens
    └── 🔶 logic.cpp           # Implementation of business logic

🎨 Design

The color palette is built on the "less is more" principle:

Purpose Color HEX
Background #0C0C10
Panels #14141C
Cards #1C1C26
Accent 🔵 #78A0FF
Success 🟢 #50C878
Error 🔴 #DC5050
Warning 🟡 #DCB03C

UI Components:

  • Input fields with a blinking cursor and password masking (*)
  • Hover effects on all buttons
  • Toast notifications with smooth fade-out
  • Mouse wheel scrolling in lists
  • Confirmation button before deleting a book

🏗️ Architecture

The application is built as a Finite State Machine (FSM):

MAIN_MENU
  ├── LOGIN ──────────► USER_MENU ──► SHOW_BOOKS
  │                              ├──► TAKE_BOOK
  │                              └──► BILLS
  │
  └── LOGIN ──────────► ADMIN_MENU ──► ADD_BOOK
                                  ├──► DELETE_BOOK
                                  ├──► SHOW_BOOKS
                                  ├──► ARCHIVE
                                  └──► CALCULATE_FINE

Each screen is a separate function in screens.cpp. Switching screens is done by changing AppState::currentScreen. All state is stored in a single AppState struct, with no global variables.


📐 Fine Formula

Штраф рассчитывается рекурсивно:

int CalculateFine(int days) {
    if (days <= 0) return 0;
    return 5 + CalculateFine(days - 1);
}
// 1 day = 5 BGN, 5 days = 25 BGN, 10 days = 50 BGN

🤝 Contributing

  1. Fork the repository
  2. Create a branch: git checkout -b feature/my-feature
  3. Commit: git commit -m 'Add my feature'
  4. Push: git push origin feature/my-feature
  5. Open Pull Request

📝 License

MIT License — do whatever you want, mention the author.

Made with ☕ and Raylib

About

Library Management System - a minimalist desktop application for library management with a dark GUI powered by Raylib.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C++ 97.4%
  • C 1.5%
  • Makefile 1.1%