Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Fri Jul 23, 2004 8:18 am Post subject: Simple region tools |
|
|
|
|
These are tools to help create single rectangles. Good for testing with regions or very square maps.
numtochar.c:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "util.h"
#include "region.h"
int main(int argc, char *argv[])
{
if (argc == 5)
{
rect_t r;
char out[10];
r.x = atoi(argv[1]);
r.y = atoi(argv[2]);
r.w = atoi(argv[3]);
r.h = atoi(argv[4]);
encode_rectangle(out, r);
printf("x:%i y:%i w:%i h:%i\n", r.x, r.y, r.w, r.h);
printf("%s\n", out);
exit(0);
}
else
{
printf("usage: %s <x> <y> <w> <h>\n", argv[0]);
exit(1);
}
}
|
chartonum.c:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "util.h"
#include "region.h"
int main(int argc, char *argv[])
{
if (argc == 2)
{
if (strlen(argv[1]) != 9)
{
rect_t r;
r = decode_rectangle(argv[1]);
printf("x:%i y:%i w:%i h:%i\n", r.x, r.y, r.w, r.h);
exit(0);
}
else
{
printf("Error: bad length.\n");
exit(1);
}
}
else
{
printf("usage: %s <chars>\n", argv[0]);
exit(1);
}
}
|
_________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me
chartonum.c - 0 KB
File downloaded or viewed 32 time(s)
numtochar.c - 0 KB
File downloaded or viewed 32 time(s)
|
|