Compare commits
7 Commits
120c3791cf
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 08031810c9 | |||
| 16baf48d8c | |||
| 07caf71ce3 | |||
| c656d48b72 | |||
| 2d03333463 | |||
| 477fc35e29 | |||
| d2e94ce74b |
BIN
data/8bithud.png
BIN
data/8bithud.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
BIN
data/nokia.png
Normal file
BIN
data/nokia.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@@ -3,57 +3,57 @@
|
||||
# box height
|
||||
8
|
||||
# 32 espacio ( )
|
||||
2
|
||||
4
|
||||
# 33 !
|
||||
2
|
||||
# 34 "
|
||||
5
|
||||
3
|
||||
# 35 #
|
||||
6
|
||||
5
|
||||
# 36 $
|
||||
6
|
||||
5
|
||||
# 37 %
|
||||
6
|
||||
# 38 &
|
||||
6
|
||||
# 39 '
|
||||
2
|
||||
1
|
||||
# 40 (
|
||||
3
|
||||
# 41 )
|
||||
3
|
||||
# 42 *
|
||||
4
|
||||
5
|
||||
# 43 +
|
||||
3
|
||||
5
|
||||
# 44 ,
|
||||
2
|
||||
# 45 -
|
||||
3
|
||||
4
|
||||
# 46 .
|
||||
2
|
||||
# 47 /
|
||||
4
|
||||
3
|
||||
# 48 0
|
||||
6
|
||||
5
|
||||
# 49 1
|
||||
6
|
||||
3
|
||||
# 50 2
|
||||
6
|
||||
5
|
||||
# 51 3
|
||||
6
|
||||
5
|
||||
# 52 4
|
||||
6
|
||||
5
|
||||
# 53 5
|
||||
6
|
||||
5
|
||||
# 54 6
|
||||
6
|
||||
5
|
||||
# 55 7
|
||||
6
|
||||
5
|
||||
# 56 8
|
||||
6
|
||||
5
|
||||
# 57 9
|
||||
6
|
||||
5
|
||||
# 58 :
|
||||
2
|
||||
# 59 ;
|
||||
@@ -61,73 +61,73 @@
|
||||
# 60 <
|
||||
4
|
||||
# 61 =
|
||||
3
|
||||
4
|
||||
# 62 >
|
||||
4
|
||||
# 63 ?
|
||||
6
|
||||
5
|
||||
# 64 @
|
||||
8
|
||||
6
|
||||
# 65 A
|
||||
6
|
||||
5
|
||||
# 66 B
|
||||
6
|
||||
5
|
||||
# 67 C
|
||||
6
|
||||
5
|
||||
# 68 D
|
||||
6
|
||||
5
|
||||
# 69 E
|
||||
6
|
||||
5
|
||||
# 70 F
|
||||
6
|
||||
5
|
||||
# 71 G
|
||||
6
|
||||
5
|
||||
# 72 H
|
||||
6
|
||||
5
|
||||
# 73 I
|
||||
6
|
||||
2
|
||||
# 74 J
|
||||
6
|
||||
4
|
||||
# 75 K
|
||||
6
|
||||
# 76 L
|
||||
6
|
||||
4
|
||||
# 77 M
|
||||
6
|
||||
7
|
||||
# 78 N
|
||||
6
|
||||
# 79 O
|
||||
6
|
||||
# 80 P
|
||||
6
|
||||
5
|
||||
# 81 Q
|
||||
6
|
||||
# 82 R
|
||||
6
|
||||
5
|
||||
# 83 S
|
||||
6
|
||||
4
|
||||
# 84 T
|
||||
6
|
||||
# 85 U
|
||||
6
|
||||
# 86 V
|
||||
5
|
||||
# 87 W
|
||||
# 86 V
|
||||
6
|
||||
# 87 W
|
||||
7
|
||||
# 88 X
|
||||
6
|
||||
# 89 Y
|
||||
6
|
||||
# 90 Z
|
||||
6
|
||||
# 91 [
|
||||
3
|
||||
# 92 \
|
||||
5
|
||||
# 93 ]
|
||||
# 91 [
|
||||
2
|
||||
# 92 \
|
||||
3
|
||||
# 93 ]
|
||||
2
|
||||
# 94 ^
|
||||
4
|
||||
3
|
||||
# 95 _
|
||||
6
|
||||
# 96 `
|
||||
@@ -137,27 +137,27 @@
|
||||
# 98 b
|
||||
5
|
||||
# 99 c
|
||||
5
|
||||
4
|
||||
# 100 d
|
||||
5
|
||||
# 101 e
|
||||
5
|
||||
# 102 f
|
||||
5
|
||||
3
|
||||
# 103 g
|
||||
5
|
||||
# 104 h
|
||||
5
|
||||
# 105 i
|
||||
4
|
||||
2
|
||||
# 106 j
|
||||
5
|
||||
3
|
||||
# 107 k
|
||||
5
|
||||
# 108 l
|
||||
5
|
||||
2
|
||||
# 109 m
|
||||
6
|
||||
8
|
||||
# 110 n
|
||||
5
|
||||
# 111 o
|
||||
@@ -167,28 +167,28 @@
|
||||
# 113 q
|
||||
5
|
||||
# 114 r
|
||||
5
|
||||
# 115 s
|
||||
5
|
||||
# 116 t
|
||||
4
|
||||
# 115 s
|
||||
4
|
||||
# 116 t
|
||||
3
|
||||
# 117 u
|
||||
5
|
||||
# 118 v
|
||||
5
|
||||
# 119 w
|
||||
6
|
||||
7
|
||||
# 120 x
|
||||
4
|
||||
5
|
||||
# 121 y
|
||||
4
|
||||
5
|
||||
# 122 z
|
||||
5
|
||||
# 123 {
|
||||
3
|
||||
# 124 |
|
||||
2
|
||||
# 123 { -> ñ
|
||||
5
|
||||
# 124 | -> ç
|
||||
5
|
||||
# 125 }
|
||||
3
|
||||
0
|
||||
# 126 ~
|
||||
3
|
||||
0
|
||||
BIN
data/pal01.gif
Normal file
BIN
data/pal01.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 273 B |
BIN
data/pal02.gif
Normal file
BIN
data/pal02.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 273 B |
BIN
data/williams.gif
Normal file
BIN
data/williams.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
124
main.cpp
124
main.cpp
@@ -17,7 +17,9 @@ Código fuente creado por JailDesigner
|
||||
#include "units/input.h"
|
||||
#include "units/on_screen_keyboard.h"
|
||||
#include "quickcg.h"
|
||||
|
||||
using namespace QuickCG;
|
||||
using namespace std;
|
||||
|
||||
// Punteros
|
||||
SDL_Event *event;
|
||||
@@ -33,7 +35,7 @@ Text *text;
|
||||
Text *debugText;
|
||||
Texture *texture;
|
||||
MovingSprite *sprite;
|
||||
OnScreenKeyboard *osk;
|
||||
OnScreenKeyboard *osk = nullptr;
|
||||
|
||||
// Variables de uso general
|
||||
Uint32 ticks = 0; // Variable para la frecuencia de actualización de la lógica del programa
|
||||
@@ -165,6 +167,8 @@ void initAsset(char *argv[])
|
||||
asset->add("/data/smb2.png", t_bitmap);
|
||||
asset->add("/data/debug.txt", t_font);
|
||||
asset->add("/data/debug.png", t_bitmap);
|
||||
asset->add("/data/nokia.txt", t_font);
|
||||
asset->add("/data/nokia.png", t_bitmap);
|
||||
asset->add("/data/z80.png", t_bitmap);
|
||||
asset->add("/data/notify.png", t_bitmap);
|
||||
asset->add("/data/notify.wav", t_sound);
|
||||
@@ -243,12 +247,36 @@ void initText()
|
||||
// Inicializa el teclado en pantalla
|
||||
void initOnScreenKeyboard()
|
||||
{
|
||||
osk = new OnScreenKeyboard(renderer, input, asset->get("smb2.png"), asset->get("smb2.txt"), options, options->screen.nativeWidth - 30, options->screen.nativeHeight - 80, "JailDesigner");
|
||||
osk = new OnScreenKeyboard(renderer, input, asset->get("nokia.png"), asset->get("nokia.txt"), options, options->screen.nativeWidth - 30, options->screen.nativeHeight - 80, "JailDesigner");
|
||||
osk->setBgColor({123, 99, 63});
|
||||
osk->setCaption("JAILER_ID");
|
||||
osk->setChars(USE_UPPER | USE_LOWER | USE_NUMBER);
|
||||
}
|
||||
|
||||
// Elimina el teclado en pantalla
|
||||
void deleteOnScreenKeyboard()
|
||||
{
|
||||
if (osk != nullptr)
|
||||
{
|
||||
delete osk;
|
||||
osk = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja el teclado en pantalla
|
||||
void renderOnScreenKeyboard()
|
||||
{
|
||||
if (osk != nullptr)
|
||||
osk->render();
|
||||
}
|
||||
|
||||
// Actualiza el teclado en pantalla
|
||||
void updateOnScreenKeyboard()
|
||||
{
|
||||
if (osk != nullptr)
|
||||
osk->update();
|
||||
}
|
||||
|
||||
// Inicializa el sprite
|
||||
void initSprite()
|
||||
{
|
||||
@@ -285,7 +313,7 @@ void initFire()
|
||||
// Hue goes from 0 to 85: red to yellow
|
||||
// Saturation is always the maximum: 255
|
||||
// Lightness is 0..255 for x=0..128, and 255 for x=128..255
|
||||
ColorRGB color = HSLtoRGB(ColorHSL(x / 3, 255, std::min(255, x * 2)));
|
||||
ColorRGB color = HSLtoRGB(ColorHSL(x / 3, 255, min(255, x * 2)));
|
||||
|
||||
// Pon en la paleta el color calculado
|
||||
palette[x] = (Uint32)16777216 * 255 + 65536 * color.r + 256 * color.g + color.b;
|
||||
@@ -327,7 +355,7 @@ void initAll(char *argv[])
|
||||
initText();
|
||||
|
||||
// Inicializa el teclado en pantalla
|
||||
initOnScreenKeyboard();
|
||||
// initOnScreenKeyboard();
|
||||
|
||||
// Inicializa el sprite
|
||||
initSprite();
|
||||
@@ -363,23 +391,33 @@ void checkEvents()
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F3:
|
||||
--fireModifier;
|
||||
fireModifier = std::max(0, fireModifier);
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F4:
|
||||
++fireModifier;
|
||||
fireModifier = std::min(30, fireModifier);
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_SPACE:
|
||||
++fx %= fxTotal;
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F4:
|
||||
--fireModifier;
|
||||
fireModifier = max(0, fireModifier);
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_N:
|
||||
case SDL_SCANCODE_F5:
|
||||
++fireModifier;
|
||||
fireModifier = min(30, fireModifier);
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F6:
|
||||
screen->showNotification("Ejemplo de notificacion", "con 2 lineas de texto", 0);
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F7:
|
||||
if (osk == nullptr)
|
||||
initOnScreenKeyboard();
|
||||
else
|
||||
deleteOnScreenKeyboard();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F8:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -532,11 +570,9 @@ void update()
|
||||
counter++;
|
||||
|
||||
// Actualiza los objetos
|
||||
osk->update();
|
||||
screen->update();
|
||||
|
||||
// Actualiza el sprite
|
||||
updateSprite();
|
||||
updateOnScreenKeyboard(); // Actualiza el teclado en pantalla
|
||||
screen->update(); // Actualiza la pantalla
|
||||
updateSprite(); // Actualiza el sprite
|
||||
|
||||
// Actualiza el efecto de fondo
|
||||
updateFX();
|
||||
@@ -595,19 +631,45 @@ void renderFX()
|
||||
// Dibuja el texto
|
||||
void renderText()
|
||||
{
|
||||
const string text1 = "Jail Engine DEMO";
|
||||
const string text2 = "2023,2024 JailDesigner";
|
||||
|
||||
const string text3 = "Pulsa 'F1' o 'F2' para disminuir o aumentar la ventana";
|
||||
|
||||
const string text4 = "Pulsa 'F3' para cambiar el efecto de fondo: ";
|
||||
const string text5 = "Pulsa 'F4' o 'F5' para modificar el efecto de fuego: ";
|
||||
|
||||
const string text6 = "Pulsa 'F6' para mostrar una notificacion";
|
||||
const string text7 = "Pulsa 'F7' para mostrar u ocultar el teclado";
|
||||
const string text8 = "Pulsa 'F8' para añadir o eliminar sprites";
|
||||
|
||||
const string text9 = "Controles:";
|
||||
|
||||
const string text10 = "Pulsa 'ESCAPE' para terminar el programa";
|
||||
const string fxName = fx == 0 ? "Degradado" : "Fuego";
|
||||
|
||||
const int center = options->screen.nativeWidth / 2;
|
||||
|
||||
text->setZoom(2);
|
||||
text->writeDX(TXT_CENTER | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize(), "Jail Engine DEMO", 1, {255, 255, 255}, 1, {0, 0, 192});
|
||||
text->writeDX(TXT_CENTER | TXT_STROKE, center, text->getCharacterSize(), text1, 1, {255, 255, 255}, 1, {0, 0, 192});
|
||||
text->disableZoom();
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize() * 4, "2023 JailDesigner", 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize() * 7, "Pulsa 'F1' o 'F2' para disminuir o aumentar la ventana", 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize() * 9, "Pulsa 'ESPACIO' para cambiar el efecto de fondo: " + fxName, 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, center, text->getCharacterSize() * 4, text2, 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, center, text->getCharacterSize() * 7, text3, 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, center, text->getCharacterSize() * 9, text4 + fxName, 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
if (fxName == "Fuego")
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize() * 11, "Pulsa 'F3' o 'F4' para modificar el fuego: " + to_string(fireModifier), 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize() * 13, "Pulsa 'N' para mostrar una notificacion", 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize() * 15, controllerName, 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize() * 17, inputPressed, 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, options->screen.nativeHeight - (text->getCharacterSize() * 2), "Pulsa 'ESCAPE' para terminar el programa", 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, center, text->getCharacterSize() * 10, text5 + to_string(fireModifier), 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, center, text->getCharacterSize() * 12, text6, 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, center, text->getCharacterSize() * 13, text7, 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, center, text->getCharacterSize() * 14, text8, 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, center, text->getCharacterSize() * 16, text9, 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, center, text->getCharacterSize() * 17, controllerName, 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, center, text->getCharacterSize() * 18, inputPressed, 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
|
||||
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, center, options->screen.nativeHeight - (text->getCharacterSize() * 2), text10, 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
}
|
||||
|
||||
// Dibuja los elementos del programa en pantalla
|
||||
@@ -625,9 +687,9 @@ void render()
|
||||
|
||||
// Dinuja el texto
|
||||
renderText();
|
||||
|
||||
|
||||
// Dibuja el teclado en pantalla
|
||||
osk->render();
|
||||
renderOnScreenKeyboard();
|
||||
|
||||
// Vuelca el buffer en pantalla
|
||||
screen->blit();
|
||||
|
||||
478
units/gif.c
Normal file
478
units/gif.c
Normal file
@@ -0,0 +1,478 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define EXTENSION_INTRODUCER 0x21
|
||||
#define IMAGE_DESCRIPTOR 0x2C
|
||||
#define TRAILER 0x3B
|
||||
|
||||
#define GRAPHIC_CONTROL 0xF9
|
||||
#define APPLICATION_EXTENSION 0xFF
|
||||
#define COMMENT_EXTENSION 0xFE
|
||||
#define PLAINTEXT_EXTENSION 0x01
|
||||
|
||||
#define READ(dst, size) memcpy(dst, buffer, size); buffer += size
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short width;
|
||||
unsigned short height;
|
||||
unsigned char fields;
|
||||
unsigned char background_color_index;
|
||||
unsigned char pixel_aspect_ratio;
|
||||
}
|
||||
screen_descriptor_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char r;
|
||||
unsigned char g;
|
||||
unsigned char b;
|
||||
}
|
||||
rgb;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short image_left_position;
|
||||
unsigned short image_top_position;
|
||||
unsigned short image_width;
|
||||
unsigned short image_height;
|
||||
unsigned char fields;
|
||||
}
|
||||
image_descriptor_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char byte;
|
||||
int prev;
|
||||
int len;
|
||||
}
|
||||
dictionary_entry_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char extension_code;
|
||||
unsigned char block_size;
|
||||
}
|
||||
extension_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char fields;
|
||||
unsigned short delay_time;
|
||||
unsigned char transparent_color_index;
|
||||
}
|
||||
graphic_control_extension_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char application_id[ 8 ];
|
||||
unsigned char version[ 3 ];
|
||||
}
|
||||
application_extension_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short left;
|
||||
unsigned short top;
|
||||
unsigned short width;
|
||||
unsigned short height;
|
||||
unsigned char cell_width;
|
||||
unsigned char cell_height;
|
||||
unsigned char foreground_color;
|
||||
unsigned char background_color;
|
||||
}
|
||||
plaintext_extension_t;
|
||||
|
||||
//static unsigned short width = 0;
|
||||
//static unsigned short height = 0;
|
||||
//static unsigned char* uncompressed_data = NULL;
|
||||
|
||||
void uncompress( int code_length,
|
||||
const unsigned char *input,
|
||||
int input_length,
|
||||
unsigned char *out )
|
||||
{
|
||||
//int maxbits;
|
||||
int i, bit;
|
||||
int code, prev = -1;
|
||||
dictionary_entry_t *dictionary;
|
||||
int dictionary_ind;
|
||||
unsigned int mask = 0x01;
|
||||
int reset_code_length;
|
||||
int clear_code; // This varies depending on code_length
|
||||
int stop_code; // one more than clear code
|
||||
int match_len;
|
||||
|
||||
clear_code = 1 << ( code_length );
|
||||
stop_code = clear_code + 1;
|
||||
// To handle clear codes
|
||||
reset_code_length = code_length;
|
||||
|
||||
// Create a dictionary large enough to hold "code_length" entries.
|
||||
// Once the dictionary overflows, code_length increases
|
||||
dictionary = ( dictionary_entry_t * )
|
||||
malloc( sizeof( dictionary_entry_t ) * ( 1 << ( code_length + 1 ) ) );
|
||||
|
||||
// Initialize the first 2^code_len entries of the dictionary with their
|
||||
// indices. The rest of the entries will be built up dynamically.
|
||||
|
||||
// Technically, it shouldn't be necessary to initialize the
|
||||
// dictionary. The spec says that the encoder "should output a
|
||||
// clear code as the first code in the image data stream". It doesn't
|
||||
// say must, though...
|
||||
for ( dictionary_ind = 0;
|
||||
dictionary_ind < ( 1 << code_length );
|
||||
dictionary_ind++ )
|
||||
{
|
||||
dictionary[ dictionary_ind ].byte = dictionary_ind;
|
||||
// XXX this only works because prev is a 32-bit int (> 12 bits)
|
||||
dictionary[ dictionary_ind ].prev = -1;
|
||||
dictionary[ dictionary_ind ].len = 1;
|
||||
}
|
||||
|
||||
// 2^code_len + 1 is the special "end" code; don't give it an entry here
|
||||
dictionary_ind++;
|
||||
dictionary_ind++;
|
||||
|
||||
// TODO verify that the very last byte is clear_code + 1
|
||||
while ( input_length )
|
||||
{
|
||||
code = 0x0;
|
||||
// Always read one more bit than the code length
|
||||
for ( i = 0; i < ( code_length + 1 ); i++ )
|
||||
{
|
||||
// This is different than in the file read example; that
|
||||
// was a call to "next_bit"
|
||||
bit = ( *input & mask ) ? 1 : 0;
|
||||
mask <<= 1;
|
||||
|
||||
if ( mask == 0x100 )
|
||||
{
|
||||
mask = 0x01;
|
||||
input++;
|
||||
input_length--;
|
||||
}
|
||||
|
||||
code = code | ( bit << i );
|
||||
}
|
||||
|
||||
if ( code == clear_code )
|
||||
{
|
||||
code_length = reset_code_length;
|
||||
dictionary = ( dictionary_entry_t * ) realloc( dictionary,
|
||||
sizeof( dictionary_entry_t ) * ( 1 << ( code_length + 1 ) ) );
|
||||
|
||||
for ( dictionary_ind = 0;
|
||||
dictionary_ind < ( 1 << code_length );
|
||||
dictionary_ind++ )
|
||||
{
|
||||
dictionary[ dictionary_ind ].byte = dictionary_ind;
|
||||
// XXX this only works because prev is a 32-bit int (> 12 bits)
|
||||
dictionary[ dictionary_ind ].prev = -1;
|
||||
dictionary[ dictionary_ind ].len = 1;
|
||||
}
|
||||
dictionary_ind++;
|
||||
dictionary_ind++;
|
||||
prev = -1;
|
||||
continue;
|
||||
}
|
||||
else if ( code == stop_code )
|
||||
{
|
||||
/*if ( input_length > 1 )
|
||||
{
|
||||
fprintf( stderr, "Malformed GIF (early stop code)\n" );
|
||||
exit( 0 );
|
||||
}*/
|
||||
break;
|
||||
}
|
||||
|
||||
// Update the dictionary with this character plus the _entry_
|
||||
// (character or string) that came before it
|
||||
if ( ( prev > -1 ) && ( code_length < 12 ) )
|
||||
{
|
||||
if ( code > dictionary_ind )
|
||||
{
|
||||
fprintf( stderr, "code = %.02x, but dictionary_ind = %.02x\n",
|
||||
code, dictionary_ind );
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
// Special handling for KwKwK
|
||||
if ( code == dictionary_ind )
|
||||
{
|
||||
int ptr = prev;
|
||||
|
||||
while ( dictionary[ ptr ].prev != -1 )
|
||||
{
|
||||
ptr = dictionary[ ptr ].prev;
|
||||
}
|
||||
dictionary[ dictionary_ind ].byte = dictionary[ ptr ].byte;
|
||||
}
|
||||
else
|
||||
{
|
||||
int ptr = code;
|
||||
while ( dictionary[ ptr ].prev != -1 )
|
||||
{
|
||||
ptr = dictionary[ ptr ].prev;
|
||||
}
|
||||
dictionary[ dictionary_ind ].byte = dictionary[ ptr ].byte;
|
||||
}
|
||||
|
||||
dictionary[ dictionary_ind ].prev = prev;
|
||||
|
||||
dictionary[ dictionary_ind ].len = dictionary[ prev ].len + 1;
|
||||
|
||||
dictionary_ind++;
|
||||
|
||||
// GIF89a mandates that this stops at 12 bits
|
||||
if ( ( dictionary_ind == ( 1 << ( code_length + 1 ) ) ) &&
|
||||
( code_length < 11 ) )
|
||||
{
|
||||
code_length++;
|
||||
|
||||
dictionary = ( dictionary_entry_t * ) realloc( dictionary,
|
||||
sizeof( dictionary_entry_t ) * ( 1 << ( code_length + 1 ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
prev = code;
|
||||
|
||||
// Now copy the dictionary entry backwards into "out"
|
||||
match_len = dictionary[ code ].len;
|
||||
while ( code != -1 )
|
||||
{
|
||||
out[ dictionary[ code ].len - 1 ] = dictionary[ code ].byte;
|
||||
if ( dictionary[ code ].prev == code )
|
||||
{
|
||||
fprintf( stderr, "Internal error; self-reference." );
|
||||
exit( 0 );
|
||||
}
|
||||
code = dictionary[ code ].prev;
|
||||
}
|
||||
|
||||
out += match_len;
|
||||
}
|
||||
}
|
||||
|
||||
static int read_sub_blocks( unsigned char* buffer, unsigned char **data )
|
||||
{
|
||||
int data_length;
|
||||
int index;
|
||||
unsigned char block_size;
|
||||
|
||||
// Everything following are data sub-blocks, until a 0-sized block is
|
||||
// encountered.
|
||||
data_length = 0;
|
||||
*data = NULL;
|
||||
index = 0;
|
||||
|
||||
while ( 1 )
|
||||
{
|
||||
READ(&block_size, 1);
|
||||
|
||||
if ( block_size == 0 ) // end of sub-blocks
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
data_length += block_size;
|
||||
*data = (unsigned char*)realloc( *data, data_length );
|
||||
|
||||
// TODO this could be split across block size boundaries
|
||||
READ(*data + index, block_size);
|
||||
|
||||
index += block_size;
|
||||
}
|
||||
|
||||
return data_length;
|
||||
}
|
||||
|
||||
unsigned char* process_image_descriptor( unsigned char* buffer,
|
||||
rgb *gct,
|
||||
int gct_size,
|
||||
int resolution_bits )
|
||||
{
|
||||
image_descriptor_t image_descriptor;
|
||||
int compressed_data_length;
|
||||
unsigned char *compressed_data = NULL;
|
||||
unsigned char lzw_code_size;
|
||||
int uncompressed_data_length = 0;
|
||||
unsigned char *uncompressed_data = NULL;
|
||||
|
||||
// TODO there could actually be lots of these
|
||||
READ(&image_descriptor, 9);
|
||||
|
||||
// TODO if LCT = true, read the LCT
|
||||
|
||||
READ(&lzw_code_size, 1);
|
||||
|
||||
compressed_data_length = read_sub_blocks( buffer, &compressed_data );
|
||||
|
||||
// width = image_descriptor.image_width;
|
||||
// height = image_descriptor.image_height;
|
||||
uncompressed_data_length = image_descriptor.image_width *
|
||||
image_descriptor.image_height;
|
||||
uncompressed_data = (unsigned char*)malloc( uncompressed_data_length );
|
||||
|
||||
uncompress( lzw_code_size, compressed_data, compressed_data_length,
|
||||
uncompressed_data );
|
||||
|
||||
if ( compressed_data ) free( compressed_data );
|
||||
|
||||
//if ( uncompressed_data )
|
||||
// free( uncompressed_data );
|
||||
|
||||
return uncompressed_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param gif_file the file descriptor of a file containing a
|
||||
* GIF-encoded file. This should point to the first byte in
|
||||
* the file when invoked.
|
||||
*/
|
||||
#define rb (*(buffer++))
|
||||
|
||||
uint32_t* LoadPalette(unsigned char *buffer) {
|
||||
unsigned char header[7];
|
||||
screen_descriptor_t screen_descriptor;
|
||||
//int color_resolution_bits;
|
||||
|
||||
int global_color_table_size = 0; // number of entries in global_color_table
|
||||
uint32_t *global_color_table = NULL;
|
||||
|
||||
READ(header, 6);
|
||||
READ(&screen_descriptor, 7);
|
||||
|
||||
//color_resolution_bits = ((screen_descriptor.fields & 0x70) >> 4) + 1;
|
||||
global_color_table = (uint32_t *)calloc(1, 1024);
|
||||
|
||||
if (screen_descriptor.fields & 0x80) {
|
||||
global_color_table_size = 1 << (((screen_descriptor.fields & 0x07) + 1));
|
||||
|
||||
//global_color_table = (rgb *)malloc(3 * global_color_table_size);
|
||||
//READ(global_color_table, 3 * global_color_table_size);
|
||||
for (int i=0; i<global_color_table_size;++i) {
|
||||
global_color_table[i] = (buffer[0]<<16) + (buffer[1]<<8) + buffer[2];
|
||||
buffer+=3;
|
||||
}
|
||||
}
|
||||
return global_color_table;
|
||||
}
|
||||
|
||||
static unsigned char* process_gif_stream(unsigned char *buffer, unsigned short* w, unsigned short* h)
|
||||
{
|
||||
unsigned char header[ 7 ];
|
||||
screen_descriptor_t screen_descriptor;
|
||||
int color_resolution_bits;
|
||||
|
||||
int global_color_table_size =0; // number of entries in global_color_table
|
||||
rgb *global_color_table = NULL;
|
||||
|
||||
unsigned char block_type = 0x0;
|
||||
|
||||
// A GIF file starts with a Header (section 17)
|
||||
READ(header, 6);
|
||||
header[ 6 ] = 0x0;
|
||||
|
||||
// XXX there's another format, GIF87a, that you may still find
|
||||
// floating around.
|
||||
/*if ( strcmp( "GIF89a", (char*)header ) )
|
||||
{
|
||||
fprintf( stderr,
|
||||
"Invalid GIF file (header is '%s', should be 'GIF89a')\n",
|
||||
header );
|
||||
return NULL;
|
||||
}*/
|
||||
|
||||
// Followed by a logical screen descriptor
|
||||
// Note that this works because GIFs specify little-endian order; on a
|
||||
// big-endian machine, the height & width would need to be reversed.
|
||||
|
||||
// Can't use sizeof here since GCC does byte alignment;
|
||||
// sizeof( screen_descriptor_t ) = 8!
|
||||
READ(&screen_descriptor, 7);
|
||||
*w = screen_descriptor.width;
|
||||
*h = screen_descriptor.height;
|
||||
|
||||
color_resolution_bits = ( ( screen_descriptor.fields & 0x70 ) >> 4 ) + 1;
|
||||
|
||||
if ( screen_descriptor.fields & 0x80 )
|
||||
{
|
||||
//int i;
|
||||
// If bit 7 is set, the next block is a global color table; read it
|
||||
global_color_table_size = 1 <<
|
||||
( ( ( screen_descriptor.fields & 0x07 ) + 1 ) );
|
||||
|
||||
global_color_table = ( rgb * ) malloc( 3 * global_color_table_size );
|
||||
|
||||
// XXX this could conceivably return a short count...
|
||||
READ(global_color_table, 3 * global_color_table_size);
|
||||
}
|
||||
|
||||
while ( block_type != TRAILER )
|
||||
{
|
||||
READ(&block_type, 1);
|
||||
|
||||
unsigned char size;
|
||||
switch ( block_type )
|
||||
{
|
||||
case IMAGE_DESCRIPTOR:
|
||||
return process_image_descriptor(buffer,
|
||||
global_color_table,
|
||||
global_color_table_size,
|
||||
color_resolution_bits);
|
||||
break;
|
||||
case EXTENSION_INTRODUCER:
|
||||
buffer++;
|
||||
size = *(buffer++);
|
||||
buffer += size;
|
||||
do {
|
||||
size = *(buffer++);
|
||||
buffer += size;
|
||||
} while (size != 0);
|
||||
|
||||
/*if ( !process_extension( buffer ) )
|
||||
{
|
||||
return NULL;
|
||||
}*/
|
||||
break;
|
||||
case TRAILER:
|
||||
break;
|
||||
default:
|
||||
fprintf( stderr, "Bailing on unrecognized block type %.02x\n",
|
||||
block_type );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
unsigned char* LoadGif(unsigned char *buffer, unsigned short* w, unsigned short* h) {
|
||||
return process_gif_stream(buffer, w, h);
|
||||
}
|
||||
|
||||
/*int main( int argc, char *argv[] )
|
||||
{
|
||||
FILE* gif_file;
|
||||
|
||||
if ( argc < 2 )
|
||||
{
|
||||
fprintf( stderr, "Usage: %s <path-to-gif-file>\n", argv[ 0 ] );
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
gif_file = fopen( argv[ 1 ], "rb" );
|
||||
|
||||
if ( gif_file == NULL )
|
||||
{
|
||||
fprintf( stderr, "Unable to open file '%s'", argv[ 1 ] );
|
||||
perror( ": " );
|
||||
}
|
||||
|
||||
process_gif_stream( gif_file );
|
||||
|
||||
fclose( gif_file );
|
||||
}*/
|
||||
@@ -39,8 +39,12 @@ OnScreenKeyboard::OnScreenKeyboard(SDL_Renderer *renderer, Input *input, string
|
||||
|
||||
// Rellena la textura del cursor
|
||||
SDL_SetRenderTarget(renderer, textureCursor);
|
||||
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 128);
|
||||
color_t c = {192, 0, 0};
|
||||
SDL_SetRenderDrawColor(renderer, c.r, c.g, c.b, 255);
|
||||
SDL_RenderClear(renderer);
|
||||
c = lightenColor(c, 20);
|
||||
SDL_SetRenderDrawColor(renderer, c.r, c.g, c.b, 255);
|
||||
SDL_RenderDrawRect(renderer, NULL);
|
||||
SDL_SetRenderTarget(renderer, nullptr);
|
||||
}
|
||||
|
||||
@@ -77,6 +81,9 @@ void OnScreenKeyboard::fillTexture()
|
||||
// Establece el color de fondo
|
||||
SDL_SetRenderDrawColor(renderer, bgColor.r, bgColor.g, bgColor.b, 255);
|
||||
SDL_RenderClear(renderer);
|
||||
color_t color = lightenColor(bgColor, 20);
|
||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 255);
|
||||
SDL_RenderDrawRect(renderer, NULL);
|
||||
|
||||
// Escribe el texto que aparece en el objeto
|
||||
text->write(text->getCharacterSize(), text->getCharacterSize(), caption);
|
||||
@@ -105,7 +112,8 @@ void OnScreenKeyboard::fillTexture()
|
||||
// SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 255);
|
||||
// SDL_Rect rect = {offset_x + (layout.at(pos).col * dist), offset_y + (layout.at(pos).row * dist), dist, dist};
|
||||
// SDL_RenderFillRect(renderer, &rect);
|
||||
text->write(offset_x + (layout.at(pos).col * dist) + 4, offset_y + (layout.at(pos).row * dist) + 4, layout.at(pos).caption);
|
||||
// text->write(offset_x + (layout.at(pos).col * dist) + (dist / 2), offset_y + (layout.at(pos).row * dist) + (dist / 2), layout.at(pos).caption);
|
||||
text->writeCentered(offset_x + (layout.at(pos).col * dist) + (dist / 2), offset_y + (layout.at(pos).row * dist) + (dist / 4), layout.at(pos).caption);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +164,7 @@ void OnScreenKeyboard::setLayout()
|
||||
allChars = use_char_symbol ? allChars + char_symbol : allChars;
|
||||
|
||||
layout.clear();
|
||||
for (int i = 0; i < allChars.length(); ++i)
|
||||
for (int i = 0; i < (int)allChars.length(); ++i)
|
||||
{
|
||||
key_t key;
|
||||
key.col = index_col;
|
||||
@@ -164,8 +172,6 @@ void OnScreenKeyboard::setLayout()
|
||||
key.caption = allChars.substr(i, 1);
|
||||
layout.push_back(key);
|
||||
|
||||
// std::cout << key.caption << " " << key.col << " " << key.row << " " << std::endl;
|
||||
|
||||
++index_col;
|
||||
if (index_col == columns)
|
||||
{
|
||||
@@ -200,7 +206,7 @@ void OnScreenKeyboard::checkInput()
|
||||
// Disminuye en una columna la posición del cursor
|
||||
void OnScreenKeyboard::decCursorCol()
|
||||
{
|
||||
cursor.col = cursor.col > 0 ? --cursor.col : columns - 1;
|
||||
cursor.col = cursor.col > 0 ? cursor.col - 1 : columns - 1;
|
||||
}
|
||||
|
||||
// Incrementa en una columna la posición del cursor
|
||||
@@ -212,7 +218,7 @@ void OnScreenKeyboard::incCursorCol()
|
||||
// Disminuye en una fila la posición del cursor
|
||||
void OnScreenKeyboard::decCursorRow()
|
||||
{
|
||||
cursor.row = cursor.row > 0 ? --cursor.row : rows - 1;
|
||||
cursor.row = cursor.row > 0 ? cursor.row - 1 : rows - 1;
|
||||
}
|
||||
|
||||
// Aumenta en una fila la posición del cursor
|
||||
@@ -235,7 +241,7 @@ void OnScreenKeyboard::updateCursor()
|
||||
void OnScreenKeyboard::addChar()
|
||||
{
|
||||
const int pos = cursor.col + cursor.row * columns;
|
||||
if (pos < layout.size())
|
||||
if (pos < (int)layout.size())
|
||||
output = output + layout.at(pos).caption;
|
||||
}
|
||||
|
||||
@@ -261,6 +267,10 @@ void OnScreenKeyboard::render()
|
||||
{
|
||||
SDL_RenderCopy(renderer, texture, nullptr, &dest);
|
||||
SDL_RenderCopy(renderer, textureCursor, nullptr, &cursor.dest);
|
||||
|
||||
const int pos = cursor.col + cursor.row * columns;
|
||||
const string key = pos < (int)layout.size() ? layout.at(pos).caption : "";
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, cursor.dest.x + cursor.dest.w / 2, cursor.dest.y + cursor.dest.w / 4, key, 1, {0, 255, 0});
|
||||
text->write(dest.x + outputDest.x, dest.y + outputDest.y, output);
|
||||
}
|
||||
|
||||
|
||||
165
units/paleta.cpp
Normal file
165
units/paleta.cpp
Normal file
@@ -0,0 +1,165 @@
|
||||
#include "paleta.h"
|
||||
#include "gif.c"
|
||||
#include <stdio.h>
|
||||
|
||||
struct jSurface_s
|
||||
{
|
||||
Uint8 *data;
|
||||
Uint16 w, h;
|
||||
};
|
||||
|
||||
static SDL_Window *jWin = NULL;
|
||||
static SDL_Renderer *jRen = NULL;
|
||||
static SDL_Texture *jTex = NULL;
|
||||
static jSurface jScreen;
|
||||
static jSurface jDestSurf;
|
||||
static jSurface jSourceSurf = NULL;
|
||||
static Uint32 paleta[256];
|
||||
static int jWidth = 320;
|
||||
static int jHeight = 240;
|
||||
static int jZoom = 2;
|
||||
static int transparentColor = 0;
|
||||
|
||||
jSurface jNewSurface(int w, int h)
|
||||
{
|
||||
jSurface surf = (jSurface)malloc(sizeof(jSurface_s));
|
||||
surf->w = w;
|
||||
surf->h = h;
|
||||
surf->data = (Uint8 *)malloc(w * h);
|
||||
return surf;
|
||||
}
|
||||
|
||||
void jDeleteSurface(jSurface surf)
|
||||
{
|
||||
if (surf == NULL)
|
||||
return;
|
||||
if (surf->data != NULL)
|
||||
free(surf->data);
|
||||
free(surf);
|
||||
}
|
||||
|
||||
void jSetDest(jSurface surf)
|
||||
{
|
||||
if (surf == NULL)
|
||||
jDestSurf = jScreen;
|
||||
else
|
||||
jDestSurf = surf;
|
||||
}
|
||||
|
||||
void jSetSource(jSurface surf)
|
||||
{
|
||||
jSourceSurf = surf;
|
||||
}
|
||||
|
||||
void jBlit(int dx, int dy, int sx, int sy, int w, int h)
|
||||
{
|
||||
if (jSourceSurf == NULL)
|
||||
return;
|
||||
|
||||
for (int iy = 0; iy < h; ++iy)
|
||||
{
|
||||
for (int ix = 0; ix < w; ++ix)
|
||||
jPutPixel(dx + ix, dy + iy, jGetPixel(sx + ix, sy + iy));
|
||||
}
|
||||
}
|
||||
|
||||
jSurface jLoadSurface(const char *filename)
|
||||
{
|
||||
FILE *f = fopen(filename, "rb");
|
||||
if (!f)
|
||||
return NULL;
|
||||
|
||||
fseek(f, 0, SEEK_END);
|
||||
long size = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
Uint8 *buffer = (Uint8 *)malloc(size);
|
||||
fread(buffer, size, 1, f);
|
||||
fclose(f);
|
||||
|
||||
Uint16 w, h;
|
||||
Uint8 *pixels = LoadGif(buffer, &w, &h);
|
||||
if (pixels == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
jSurface surf = (jSurface)malloc(sizeof(jSurface_s));
|
||||
surf->w = w;
|
||||
surf->h = h;
|
||||
surf->data = pixels;
|
||||
free(buffer);
|
||||
return surf;
|
||||
}
|
||||
|
||||
void jLoadPal(const char *filename)
|
||||
{
|
||||
FILE *f = fopen(filename, "rb");
|
||||
if (!f)
|
||||
return;
|
||||
|
||||
fseek(f, 0, SEEK_END);
|
||||
long size = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
Uint8 *buffer = (Uint8 *)malloc(size);
|
||||
fread(buffer, size, 1, f);
|
||||
fclose(f);
|
||||
|
||||
Uint32 *pal = LoadPalette(buffer);
|
||||
if (pal == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
free(buffer);
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
paleta[i] = pal[i];
|
||||
}
|
||||
}
|
||||
|
||||
void jInit(const char *titol, int w, int h, int z)
|
||||
{
|
||||
SDL_Init(SDL_INIT_EVERYTHING);
|
||||
jWidth = w;
|
||||
jHeight = h;
|
||||
jZoom = z;
|
||||
jWin = SDL_CreateWindow(titol, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, w * z, h * z, SDL_WINDOW_SHOWN);
|
||||
jRen = SDL_CreateRenderer(jWin, -1, 0);
|
||||
SDL_RenderSetLogicalSize(jRen, w, h);
|
||||
jTex = SDL_CreateTexture(jRen, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, w, h);
|
||||
jScreen = jNewSurface(w, h);
|
||||
jDestSurf = jScreen;
|
||||
}
|
||||
|
||||
void jSetPal(int index, Uint32 color)
|
||||
{
|
||||
paleta[index] = color;
|
||||
}
|
||||
|
||||
void jCls(Uint8 color)
|
||||
{
|
||||
for (int i = 0; i < jDestSurf->w * jDestSurf->h; ++i)
|
||||
jDestSurf->data[i] = color;
|
||||
}
|
||||
|
||||
void jFlip()
|
||||
{
|
||||
Uint32 *pixels;
|
||||
int pitch;
|
||||
SDL_LockTexture(jTex, NULL, (void **)&pixels, &pitch);
|
||||
for (int i = 0; i < jWidth * jHeight; ++i)
|
||||
pixels[i] = paleta[jScreen->data[i]];
|
||||
SDL_UnlockTexture(jTex);
|
||||
SDL_RenderCopy(jRen, jTex, NULL, NULL);
|
||||
SDL_RenderPresent(jRen);
|
||||
}
|
||||
|
||||
void jPutPixel(int x, int y, Uint8 color)
|
||||
{
|
||||
if (x < 0 || y < 0 || x >= jDestSurf->w || y >= jDestSurf->h || color == transparentColor)
|
||||
return;
|
||||
jDestSurf->data[x + y * jDestSurf->w] = color;
|
||||
}
|
||||
|
||||
Uint8 jGetPixel(int x, int y)
|
||||
{
|
||||
return jSourceSurf->data[x + y * jSourceSurf->w];
|
||||
}
|
||||
28
units/paleta.h
Normal file
28
units/paleta.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
typedef struct jSurface_s *jSurface;
|
||||
|
||||
void init();
|
||||
void update();
|
||||
|
||||
jSurface jNewSurface(int w, int h);
|
||||
void jDeleteSurface(jSurface surf);
|
||||
void jSetDest(jSurface surf);
|
||||
void jSetSource(jSurface surf);
|
||||
|
||||
jSurface jLoadSurface(const char* filename);
|
||||
|
||||
void jPutPixel(int x, int y, Uint8 color);
|
||||
Uint8 jGetPixel(int x, int y);
|
||||
|
||||
void jBlit(int dx, int dy, int sx, int sy, int w, int h);
|
||||
|
||||
void jInit(const char *titol, int w, int h, int z);
|
||||
|
||||
void jSetPal(int index, Uint32 color);
|
||||
void jLoadPal(const char *filename);
|
||||
|
||||
void jCls(Uint8 color);
|
||||
|
||||
void jFlip();
|
||||
Reference in New Issue
Block a user