this was a huge help, thanks...
Type: Posts; User: joed
this was a huge help, thanks...
I want to get a job in programming, not necessarily the highest paying but something I would enjoy. I've thought about schools, but I'm limited to going at night since I work 9-5 and have a mortgage,...
Double is the return type, you don't need it in the program. Just do pow(a, b).
You might be better off. :)
Wrote Rendera entirely from scratch in C. Might be a bit dated, but does most of what I wanted. There were many gotchas along the way, I have a lot of respect for people writing graphics apps now.
Skip the function pointers, you don't need them if calling the same function always. I meant only to read up on the subjects, not to use the examples outright.
Read up on structures and type definitions. You'll most likely end up with an array of 200 instrument structures, an array of output values, and a few simple support functions.
You can fill arrays...
Sorry, I did it wrong:
movl _buf, %eax
pushl %ebp
movl %eax, _a
movl %esp, %ebp
movl _buf+4, %eax
popl %ebp
I'm stupid :)
What's the actual problem, are you testing for equality? Maybe try seeing if the values are close enough instead:
#include <math.h>
int close(float a, float b)
{
if(fabsf(a - b) <...
This should be right, if not, lemme know. I tried to shorten in a bit. Supposedly this can be modified to do ovals but I've not tried it.
void circle(int x, int y, int r)
{
r++;
int...
Just for fun, here's an easy way to draw circles, adapted from "8088 Macro Assembler Programming" by Dan Rollins. Could be shortened/optimized a bit:
void circle(int x, int y, int r)
{
int...
There can be many reasons, but usually the pointer wasn't NULL before using malloc. Do a couple of checks like this:
// example pointer
int *p;
// free dangling pointer
if(p)
free(p);
It's mostly portable, but I don't have a Mac, and don't want to freebie the code. I will keep it in mind though.
BTW there was a pretty bad bug in the undo system, might want to d/l the file again.
Download URL may have been wrong. Fixed now.
Get Rendera at:
http://www.joefus.com
Written in C, using free software tools like vim/mingw, and MS HtmlHelp. The program could really use antialiasing, hopefully next version. Have fun!
After the bounds check, this might work for the line test (untested).
x1, y1 and x2, y2 are the line endpoints:
dx1 = abs(mousex - x1);
dx2 = abs(mousex - x2);
dy1 = abs(mousey - y1);
dy2...
even = !(side & 1);
sorry!
You have to create the array to begin with:
int array[25 * 25];
Here's a start:
try ensuring the pointers are appropriately dead or active before using malloc or free:
int *p;
if(!p)
malloc...
if(p)
A while back I got "Windows 98 Programming from the Ground Up". Overall the book wouldn't be great, but the examples are in straight C, and work with mingw. Complete listings (including resource...
I think "long long" is the long-long-winded, yet correct choice. Might as well typedef it away.
I think you're confusing C's function calls with BASIC's goto command. Put the switch statement in a while loop that tests for a quit condition:
while(!quit) {
do stuff, set quit = 1...
Try this Bresenham, it's identical to MS-Paint except for a slight difference when lines are drawn backwards.
void line(int x1, int y1, int x2, int y2, int color)
{
int dx, dy, inx, iny, e;...
Why return an unsigned char instead of just "int"? Also, bitmap data can probably also be declared "int", since any math performed would usually be done on the extracted bytes. I use these macros...