Skip to content

Commit fe24536

Browse files
committed
Init
0 parents  commit fe24536

File tree

10 files changed

+6071
-0
lines changed

10 files changed

+6071
-0
lines changed

.eslintrc.cjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = {
2+
root: true,
3+
env: { browser: true, es2020: true },
4+
extends: [
5+
'eslint:recommended',
6+
'plugin:react/recommended',
7+
'plugin:react/jsx-runtime',
8+
'plugin:react-hooks/recommended',
9+
],
10+
ignorePatterns: ['dist', '.eslintrc.cjs'],
11+
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
12+
settings: { react: { version: '18.2' } },
13+
plugins: ['react-refresh'],
14+
rules: {
15+
'react-refresh/only-export-components': [
16+
'warn',
17+
{ allowConstantExport: true },
18+
],
19+
},
20+
}

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Pixel2CPP
2+
3+
A browser-based pixel editor that exports Arduino-ready C++ code. Create pixel art and get optimized code for:
4+
5+
- **1-bit packed bytes** for SSD1306 OLED displays (Adafruit_GFX drawBitmap)
6+
- **RGB565 16-bit values** for color TFT displays (ILI9341/ST7735/etc.)
7+
8+
## Features
9+
10+
- 🎨 Real-time pixel editor with drawing tools
11+
- 🔄 Undo/redo functionality
12+
- 🖼️ Image import with automatic scaling
13+
- 📐 Grid overlay and zoom controls
14+
- 🪞 Mirror drawing modes
15+
- 🧪 Built-in test suite for validation
16+
- 📱 Responsive design with Tailwind CSS
17+
18+
## Quick Start
19+
20+
1. Install dependencies:
21+
```bash
22+
npm install
23+
```
24+
25+
2. Start the development server:
26+
```bash
27+
npm run dev
28+
```
29+
30+
3. Open your browser to the local development URL (usually `http://localhost:5173`)
31+
32+
## Usage
33+
34+
1. **Set canvas size** - Choose dimensions suitable for your display
35+
2. **Select mode** - 1-bit for OLED, RGB565 for color TFT
36+
3. **Draw your sprite** - Use pen, erase, fill, or eyedropper tools
37+
4. **Export** - Click "Export .h" to download Arduino-ready header file
38+
5. **Test** - Run built-in tests to validate packing logic
39+
40+
## Export Formats
41+
42+
### 1-bit (OLED/SSD1306)
43+
```cpp
44+
const uint8_t sprite_bits[] PROGMEM = { 0xAA, 0x55, ... };
45+
display.drawBitmap(x, y, sprite_bits, width, height, 1);
46+
```
47+
48+
### RGB565 (TFT/ILI9341)
49+
```cpp
50+
const uint16_t sprite_pixels[] PROGMEM = { 0xF800, 0x07E0, ... };
51+
// Use with tft.setAddrWindow() and tft.writePixel()
52+
```
53+
54+
## Development
55+
56+
- **Build**: `npm run build`
57+
- **Preview**: `npm run preview`
58+
- **Lint**: `npm run lint`
59+
60+
## License
61+
62+
MIT License - feel free to use for your projects!

index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Pixel2CPP - Pixel Editor to C++</title>
8+
<script src="https://cdn.tailwindcss.com"></script>
9+
</head>
10+
<body>
11+
<div id="root"></div>
12+
<script type="module" src="/src/main.jsx"></script>
13+
</body>
14+
</html>

0 commit comments

Comments
 (0)