1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/small3dlib.git synced 2024-11-21 20:39:57 +01:00

Fix sorting

This commit is contained in:
Miloslav Číž 2019-05-28 12:49:13 +02:00
parent 822579383e
commit b7de74034d
2 changed files with 13 additions and 3 deletions

View file

@ -1887,7 +1887,7 @@ void S3L_drawScene(S3L_Scene scene)
#if S3L_SORT != S3L_SORT_NONE
// TODO: CHANGE BUBBLE SORT TO SOMETHING FASTER!
for (int16_t i = S3L_sortArrayLength - 1; i >= 0; --i)
for (int16_t i = S3L_sortArrayLength - 2; i >= 0; --i)
for (S3L_Index j = 0; j <= i; ++j)
{
if (S3L_sortArray[j].sortValue < S3L_sortArray[j + 1].sortValue)

View file

@ -207,6 +207,8 @@ int main()
draw();
SDL_UpdateTexture(texture,NULL,pixels,S3L_RESOLUTION_X * sizeof(uint32_t));
int code = 0;
while (SDL_PollEvent(&event))
{
switch (event.type)
@ -216,11 +218,19 @@ int main()
break;
case SDL_KEYDOWN:
keys['a' + event.key.keysym.scancode - SDL_SCANCODE_A] = 1;
code = 'a' + event.key.keysym.scancode - SDL_SCANCODE_A;
if (code >= 0 && code <= 255)
keys[code] = 1;
break;
case SDL_KEYUP:
keys['a' + event.key.keysym.scancode - SDL_SCANCODE_A] = 0;
code = 'a' + event.key.keysym.scancode - SDL_SCANCODE_A;
if (code >= 0 && code <= 255)
keys[code] = 0;
break;
default: