For those who are interested, here is the substance of my header file, typedefs, and stack implementation.
(I include all the stack stuff for people who ever want stack stuff. I know I really appreciated the stack help I found online.)
It's kind of a conglomeration of C and C++, so it's a bit messy.
My apologies.
#include "include/math/common.h"
static const int maxcol = 3;
typedef struct grid GRID;
typedef struct tiles TILE;
typedef struct match MATCH;
typedef struct rgb COLOR;
class IntStack {
public:
void push(int t);
int pop();
void display();
int empty();
private:
void push(int t);
int pop();
void display();
int empty();
int tiles();
void show_toprow();
void show_topcol();
private:
void init_opengl();
void redraw();
void drawTwo();
void drawThree();
void key(unsigned char key, int x, int y);
TILE make_tile(char *filename);
void set_library();
TILE *set_array();
int gcd(int m, int n);
GRID subdivide(int width, int height);
twoDStack *reverse(twoDStack *A);
twoDStack *pixelit(twoDStack *pixels, Image *some_image);
//twoDStack *pixelate(GRID target);
COLOR **pixelate(GRID target);
MATCH *compare(twoDStack *RGB, GRID target);
int split(MATCH a[], int low, int high);
void quicksort(MATCH a[], int low, int high);
MATCH *sort_fits(MATCH *correspond, GRID target);
char **choose_best(MATCH *correspond, GRID target);
//MATCH *choose_best(MATCH *correspond, GRID target);
void duplicate(twoDStack *RGB, GRID target);
void lay_tiles(GRID target, char **final);
//void lay_tiles(GRID target, MATCH *final);
#include
static GLwindow *win_p;
static const int WINDOW_WIDTH = 512;
struct grid {
struct rgb {
struct tiles {
struct match {
TILE *lib_array = (TILE *)malloc(sizeof(*lib_array) * LIB_SIZ);
//stack silliness
void IntStack::push(int t)
int IntStack::pop()
void IntStack::display()
int IntStack::empty()
//two dimensional stack silliness
void twoDStack::push(int t)
int twoDStack::pop()
void twoDStack::display()
int twoDStack::empty()
int twoDStack::tiles()
void twoDStack::show_toprow()
void twoDStack::show_topcol()
the Project |
the Algorithm |
the Process and Program |
the Results |
the Flaws |
the Unfinished |
the Art
Code Snippets |
Sources |
email me
#include "include/ui/GLwindow.h"
#include "include/img/Image.h"
#include "structs.h"
static Image *my_image;
static GLwindow *next_win;
static Image *replica;
static GLwindow *hold;
static Image *tile;
static const int WINDOW_HEIGHT = 512;
static const int N = WINDOW_WIDTH/2;
static const int LIB_SIZ = 3602;
static const int TILE_DIM = 24; int pixels;
};
int across;
int down;
byte red;
};
byte green;
byte blue;
COLOR pieces[16];
};
char tile_name[35];
int grid_sq;
};
double QoF;
char tile_name[35];
{
if (top == maxelem) return;
}
s[top++] = t;
{
if (top == 0) return -1;
}
return s[--top];
{
if (top == 0) { cout << "(empty)\n"; return; }
}
for (int t = 0 ; t < top ; t++) cout << s[t] << " ";
cout << "\n";
{
return top == 0;
}
{
if (top == maxrow) return;
}
if (rgb < maxcol - 1) { s[top][rgb++] = t; }
else { s[top++][rgb] = t; rgb = 0; }
{
if (top == 0 && rgb == 0) return -1;
}
if (rgb == 0) { rgb = maxcol - 1; return s[--top][rgb]; }
else { return s[top][--rgb]; }
{
if (top == 0 && rgb == 0) { cout << "(empty)\n"; return; }
}
for (int i = 0; i < top; i++) {
for (int j = 0; j < maxcol; j++) {
}
cout << s[i][j] << " ";
}
cout << "\n";
{
return (top == 0 && rgb == 0);
}
{
return maxrow;
}
{
printf("%d", top);
}
return;
{
printf("%d", rgb);
}
return;