I know how to rotate sprite "lol". I just need to help an issue.

I have been recently working on a library/engine. But I've been having issues rotating sprites.

I have a struct with "gfx_sprite_t" sprite ... it's best if I show you:

gfx3.h


Code:
#ifndef GFX3_H
#define GFX3_H

struct gfx3_object_t{
   bool active;
   gfx_sprite_t *layers[50];
   int offset[2]; // [x, y]
   uint8_t scale[2]; // [xs, ys]
   uint8_t Max_Layers;
}gfx3_object[30];

// extern struct gfx3_object_t gfx3_object[30];

... // removed other functions odd reasons <_<

// Object rotation
void gfx3_RotateObjectCC(uint8_t index);
void gfx3_RotateObjectC(uint8_t index);
void gfx3_SetObjectAngle(uint8_t angle, uint8_t index);

...

#endif
}



gfx3.c

Code:
// By: Alvajoy"Alvajoy"123

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <tice.h>

// Standard headers
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// Graphic libs
#include <graphx.h>

// My Headers
#include "gfx3/gfx3.h"


// gfx_sprite_t *temp_layer;

gfx_UninitedSprite(temp_layer, 70, 70);

.... // other fuction not needed

void gfx3_RotateObjectC(uint8_t index){
   int i;
   for (i = 0; i > gfx3_object[index].Max_Layers; i++){
      // gfx_UninitedSprite(layer_buffer, gfx3_object[index].layers[i]->width, gfx3_object[index].layers[i]->);
      gfx3_object[index].layers[i] = gfx_RotateSpriteCC(gfx3_object[index].layers[i], temp_layer);
   }
   return;
}



I want the rotation to be optimized. The code obviously doesn't work ... I need help Sad
Your < is backwards. Can't tell you any more without more code.
MateoConLechuga wrote:
Your < is backwards. Can't tell you any more without more code.

Yep, that for loop will never run.
MateoConLechuga wrote:
Your < is backwards. Can't tell you any more without more code.


epsilon5 wrote:
MateoConLechuga wrote:
Your < is backwards. Can't tell you any more without more code.

Yep, that for loop will never run.


I just noticed lol.
The code works now!! Good Idea
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement