Code Snippets

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.



From structs.h

#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:

private:

};

/* YOU MIGHT WANT TO REWORK THIS TO SAVE SPACE i.e. UNSIGNED CHAR VS. INT */
class twoDStack {
public:

private:

};

/********************FUNCTIONS IN MYTEST.CPP*****************/

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);

/*********************************************************************/



From mytest.cpp

#include
#include "include/ui/GLwindow.h"
#include "include/img/Image.h"
#include "structs.h"

static GLwindow *win_p;
static Image *my_image;
static GLwindow *next_win;
static Image *replica;
static GLwindow *hold;
static Image *tile;

static const int WINDOW_WIDTH = 512;
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;

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()
{

}

/*********************************************************************/

Return to "Title" page


the Project | the Algorithm | the Process and Program | the Results | the Flaws | the Unfinished | the Art

Code Snippets | Sources | email me