reset velo -> set + fix png2c wrap

This commit is contained in:
nemo 2024-11-14 09:47:48 +01:00
parent f04ba84834
commit 0f7109cb11
5 changed files with 5 additions and 5 deletions

4
app.c
View File

@ -52,9 +52,9 @@ void key_released(int key)
v2 velocity = {0, 0}; v2 velocity = {0, 0};
void reset_velocity(void) void set_velocity(float x, float y)
{ {
velocity = (v2){0, 0}; velocity = (v2){x, y};
} }
void rebondi(v2 *pos, int scale) void rebondi(v2 *pos, int scale)

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
export_sym="init go key_pressed key_released reset_velocity BUFFER width height" export_sym="init go key_pressed key_released set_velocity BUFFER width height"
export_cmd="" export_cmd=""
for e in $export_sym; do for e in $export_sym; do
export_cmd="$export_cmd -Wl,--export=$e"; export_cmd="$export_cmd -Wl,--export=$e";

View File

@ -17,7 +17,7 @@ window.onload = () => {
scale_p.innerText = "scale: " + scale; scale_p.innerText = "scale: " + scale;
} }
reset_but.onclick = () => { reset_but.onclick = () => {
global_instance.exports.reset_velocity(); global_instance.exports.set_velocity(0, 0);
} }
}; };

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -26,7 +26,7 @@ int main(int argc, const char *argv[])
for (int y = 0; y < height; y++) { for (int y = 0; y < height; y++) {
printf(" "); printf(" ");
for (int i = 0; i < width; i++) { for (int i = 0; i < width; i++) {
printf("0x%08X,", data[y*height + i]); printf("0x%08X,", data[y*width + i]);
} }
printf("\n"); printf("\n");
} }