CS383Team2 / Goofy_Lights_Editor

1 stars 1 forks source link

Function TranslateFrame #7

Closed Cyberzoid1 closed 7 years ago

Cyberzoid1 commented 7 years ago

int translateFrame(t_FrameData d, int direction)


#define D_UP         1
#define D_DWN     2
#define D_LEFT       3
#define D_RIGHT   4

// possible implementation
#define D_UP_L       5
#define D_UP_R      6
#define D_DWN_L   7
#define D_DWN_R  8
Cyberzoid1 commented 7 years ago

We need to decide if a diagonal translation (ex UP Left) is handled in function translate(d, D_UP_L) or is two calls to the function translateFrame(d, D_UP) translateFrame(d, D_LEFT)

gjcarter commented 7 years ago

What I was thinking is that there would either be a 4 separate functions for up, down, left, and right, which then would be run in the function depending on the direction input into the function or have the function run twice depending on the direction input. I'm thinking the first option sounds a little bit better, but I'd like some input on it before I begin on them.

Cyberzoid1 commented 7 years ago

I am starting to lean on the single function call idea. The idea being "Function, do this for me" and the function does everything else.

I dont think 4 functions would be right. A lot of overlap. Though I could possibly see 2, one for up/down and a second fo right/left.

gjcarter commented 7 years ago

Ya, I'm thinking now maybe just a single function for the direction and just have the translation function call that function once or twice depending on the direction the frame needs to move or we can just have the translation function and for the diagonals I could just use a recursive call to do the second direction.