Skip to content

Hassan-ach/text_editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Editor with SFML

Screenshot

A lightweight text editor built using C++ and SFML (Simple and Fast Multimedia Library). This project demonstrates how to create a basic text editor with features like line numbers, undo/redo functionality, and file handling.

Features

  • Basic text editing functionality
  • Line numbering
  • Undo/Redo operations
  • File saving/loading
  • Customizable font size (Ctrl+Plus/Ctrl+Minus)
  • Tab support
  • Multiple file support (Ctrl+Alt+Left/Right to switch)
  • Cross-platform (Linux, Windows)

Requirements

  • C++17 compatible compiler
  • CMake (>= 3.10)
  • SFML 2.5.x (included as static libraries)
  • System dependencies:
    • OpenGL
    • Freetype
    • X11 (Linux)
    • OpenAL (for audio if needed)

Installation

Linux (Ubuntu/Debian)

  1. Install dependencies:
sudo apt-get install build-essential cmake libfreetype6-dev libgl1-mesa-dev \
libx11-dev libxrandr-dev libxcursor-dev libxi-dev libudev-dev
  1. Clone the repository:
git clone https://github.com/Hassan-ach/text_editor.git
cd text-editor
  1. Build the project:
mkdir build && cd build
cmake ..
make

Windows

  1. Install CMake and MinGW
  2. Clone the repository
  3. Open CMake GUI and configure the project
  4. Generate Makefiles and build

Usage

Run the executable:

./text-editor

Keyboard Shortcuts

Shortcut Action
Ctrl+Z Undo
Ctrl+Y Redo
Ctrl+Plus Increase font size
Ctrl+Minus Decrease font size
Ctrl+Alt+Left/Right Switch between files
Ctrl+S Save file

Project Structure

text-editor/
├── assets/            # Font files and resources
├── libs/              # SFML static libraries
├── src/               # Source code
│   ├── button.cpp     # Button implementation
│   ├── file.cpp       # File handling
│   ├── Window.cpp     # Main window logic
│   └── main.cpp       # Entry point
├── include/           # Header files
├── thirdparty/        # Third-party libraries
├── CMakeLists.txt     # Build configuration
└── README.md          # This file

Customization

You can customize the editor by:

  1. Changing fonts in the assets/ directory
  2. Modifying key bindings in Window.cpp
  3. Adjusting default font size in Window.hpp

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

MIT License

About

A simple text editor using c++ and SFML library

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors