-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|516|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- Socoder -> C/C++/C#/Other -> Spiral Code? Posted : Sunday, 12 April 2015, 14:00 spinal Good afternoon everyone. I'm trying to draw a spiral on my pebble. this... graphics_context_set_stroke_color(ctx, GColorWhite); int theta = 0; int x = 0; int y = 0; int ox = 0; int oy = 0; for( int distance = 80; distance >0; distance--){ theta = theta + 8; x = 72 + cos_lookup(theta * TRIG_MAX_ANGLE / 180) * distance; y = 72 + sin_lookup(theta * TRIG_MAX_ANGLE / 180) * distance; graphics_draw_line(ctx, GPoint(ox,oy), GPoint(x,y)); ox = x; oy = y; } --v doesn't seem to be working, any ideas anyone? -=-=- Check out my excellent homepage! Posted : Sunday, 12 April 2015, 14:55 Krakatomato Maybe this will help. onEachFrame() do fill( :black ) setColor( :white ) i = 0; angle = 0; x = 300; y = 200; ox = x; oy = y; loop angle = 0.1 * i; x = 300 + (1 + angle) * angle.cos()*5; y = 200 + (1 + angle) * angle.sin()*5; drawline(ox, oy, x, y); ox = x; oy = y; i = i + 0.1; end while (i < 360); end --v //Andy Posted : Sunday, 12 April 2015, 15:06 Jayenkai It took me bloody AGES to get the bouncy ball sin/cos stuff in SpikeDislike to work, and I still don't have a fucking clue what it was that made it work! Yeah, I don't trust their Sin/Cos much, at all. Which is frustrating as hell given that 95% of Watch Function relies on it! FFS... Anyway, after a LOT (about an hour) of wrangling, I found this to be working. graphics_context_set_stroke_color(ctx, GColorBlack); float theta = 0; float x = 70; float y = 70; float ox = 0; float oy = 0; float ang=0; for( float distance = 0; distance <80; distance++){ theta = theta + 8; ang=(TRIG_MAX_ANGLE * theta/360.0); x =(cos_lookup(ang ) * (distance/TRIG_MAX_RATIO)); y =(sin_lookup(ang ) * (distance/TRIG_MAX_RATIO)); graphics_draw_line(ctx, GPoint(70+ox,70+oy), GPoint(70+x,70+y)); ox = x; oy = y; } --v Although, fuck knows why! @Krakatomato : Pebble's Sin/Cos are screwed up beyond all known logic! I'm sure that, somewhere, it's done for a reason, but I'm damned if I can figure out why!! -=-=- ''Load, Next List!'' Posted : Sunday, 12 April 2015, 15:14 Krakatomato Afraid I don't have a Pebble (Mr. Casio watch from the 80's here), so haven't really bothered looking into it much Does sound like a right old faff though =/ //Andy Posted : Sunday, 12 April 2015, 15:21 Jayenkai It explains it all here. https://developer.getpebble.com/docs/c/Foundation/Math/ .. But using words wot dunt wurk in mai hed. -=-=- ''Load, Next List!'' Posted : Monday, 13 April 2015, 02:21 spinal got that working, but no I have all sorts of issues, namely, far too much memory usage. Going to have to redo max time from the ground up (again). Maybe it's time to look into some sort of 8x8 tile map for the huge max head, chop out repeating bits ect. |edit| I'm sure someone here game me a link to a bitmap cutter-upper at some point in the past, done in blitz i believe... -=-=- Check out my excellent homepage! Posted : Monday, 13 April 2015, 02:31 Jayenkai The only cutter I've used is the one that came with PALib. You might want to travel back in time and have a nosey at what that could do for you.. -=-=- ''Load, Next List!'' Posted : Monday, 13 April 2015, 03:06 spinal Bingo.... https://socoder.net/index.php?topic=3666&viewpost=37082#37082 -=-=- Check out my excellent homepage! Posted : Monday, 13 April 2015, 03:58 Jayenkai Handy! Posted : Monday, 13 April 2015, 06:24 rockford Yep. MapRecon saved me hours and hours of work when I did remakes. Posted : Tuesday, 14 April 2015, 02:21 Jayenkai How goes the Spiral, Spinal? Posted : Tuesday, 14 April 2015, 02:57 spinal Spiral found its way to where it needed to be. However, as stated above, it has the unfortunate side effect of using up the last of the ram. So I'll be starting over. It looks like the colour version might have to be a second watchface instead of integrating it. -=-=- Check out my excellent homepage! 