auto generate images

This commit is contained in:
Klemek
2024-03-15 18:30:44 +01:00
parent f0cb160243
commit 9ed4990d58
990 changed files with 27849 additions and 13594 deletions
Executable → Regular
View File
Executable → Regular
+1
View File
@@ -3,6 +3,7 @@ __pycache__
.idea .idea
*.bmp *.bmp
watchfaces/libraries watchfaces/libraries
!watchfaces/pokemon-2.0/**/*.bmp
watchfaces/pokemon-2.0/pokemon-src watchfaces/pokemon-2.0/pokemon-src
!watchfaces/*/preview.bmp !watchfaces/*/preview.bmp
watchysim watchysim
Executable → Regular
+4 -1
View File
@@ -31,7 +31,10 @@ A better skin for Pokemon!
* Changes every day * Changes every day
* Bar is decreasing in a day * Bar is decreasing in a day
* Level is battery level * Level is battery level
* HP is current datec * HP is current date
* Cursor changes every minute
Sprites from: https://veekun.com/dex/downloads
### beLow ### beLow
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Vendored Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 117 KiB

Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
View File
View File
Executable → Regular
+3 -1
View File
@@ -12,5 +12,7 @@ A better skin for Pokemon!
* Changes every day * Changes every day
* Bar is decreasing in a day * Bar is decreasing in a day
* Level is battery level * Level is battery level
* HP is current datec * HP is current date
* Cursor changes every minute * Cursor changes every minute
Sprites from: https://veekun.com/dex/downloads
View File
+9 -3
View File
@@ -1,8 +1,8 @@
#ifndef WATCHY_POKEMON_H #ifndef WATCHY_POKEMON_H
#define WATCHY_POKEMON_H #define WATCHY_POKEMON_H
#define SIM
//#define FR //#define FR
#define SIM
#ifdef SIM #ifdef SIM
#include "..\..\Watchy.h" #include "..\..\Watchy.h"
@@ -14,10 +14,16 @@
#include "FreeMonoBold10pt7b.h" #include "FreeMonoBold10pt7b.h"
#include "FreeMonoBold7pt7b.h" #include "FreeMonoBold7pt7b.h"
//#include "pokemon_yellow.h"
//#include "pokemon_red_blue.h"
#include "pokemon_red_green.h"
#include "ui_other.h"
#ifdef FR #ifdef FR
#include "pokemon_fr.h" #include "ui_fr.h"
#else #else
#include "pokemon.h" #include "ui_en.h"
#endif #endif
#ifdef SIM #ifdef SIM
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Executable → Regular
+63 -11
View File
@@ -1,14 +1,30 @@
from PIL import Image from PIL import Image
import os.path import os.path
import math import math
import sys
import importlib
ROOT_DIR = f"{os.path.dirname(__file__)}/pokemon-src/main-sprites/yellow" spec = importlib.util.spec_from_file_location("watchy-image-editor", f'{os.path.dirname(__file__)}/../../watchy-image-editor/__init__.py')
FRONT_DIR = f"{ROOT_DIR}/gray" WatchyImageEditorModule = importlib.util.module_from_spec(spec)
BACK_DIR = f"{ROOT_DIR}/back/gray" sys.modules["watchy-image-editor"] = WatchyImageEditorModule
spec = importlib.util.spec_from_file_location("watchy-image-editor.image", f'{os.path.dirname(__file__)}/../../watchy-image-editor/image.py')
BmpImageModule = importlib.util.module_from_spec(spec)
sys.modules["watchy-image-editor.image"] = BmpImageModule
spec.loader.exec_module(BmpImageModule)
BmpImage = getattr(BmpImageModule, "Image", None)
UI_IMAGES = [("pokemon_1", 96, 16) , ("pokemon_2", 96, 26), ("pokemon_3", 200, 58)]
UI_OTHER_IMAGES = [("bar_0", 8, 4), ("bar_1", 8, 4), ("cursor", 8, 9)]
DIRS = ["red-blue", "red-green", "yellow"]
CWD = os.path.dirname(__file__)
ROOT_DIR = f"{CWD}/pokemon-src/main-sprites"
COUNT = 151 COUNT = 151
OUT_DIR = f"{os.path.dirname(__file__)}/pokemon-out" OUT_DIR = f"{CWD}/pokemon-out"
WIDTH = 72 WIDTH = 72
HEIGHT = 72 HEIGHT = 72
@@ -94,11 +110,47 @@ def convert_back(im_src: Image.Image) -> Image.Image:
return convert(im) return convert(im)
if __name__ == '__main__': if __name__ == '__main__':
for i in range(1, COUNT + 1): for lang in ["en", "fr"]:
with Image.open(f"{FRONT_DIR}/{i}.png") as im_src: with open(f"{CWD}/ui_{lang}.h", mode='w') as f:
im_out = convert_front(im_src) for name, width, height in UI_IMAGES:
im_out.save(f"{OUT_DIR}/front_{i}.bmp") im_bmp = BmpImage(name, width, height)
im_bmp.import_bmp(f"{lang}/{name}.bmp")
f.write(im_bmp.export_cpp()+"\n")
with Image.open(f"{BACK_DIR}/{i}.png") as im_src: with open(f"{CWD}/ui_other.h", mode='w') as f:
im_out = convert_back(im_src) for name, width, height in UI_OTHER_IMAGES:
im_out.save(f"{OUT_DIR}/back_{i}.bmp") im_bmp = BmpImage(name, width, height)
im_bmp.import_bmp(f"other/{name}.bmp")
f.write(im_bmp.export_cpp()+"\n")
try:
os.mkdir(f"{OUT_DIR}")
except:
pass
for sub in DIRS:
try:
os.mkdir(f"{OUT_DIR}/{sub}")
except:
pass
with open(f"{CWD}/pokemon_{sub.replace('-', '_')}.h", mode='w') as f:
for i in range(1, COUNT + 1):
try:
with Image.open(f"{ROOT_DIR}/{sub}/gray/{i}.png") as im_src:
im_out = convert_front(im_src)
im_out.save(f"{OUT_DIR}/{sub}/front_{i}.bmp")
except:
pass
im_bmp = BmpImage(f"front_{i}", WIDTH, HEIGHT)
im_bmp.import_bmp(f"{OUT_DIR}/{sub}/front_{i}.bmp")
f.write(im_bmp.export_cpp()+"\n")
try:
with Image.open(f"{ROOT_DIR}/{sub}/back/gray/{i}.png") as im_src:
im_out = convert_back(im_src)
im_out.save(f"{OUT_DIR}/{sub}/back_{i}.bmp")
except:
pass
im_bmp = BmpImage(f"back_{i}", WIDTH, HEIGHT)
im_bmp.import_bmp(f"{OUT_DIR}/back_{i}.bmp")
f.write(im_bmp.export_cpp()+"\n")
Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Some files were not shown because too many files have changed in this diff Show More