forked from godotengine/godot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleanup gdextensions; add tools and update .gitignore with binaries
- Loading branch information
Showing
14 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
#include <assert.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#define GL_RGB 3 | ||
|
||
typedef struct { | ||
const char *label; | ||
const char *image; | ||
const unsigned char *pixels; | ||
int char_w, char_h, size, width, height, channels; | ||
} EmbedImageItem; | ||
|
||
extern const unsigned char font_8x16[], font_8x12[], font_8x8[], font_7x9[], font_4x6[]; | ||
const EmbedImageItem embed_debug_font[] = { | ||
{ "font_8x16", "dos-8x16.bmp", font_8x16, 8, 16, 196608, 128, 512, GL_RGB }, | ||
{ "font_8x12", "dos-8x12.bmp", font_8x12, 8, 12, 147456, 128, 384, GL_RGB }, | ||
{ "font_8x8", "dos-8x8.bmp", font_8x8, 8, 8, 98304, 128, 256, GL_RGB }, | ||
{ "font_7x9", "dos-7x9.bmp", font_7x9, 7, 9, 96768, 112, 288, GL_RGB }, | ||
{ "font_4x6", "dos-4x6.bmp", font_4x6, 4, 6, 36864, 64, 192, GL_RGB }, | ||
{ NULL, NULL, 0, 0, 0, 0, 0, 0 } | ||
}; | ||
|
||
#include "dos_font_data_rgb.h" | ||
|
||
int main() { | ||
FILE *out = fopen("dos_font_data_8.h", "w"); | ||
if (out == 0) { | ||
printf("Cannot open dos_font_data_8.h!\n"); | ||
exit(1); | ||
} | ||
EmbedImageItem *el = (EmbedImageItem *)&embed_debug_font[0]; | ||
int index = 1; | ||
while (el->image) { | ||
printf("Converting %s ..\n", el->image); | ||
fprintf(out, | ||
"/* %s contains file \"%s\". */\n" | ||
"const unsigned char %s[] =\n" | ||
"{", | ||
el->label, el->image, el->label); | ||
|
||
assert(el->size % 3 == 0); | ||
|
||
for (int b = 0; b < el->size; b += 3) { | ||
if (b % 10 == 0) | ||
fprintf(out, "\n\t"); | ||
fprintf(out, "0x%02x", el->pixels[b]); | ||
if (b + 3 != el->size) | ||
fprintf(out, ","); | ||
} | ||
|
||
fprintf(out, "\n};\n\n"); | ||
el++; | ||
index++; | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
ROOT=~/Private/Workspace/embedFiglet | ||
CONV=$ROOT/scripts/FigletFontConvert.rb | ||
|
||
ruby $CONV $ROOT/res/figfonts/Calvin\ S.flf > figlet_font_calvins.cpp | ||
ruby $CONV $ROOT/res/figfonts/maxiwi.flf > figlet_font_maxiwi.cpp | ||
ruby $CONV $ROOT/res/figfonts/maxii.flf > figlet_font_maxii.cpp | ||
ruby $CONV $ROOT/res/figfonts/DOS\ Rebel.flf > figlet_font_dosrebel.cpp | ||
ruby $CONV $ROOT/res/figfonts/ANSI\ Regular.flf > figlet_font_ansiregular.cpp | ||
|
||
sed -i '' \ | ||
-e 's/Calvin S/calvins/g' \ | ||
-e 's/DOS Rebel/dosrebel/g' \ | ||
-e 's/ANSI Regular/ansiregular/g' \ | ||
-e 's/Figlet.hh/figlet_font.h/g' \ | ||
figlet_font_*.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# Convert to 1-bit bmp: | ||
# --------------------- | ||
# > convert fonts.altered/dos-8x8@24.bmp -monochrome -depth 1 fonts.altered/dos-8x8@1.bmp | ||
|
||
set -e | ||
|
||
DEVTOOLS="~/Private/Projekty/0.shared/common-dev-tools" | ||
|
||
$DEVTOOLS/res_tools/c-embed/c-embed \ | ||
dos_font_data \ | ||
fonts.altered/*.bmp | ||
|
||
sed -i '' -e 's/embed_1/font_4x6/g' dos_font_data.* | ||
sed -i '' -e 's/embed_2/font_7x9/g' dos_font_data.* | ||
sed -i '' -e 's/embed_3/font_8x12/g' dos_font_data.* | ||
sed -i '' -e 's/embed_4/font_8x16/g' dos_font_data.* | ||
sed -i '' -e 's/embed_5/font_8x8/g' dos_font_data.* | ||
|
||
mv -v dos_font_data.c dos_font_data_rgb.h | ||
gcc -o conv_rgb_to_8 conv_rgb_to_8.cpp | ||
./conv_rgb_to_8 |