Initial commit
Game already kinda working. Also include french, errors, different naming than original, mess, code poorness and dirt
This commit is contained in:
commit
1c49459f95
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
/Debug/*
|
||||
/INIT/*
|
||||
/SDCard/*
|
||||
/imgres/*
|
||||
*.sublime-*
|
510
2048.c
Normal file
510
2048.c
Normal file
|
@ -0,0 +1,510 @@
|
|||
#include "stdlib.h"
|
||||
#include "fxlib.h"
|
||||
#include "MonochromeLib.h"
|
||||
|
||||
|
||||
// Sprites
|
||||
// Tiles 13*13
|
||||
char tile0[] = {127,240,213,88,170,168,213,88,170,168,213,88,170,168,213,88,170,168,213,88,170,168,213,88,127,240}; // Vide
|
||||
char tile1[] = {127,240,128,8,128,8,135,8,136,136,128,136,129,8,130,8,132,8,143,136,128,8,128,8,127,240}; // 2
|
||||
char tile2[] = {127,240,128,8,128,8,129,8,131,8,133,8,137,8,143,136,129,8,129,8,128,8,128,8,127,240}; // 4
|
||||
char tile3[] = {127,240,128,8,128,8,135,8,136,136,136,136,135,8,136,136,136,136,135,8,128,8,128,8,127,240}; // 8
|
||||
char tile4[] = {127,240,128,8,128,8,144,200,177,8,146,8,147,200,146,40,146,40,185,200,128,8,128,8,127,240}; // 16
|
||||
char tile5[] = {127,240,128,8,128,8,128,8,184,200,133,40,152,72,132,136,185,232,128,8,128,8,128,8,127,240}; // 32
|
||||
char tile6[] = {127,240,128,8,128,8,128,8,152,104,160,168,185,40,165,232,152,40,128,8,128,8,128,8,127,240}; // 64
|
||||
char tile7[] = {127,240,253,248,249,248,253,248,253,248,248,248,255,248,231,56,218,216,247,56,238,216,195,56,127,240}; // 128
|
||||
char tile8[] = {127,240,249,248,246,248,253,248,251,248,240,248,255,248,195,56,222,248,194,56,250,216,199,56,127,240}; // 256
|
||||
char tile9[] = {127,240,240,248,247,248,240,248,254,248,241,248,255,248,247,56,230,216,247,184,247,120,226,24,127,240}; // 512
|
||||
char tile10[] = {127,240,247,56,230,216,246,216,246,216,227,56,255,248,231,152,219,88,246,216,238,24,195,216,127,240}; // 1024
|
||||
char tile11[] = {127,240,231,56,218,216,246,216,238,216,195,56,255,248,243,56,234,216,219,56,194,216,251,56,127,240}; // 2048
|
||||
char tile12[] = {127,240,255,248,255,248,248,248,247,120,255,120,254,248,253,248,255,248,253,248,255,248,255,248,127,240}; // 4096
|
||||
char tile13[] = {127,240,255,248,255,248,253,248,253,248,253,248,253,248,253,248,255,248,253,248,255,248,255,248,127,240}; // WTF
|
||||
// Autre
|
||||
char scoreBG[] = {63,255,255,255,254,0,127,255,255,255,255,0,255,255,255,255,255,128,255,255,255,255,255,128,255,255,255,255,255,128,255,255,255,255,255,128,255,255,255,255,255,128,255,255,255,255,255,128,255,255,255,255,255,128,255,255,255,255,255,128,255,255,255,255,255,128,255,255,255,255,255,128,255,255,255,255,255,128,255,255,255,255,255,128,255,255,255,255,255,128,255,255,255,255,255,128,255,255,255,255,255,128,127,255,255,255,255,0,63,255,255,255,254,0}; // 41*19
|
||||
|
||||
// Déclare les booléens ><
|
||||
#define false 0
|
||||
#define true 1
|
||||
typedef char bool;
|
||||
|
||||
typedef struct Cell {
|
||||
int x;
|
||||
int y;
|
||||
} Cell;
|
||||
|
||||
typedef struct Tile {
|
||||
int x;
|
||||
int y;
|
||||
int value;
|
||||
bool hasMerged;
|
||||
Cell previousPosition;
|
||||
} Tile;
|
||||
|
||||
typedef struct Grid {
|
||||
Tile array[4][4];
|
||||
} Grid;
|
||||
|
||||
typedef struct Traversal {
|
||||
int x[4];
|
||||
int y[4];
|
||||
} Traversal;
|
||||
|
||||
typedef struct findFarthestPosition_return {
|
||||
Cell next;
|
||||
Cell farthest;
|
||||
} findFarthestPosition_return;
|
||||
|
||||
int Game_score = 0;
|
||||
bool Game_over = false;
|
||||
bool Game_won = false;
|
||||
bool Game_terminated = false;
|
||||
bool Game_keepPlaying = true;
|
||||
|
||||
int storage_bestScore = 6357;
|
||||
|
||||
Grid Grid_grid;
|
||||
|
||||
// Fonctions
|
||||
int rand_int(int min, int max) {
|
||||
return min + (rand() % (int)(max - min + 1));
|
||||
}
|
||||
|
||||
int drawFixedTiles() {
|
||||
// Variables
|
||||
int x, y;
|
||||
|
||||
// Éxecution
|
||||
for (x = 0; x <= 3; x++) {
|
||||
for (y = 0; y <= 3; y++) {
|
||||
drawTileCase(Grid_grid.array[x][y]);
|
||||
}
|
||||
}
|
||||
}
|
||||
int drawTile(int x, int y, int value) {
|
||||
ML_rectangle(x + 1, y + 1, x + 11, y + 11, 0, ML_TRANSPARENT, ML_WHITE);
|
||||
switch (value) {
|
||||
case 0:
|
||||
ML_bmp_or(tile0, x, y, 13, 13);
|
||||
break;
|
||||
case 1:
|
||||
ML_bmp_or(tile1, x, y, 13, 13);
|
||||
break;
|
||||
case 2:
|
||||
ML_bmp_or(tile2, x, y, 13, 13);
|
||||
break;
|
||||
case 3:
|
||||
ML_bmp_or(tile3, x, y, 13, 13);
|
||||
break;
|
||||
case 4:
|
||||
ML_bmp_or(tile4, x, y, 13, 13);
|
||||
break;
|
||||
case 5:
|
||||
ML_bmp_or(tile5, x, y, 13, 13);
|
||||
break;
|
||||
case 6:
|
||||
ML_bmp_or(tile6, x, y, 13, 13);
|
||||
break;
|
||||
case 7:
|
||||
ML_bmp_or(tile7, x, y, 13, 13);
|
||||
break;
|
||||
case 8:
|
||||
ML_bmp_or(tile8, x, y, 13, 13);
|
||||
break;
|
||||
case 9:
|
||||
ML_bmp_or(tile9, x, y, 13, 13);
|
||||
break;
|
||||
case 10:
|
||||
ML_bmp_or(tile10, x, y, 13, 13);
|
||||
break;
|
||||
case 11:
|
||||
ML_bmp_or(tile11, x, y, 13, 13);
|
||||
break;
|
||||
default:
|
||||
ML_bmp_or(tile12, x, y, 13, 13);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int drawTileCase(Tile tile) {
|
||||
drawTile(5+tile.x*14, 5+tile.y*14, tile.value);
|
||||
}
|
||||
|
||||
// Grid
|
||||
|
||||
bool Grid_withinBounds(Cell position) { // En abuser
|
||||
return (position.x >= 0 && position.x < 4 && position.y >= 0 && position.y < 4);
|
||||
}
|
||||
|
||||
Tile Grid_cellContent(Cell cell) {
|
||||
Tile back;
|
||||
if (Grid_withinBounds(cell)) {
|
||||
return Grid_grid.array[cell.x][cell.y];
|
||||
} else {
|
||||
back.value = -1;
|
||||
return back;
|
||||
}
|
||||
}
|
||||
|
||||
bool Grid_cellOccupied(Cell cell) {
|
||||
return (Grid_cellContent(cell).value > 0);
|
||||
}
|
||||
|
||||
bool Grid_cellAvailable(Cell cell) { // Pareil
|
||||
return !Grid_cellOccupied(cell);
|
||||
}
|
||||
|
||||
int Grid_insertTile(Tile tile) {
|
||||
Grid_grid.array[tile.x][tile.y] = tile;
|
||||
}
|
||||
|
||||
int Grid_removeTile(Tile tile) {
|
||||
Cell emptyCell;
|
||||
Tile emptyTile;
|
||||
|
||||
emptyCell.x = -1;
|
||||
emptyCell.y = -1;
|
||||
emptyTile.x = tile.x;
|
||||
emptyTile.y = tile.y;
|
||||
emptyTile.value = 0;
|
||||
emptyTile.hasMerged = false;
|
||||
emptyTile.previousPosition = emptyCell;
|
||||
|
||||
Grid_grid.array[tile.x][tile.y] = emptyTile;
|
||||
}
|
||||
|
||||
int Grid_avaiableCellsAmount() {
|
||||
int avaiableCellsNumber = 0, x, y;
|
||||
Cell testCell;
|
||||
for (x = 0; x <= 3; x++) {
|
||||
for (y = 0; y <= 3; y++) {
|
||||
testCell.x = x;
|
||||
testCell.y = y;
|
||||
if (Grid_cellAvailable(testCell)) {
|
||||
avaiableCellsNumber++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return avaiableCellsNumber;
|
||||
}
|
||||
|
||||
void storage_setBestScore(int bestScore) {
|
||||
storage_bestScore = bestScore;
|
||||
// Sauvegarder dans la mémoire
|
||||
}
|
||||
|
||||
// Screen (O HTML_Actuator)
|
||||
|
||||
void Screen_updateScore() {
|
||||
// Affiche le score à l'écran
|
||||
}
|
||||
|
||||
void Screen_updateBestScore() {
|
||||
// Affiche le meilleur score à l'écran
|
||||
}
|
||||
|
||||
void Screen_message(bool won) {
|
||||
if (won) { // PHD
|
||||
PrintXY(67, 54, "WON", 0);
|
||||
} else {
|
||||
PrintXY(67, 54, "LOSE", 0);
|
||||
}
|
||||
}
|
||||
|
||||
void Screen_actuate() {
|
||||
|
||||
drawFixedTiles(); // O self.addTile(cell);
|
||||
|
||||
Screen_updateScore(); // O self.updateScore(metadata.score);
|
||||
Screen_updateBestScore(); // O self.updateBestScore(metadata.bestScore);
|
||||
|
||||
if (Game_terminated) {
|
||||
if (Game_over) {
|
||||
Screen_message(false);
|
||||
} else if (Game_won) {
|
||||
Screen_message(true);
|
||||
}
|
||||
}
|
||||
|
||||
ML_display_vram();
|
||||
}
|
||||
|
||||
Cell convertNumber2Pos(int number) {
|
||||
Cell position;
|
||||
position.x = number/4;
|
||||
position.x = number%4;
|
||||
}
|
||||
|
||||
// Game (O Game_manager)
|
||||
|
||||
bool Game_isGameTerminated() {
|
||||
return (Game_over || (Game_won && !Game_keepPlaying));
|
||||
}
|
||||
|
||||
void Game_actuate() {
|
||||
if (storage_bestScore < Game_score) {
|
||||
storage_setBestScore(Game_score);
|
||||
}
|
||||
Screen_actuate();
|
||||
}
|
||||
|
||||
Traversal Game_buildTraversals(Cell vector) {
|
||||
Traversal traversal;
|
||||
int i;
|
||||
for (i = 0; i <= 3; i++) {
|
||||
traversal.x[i] = (vector.x == 1 ? 3-i : i );
|
||||
traversal.y[i] = (vector.y == 1 ? 3-i : i );
|
||||
}
|
||||
return traversal;
|
||||
}
|
||||
|
||||
Cell Game_getVector(int direction) {
|
||||
Cell vector;
|
||||
switch(direction) {
|
||||
case 0:
|
||||
vector.x = 0; vector.y = -1;
|
||||
break;
|
||||
case 1:
|
||||
vector.x = 1; vector.y = 0;
|
||||
break;
|
||||
case 2:
|
||||
vector.x = 0; vector.y = 1;
|
||||
break;
|
||||
case 3:
|
||||
vector.x = -1; vector.y = 0;
|
||||
break;
|
||||
}
|
||||
return vector;
|
||||
}
|
||||
|
||||
void Game_prepareTiles() {
|
||||
Cell previousPosition;
|
||||
int x, y;
|
||||
for (x = 0; x <= 3; x++) {
|
||||
for (y = 0; y <= 3; y++) {
|
||||
Grid_grid.array[x][y].hasMerged = false;
|
||||
previousPosition.x = Grid_grid.array[x][y].x;
|
||||
previousPosition.y = Grid_grid.array[x][y].y;
|
||||
Grid_grid.array[x][y].previousPosition = previousPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
findFarthestPosition_return Game_findFarthestPosition(Cell cell, Cell vector) {
|
||||
Cell previous;
|
||||
findFarthestPosition_return back;
|
||||
|
||||
// Progress towards the vector direction until an obstacle is found
|
||||
do {
|
||||
previous = cell;
|
||||
cell.x = previous.x + vector.x;
|
||||
cell.y = previous.y + vector.y;
|
||||
} while (Grid_withinBounds(cell) && Grid_cellAvailable(cell));
|
||||
|
||||
back.farthest = previous;
|
||||
back.next = cell; // Used to check if a merge is required
|
||||
|
||||
return back;
|
||||
}
|
||||
|
||||
Game_moveTile(Tile tile, Cell cell) {
|
||||
Grid_removeTile(tile);
|
||||
tile.x = cell.x;
|
||||
tile.y = cell.y;
|
||||
Grid_insertTile(tile);
|
||||
}
|
||||
|
||||
bool Game_positionsEqual(Cell first, Tile second) {
|
||||
return (first.x == second.x && first.y == second.y);
|
||||
}
|
||||
|
||||
Cell Grid_randomAvaiableCell() {
|
||||
int avaiableCellsNumber, choosenCellNumber, x, y;
|
||||
Cell position;
|
||||
|
||||
avaiableCellsNumber = Grid_avaiableCellsAmount();
|
||||
choosenCellNumber = rand_int(1, avaiableCellsNumber);
|
||||
avaiableCellsNumber = 0; // Sert de compteur ici
|
||||
for (x = 0; x <= 3; x++) {
|
||||
for (y = 0; y <= 3; y++) {
|
||||
position.x = x;
|
||||
position.y = y;
|
||||
if (Grid_cellAvailable(position)) {
|
||||
avaiableCellsNumber++;
|
||||
if (avaiableCellsNumber == choosenCellNumber) {
|
||||
return position;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Game_addRandomTile() {
|
||||
Tile tile; Cell position;
|
||||
|
||||
if (Grid_avaiableCellsAmount() > 0) {
|
||||
position = Grid_randomAvaiableCell();
|
||||
tile.value = (rand_int(0, 10) < 9 ? 1 : 2);
|
||||
tile.x = position.x;
|
||||
tile.y = position.y;
|
||||
tile.previousPosition = position;
|
||||
tile.hasMerged = false;
|
||||
Grid_insertTile(tile);
|
||||
}
|
||||
}
|
||||
|
||||
void Game_move(int direction) { // 0: up, 1: right, 2: down, 3: left
|
||||
Cell vector, cell, farthest, next;
|
||||
Tile tile, merged;
|
||||
Traversal traversals;
|
||||
findFarthestPosition_return position;
|
||||
bool moved = false;
|
||||
int xI, yI;
|
||||
|
||||
if (Game_isGameTerminated()) { return; }
|
||||
|
||||
vector = Game_getVector(direction);
|
||||
traversals = Game_buildTraversals(vector);
|
||||
Game_prepareTiles();
|
||||
for (xI = 0; xI <= 3; xI++) {
|
||||
for (yI = 0; yI <= 3; yI++) {
|
||||
cell.x = traversals.x[xI]; cell.y = traversals.y[yI];
|
||||
tile = Grid_cellContent(cell);
|
||||
if (tile.value > 0) {
|
||||
position = Game_findFarthestPosition(cell, vector);
|
||||
next = position.next;
|
||||
farthest = position.farthest;
|
||||
if (Grid_cellContent(next).value == tile.value && !tile.hasMerged) { // Merge
|
||||
merged.x = next.x;
|
||||
merged.y = next.y;
|
||||
merged.value = tile.value + 1;
|
||||
merged.hasMerged = true;
|
||||
merged.previousPosition = cell;
|
||||
|
||||
Grid_insertTile(merged);
|
||||
Grid_removeTile(tile);
|
||||
|
||||
tile.x = next.x;
|
||||
tile.y = next.y;
|
||||
|
||||
Game_score += merged.value;
|
||||
|
||||
if (merged.value == 11) {
|
||||
Game_won = true;
|
||||
}
|
||||
moved = true;
|
||||
} else {
|
||||
Game_moveTile(tile, farthest);
|
||||
moved = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (moved) {
|
||||
Game_addRandomTile();
|
||||
|
||||
// if (!Game_moveAvaiable()) {
|
||||
// this.over = true;
|
||||
// }
|
||||
|
||||
Game_actuate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int initGame() {
|
||||
// Variables
|
||||
int x, y;
|
||||
|
||||
ML_clear_screen();
|
||||
|
||||
// Draw Titre
|
||||
PrintXY(67, 54, "2048", 0);
|
||||
|
||||
// Reset variables
|
||||
Game_score = 0;
|
||||
Game_over = false;
|
||||
Game_won = false;
|
||||
Game_terminated = false;
|
||||
Game_keepPlaying = true;
|
||||
|
||||
for (x = 0; x <= 3; x++) {
|
||||
for (y = 0; y <= 3; y++) {
|
||||
Grid_grid.array[x][y].x = x;
|
||||
Grid_grid.array[x][y].y = y;
|
||||
Grid_grid.array[x][y].value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
drawFixedTiles();
|
||||
|
||||
// Draw Score
|
||||
ML_bmp_or(scoreBG, 68, 4, 41, 19);
|
||||
ML_bmp_or(scoreBG, 68, 25, 41, 19);
|
||||
PrintXY(70, 6, "SCORE", 1);
|
||||
PrintXY(100, 14, "0", 1);
|
||||
PrintXY(70, 27, "BEST", 1);
|
||||
PrintXY(100, 35, "0", 1);
|
||||
|
||||
Game_addRandomTile();
|
||||
Game_addRandomTile();
|
||||
|
||||
Game_actuate();
|
||||
|
||||
}
|
||||
|
||||
int AddIn_main(int isAppli, unsigned short OptionNum) {
|
||||
// Variables
|
||||
unsigned int key;
|
||||
|
||||
while (1) { // Tant qu'on joue...
|
||||
initGame();
|
||||
while (1) { // Boucle des mouvements
|
||||
GetKey(&key);
|
||||
switch (key) {
|
||||
case KEY_CTRL_UP:
|
||||
Game_move(0);
|
||||
break;
|
||||
case KEY_CTRL_RIGHT:
|
||||
Game_move(1);
|
||||
break;
|
||||
case KEY_CTRL_DOWN:
|
||||
Game_move(2);
|
||||
break;
|
||||
case KEY_CTRL_LEFT:
|
||||
Game_move(3);
|
||||
break;
|
||||
case KEY_CTRL_DEL:
|
||||
initGame();
|
||||
break;
|
||||
case KEY_CHAR_PLUS:
|
||||
Game_addRandomTile();
|
||||
Game_actuate();
|
||||
break;
|
||||
case KEY_CHAR_STORE:
|
||||
Game_actuate();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Code propre au SDK. NE PAS MODIFIER !
|
||||
|
||||
#pragma section _BR_Size
|
||||
unsigned long BR_Size;
|
||||
#pragma section
|
||||
|
||||
|
||||
#pragma section _TOP
|
||||
|
||||
int InitializeSystem(int isAppli, unsigned short OptionNum) {
|
||||
return INIT_ADDIN_APPLICATION(isAppli, OptionNum);
|
||||
}
|
||||
|
||||
#pragma section
|
||||
|
355
2048.dlr
Normal file
355
2048.dlr
Normal file
|
@ -0,0 +1,355 @@
|
|||
[DLSimRunSpace]
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=184
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=149
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=130
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=198
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=204
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=210
|
||||
Flags=00001012
|
||||
Sublevel=1
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=150
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=117
|
||||
Flags=00001012
|
||||
Sublevel=1
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=124
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=151
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=147
|
||||
Flags=00001012
|
||||
Sublevel=1
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=157
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=158
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=54
|
||||
Flags=00001012
|
||||
Sublevel=1
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=54
|
||||
Flags=00001012
|
||||
Sublevel=2
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=49
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=47
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=46
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=45
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=55
|
||||
Flags=00001012
|
||||
Sublevel=1
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=55
|
||||
Flags=00001012
|
||||
Sublevel=2
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=147
|
||||
Flags=00001012
|
||||
Sublevel=2
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=147
|
||||
Flags=00001012
|
||||
Sublevel=3
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=220
|
||||
Flags=00001012
|
||||
Sublevel=1
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=210
|
||||
Flags=00001012
|
||||
Sublevel=2
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=220
|
||||
Flags=00001012
|
||||
Sublevel=2
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=117
|
||||
Flags=00001012
|
||||
Sublevel=2
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=208
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=78
|
||||
Flags=00001012
|
||||
Sublevel=1
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=78
|
||||
Flags=00001012
|
||||
Sublevel=2
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=411
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=170
|
||||
Flags=00001012
|
||||
Sublevel=1
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=170
|
||||
Flags=00001012
|
||||
Sublevel=2
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=176
|
||||
Flags=00001012
|
||||
Sublevel=1
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=180
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=316
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=324
|
||||
Flags=00001012
|
||||
Sublevel=1
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=324
|
||||
Flags=00001012
|
||||
Sublevel=2
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=326
|
||||
Flags=00001012
|
||||
Sublevel=1
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=327
|
||||
Flags=00001012
|
||||
Sublevel=1
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=329
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=330
|
||||
Flags=00001012
|
||||
Sublevel=1
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=326
|
||||
Flags=00001012
|
||||
Sublevel=2
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=327
|
||||
Flags=00001012
|
||||
Sublevel=2
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=327
|
||||
Flags=00001012
|
||||
Sublevel=3
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=333
|
||||
Flags=00001012
|
||||
Sublevel=1
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=335
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=176
|
||||
Flags=00001012
|
||||
Sublevel=2
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=176
|
||||
Flags=00001012
|
||||
Sublevel=3
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=330
|
||||
Flags=00001012
|
||||
Sublevel=2
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=333
|
||||
Flags=00001012
|
||||
Sublevel=2
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=333
|
||||
Flags=00001012
|
||||
Sublevel=3
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=339
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=340
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=341
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=347
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=348
|
||||
Flags=00001012
|
||||
Sublevel=1
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=348
|
||||
Flags=00001012
|
||||
Sublevel=2
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=355
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=473
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=509
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=470
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=337
|
||||
Flags=00001012
|
||||
|
||||
[Breakpoint]
|
||||
File=Z:\home\geoffrey\Documents\Programmation\CASIO\2048\2048.c
|
||||
Line=476
|
||||
Flags=00001012
|
126
2048.dlw
Normal file
126
2048.dlw
Normal file
|
@ -0,0 +1,126 @@
|
|||
[DLSimWorkSpace]
|
||||
|
||||
[_1]
|
||||
Type=5
|
||||
Order=2
|
||||
Top=60
|
||||
Left=1965
|
||||
Height=10080
|
||||
Width=10470
|
||||
State=0
|
||||
Flags=00000020
|
||||
Setting=298:9:2048.c
|
||||
OptionA=0
|
||||
|
||||
[_2]
|
||||
Type=1
|
||||
Order=0
|
||||
Top=0
|
||||
Left=12645
|
||||
Height=4665
|
||||
Width=5535
|
||||
State=0
|
||||
Flags=00000001
|
||||
OptionA=15
|
||||
OptionB=15
|
||||
|
||||
[_3]
|
||||
Type=6
|
||||
Order=3
|
||||
Top=4680
|
||||
Left=12720
|
||||
Height=6840
|
||||
Width=5490
|
||||
State=0
|
||||
Flags=00000001
|
||||
OptionA=0
|
||||
|
||||
[_4]
|
||||
Type=7
|
||||
Order=6
|
||||
Top=10095
|
||||
Left=2040
|
||||
Height=3120
|
||||
Width=5145
|
||||
State=0
|
||||
Flags=00000000
|
||||
OptionA=0
|
||||
|
||||
[_5]
|
||||
Type=8
|
||||
Order=7
|
||||
Top=10155
|
||||
Left=7230
|
||||
Height=3150
|
||||
Width=5475
|
||||
State=0
|
||||
Flags=00000000
|
||||
OptionA=0
|
||||
|
||||
[_6]
|
||||
Type=3
|
||||
Order=10
|
||||
Top=0
|
||||
Left=10788
|
||||
Height=6348
|
||||
Width=2232
|
||||
State=16
|
||||
Flags=00000000
|
||||
OptionA=0
|
||||
|
||||
[_7]
|
||||
Type=2
|
||||
Order=9
|
||||
Top=6495
|
||||
Left=7800
|
||||
Height=3435
|
||||
Width=5130
|
||||
State=16
|
||||
Flags=00000000
|
||||
OptionA=0
|
||||
|
||||
[_8]
|
||||
Type=17
|
||||
Order=5
|
||||
Top=30
|
||||
Left=30
|
||||
Height=13200
|
||||
Width=1965
|
||||
State=0
|
||||
Flags=00000000
|
||||
OptionA=0
|
||||
|
||||
[_9]
|
||||
Type=15
|
||||
Order=1
|
||||
Top=0
|
||||
Left=2010
|
||||
Height=11580
|
||||
Width=10740
|
||||
State=0
|
||||
Flags=00000000
|
||||
OptionA=0
|
||||
|
||||
[_32]
|
||||
Type=16
|
||||
Order=8
|
||||
Top=15
|
||||
Left=1995
|
||||
Height=10095
|
||||
Width=10710
|
||||
State=0
|
||||
Flags=00000020
|
||||
Setting=209:1:2048.c
|
||||
OptionA=0
|
||||
|
||||
[_33]
|
||||
Type=16
|
||||
Order=4
|
||||
Top=990
|
||||
Left=990
|
||||
Height=9060
|
||||
Width=13635
|
||||
State=0
|
||||
Flags=00000020
|
||||
Setting=1:1:MonochromeLib.c
|
||||
OptionA=0
|
17
2048.g1w
Normal file
17
2048.g1w
Normal file
|
@ -0,0 +1,17 @@
|
|||
[DLSimProject]
|
||||
Name=2048
|
||||
Version=1
|
||||
Model=:fx-9860G.dlm
|
||||
SourcePath=SRC
|
||||
MemoryPath=INIT
|
||||
MemCardPath=SDCard
|
||||
|
||||
[Program1]
|
||||
Program=2048.G1A
|
||||
Debug=Debug\FXADDINror.dbg
|
||||
LoadAddress=80000000:90100000
|
||||
|
||||
[Files]
|
||||
SourceFile=:2048.c
|
||||
SourceFile=:MonochromeLib.c
|
||||
HeaderFile=:MonochromeLib.h
|
12
AddinInfo.txt
Normal file
12
AddinInfo.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
//------------------------------------------------------------------
|
||||
// Addin-Application header control file, created with the CASIO SDK
|
||||
//------------------------------------------------------------------
|
||||
[OUTPUT] : "2048.G1A"
|
||||
[BINDATA] : "FXADDINror.bin"
|
||||
[DISPNAME] : "2048"
|
||||
[APPNAME] : "@2048"
|
||||
[VERSION] : "01.00.0000"
|
||||
[APL_ICON] : "MainIcon.bmp"
|
||||
[MODULE_NUM] : 0
|
||||
[MOD1_TITLE] : "2048"
|
||||
[MOD1_ICON] : "eActivityIcon.bmp"
|
22
FXSH_Build.bat
Normal file
22
FXSH_Build.bat
Normal file
|
@ -0,0 +1,22 @@
|
|||
@echo off
|
||||
rem Do not edit! This batch file is created by CASIO fx-9860G SDK.
|
||||
|
||||
|
||||
if exist 2048.G1A del 2048.G1A
|
||||
|
||||
cd debug
|
||||
if exist FXADDINror.bin del FXADDINror.bin
|
||||
"C:\CASIO SDK\OS\SH\Bin\Hmake.exe" Addin.mak
|
||||
cd ..
|
||||
if not exist debug\FXADDINror.bin goto error
|
||||
|
||||
"C:\CASIO SDK\Tools\MakeAddinHeader363.exe" "Z:\home\geoffrey\Documents\Programmation\CASIO\2048"
|
||||
if not exist 2048.G1A goto error
|
||||
echo Build has completed.
|
||||
goto end
|
||||
|
||||
:error
|
||||
echo Build was not successful.
|
||||
|
||||
:end
|
||||
|
BIN
MainIcon.bmp
Normal file
BIN
MainIcon.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 138 B |
1289
MonochromeLib.c
Normal file
1289
MonochromeLib.c
Normal file
File diff suppressed because it is too large
Load diff
151
MonochromeLib.h
Normal file
151
MonochromeLib.h
Normal file
|
@ -0,0 +1,151 @@
|
|||
/*************************************************************/
|
||||
/** MonochromeLib - monochrome graphic library for fx-9860G **/
|
||||
/** MonochromeLib is free software **/
|
||||
/** **/
|
||||
/** @author Pierre "PierrotLL" Le Gall **/
|
||||
/** @contact legallpierre89@gmail.com **/
|
||||
/** **/
|
||||
/** @file MonochromeLib.h **/
|
||||
/** Include header for MonochromeLib **/
|
||||
/** **/
|
||||
/** @date 11-22-2011 **/
|
||||
/*************************************************************/
|
||||
|
||||
#ifndef MONOCHROMELIB
|
||||
#define MONOCHROMELIB
|
||||
|
||||
/****************************************************/
|
||||
/** uncomment #define of functions you want to use **/
|
||||
/****************************************************/
|
||||
|
||||
#define ML_ALL //Auto define all functions
|
||||
|
||||
// #define ML_CLEAR_VRAM
|
||||
// #define ML_CLEAR_SCREEN
|
||||
// #define ML_DISPLAY_VRAM
|
||||
|
||||
// #define ML_SET_CONTRAST
|
||||
// #define ML_GET_CONTRAST
|
||||
|
||||
// #define ML_PIXEL
|
||||
// #define ML_POINT
|
||||
// #define ML_PIXEL_TEST
|
||||
|
||||
// #define ML_LINE
|
||||
// #define ML_HORIZONTAL_LINE
|
||||
// #define ML_VERTICAL_LINE
|
||||
|
||||
// #define ML_RECTANGLE
|
||||
|
||||
// #define ML_POLYGON
|
||||
// #define ML_FILLED_POLYGON
|
||||
|
||||
// #define ML_CIRCLE
|
||||
// #define ML_FILLED_CIRCLE
|
||||
|
||||
// #define ML_ELLIPSE
|
||||
// #define ML_ELLIPSE_IN_RECT
|
||||
// #define ML_FILLED_ELLIPSE
|
||||
// #define ML_FILLED_ELLIPSE_IN_RECT
|
||||
|
||||
// #define ML_HORIZONTAL_SCROLL
|
||||
// #define ML_VERTICAL_SCROLL
|
||||
|
||||
// #define ML_BMP_OR
|
||||
// #define ML_BMP_AND
|
||||
// #define ML_BMP_XOR
|
||||
// #define ML_BMP_OR_CL
|
||||
// #define ML_BMP_AND_CL
|
||||
// #define ML_BMP_XOR_CL
|
||||
|
||||
// #define ML_BMP_8_OR
|
||||
// #define ML_BMP_8_AND
|
||||
// #define ML_BMP_8_XOR
|
||||
// #define ML_BMP_8_OR_CL
|
||||
// #define ML_BMP_8_AND_CL
|
||||
// #define ML_BMP_8_XOR_CL
|
||||
|
||||
// #define ML_BMP_16_OR
|
||||
// #define ML_BMP_16_AND
|
||||
// #define ML_BMP_16_XOR
|
||||
// #define ML_BMP_16_OR_CL
|
||||
// #define ML_BMP_16_AND_CL
|
||||
// #define ML_BMP_16_XOR_CL
|
||||
|
||||
|
||||
/**************************/
|
||||
/** Functions prototypes **/
|
||||
/**************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ML_SCREEN_WIDTH 128
|
||||
#define ML_SCREEN_HEIGHT 64
|
||||
|
||||
#define ML_CONTRAST_MIN 130
|
||||
#define ML_CONTRAST_NORMAL 168
|
||||
#define ML_CONTRAST_MAX 190
|
||||
typedef enum {ML_TRANSPARENT=-1, ML_WHITE, ML_BLACK, ML_XOR, ML_CHECKER} ML_Color;
|
||||
|
||||
char* ML_vram_adress();
|
||||
|
||||
void ML_clear_vram();
|
||||
void ML_clear_screen();
|
||||
void ML_display_vram();
|
||||
|
||||
void ML_set_contrast(unsigned char contrast);
|
||||
unsigned char ML_get_contrast();
|
||||
|
||||
void ML_pixel(int x, int y, ML_Color color);
|
||||
void ML_point(int x, int y, int width, ML_Color color);
|
||||
ML_Color ML_pixel_test(int x, int y);
|
||||
|
||||
void ML_line(int x1, int y1, int x2, int y2, ML_Color color);
|
||||
void ML_horizontal_line(int y, int x1, int x2, ML_Color color);
|
||||
void ML_vertical_line(int x, int y1, int y2, ML_Color color);
|
||||
|
||||
void ML_rectangle(int x1, int y1, int x2, int y2, int border_width, ML_Color border_color, ML_Color fill_color);
|
||||
|
||||
void ML_polygon(const int *x, const int *y, int nb_vertices, ML_Color color);
|
||||
void ML_filled_polygon(const int *x, const int *y, int nb_vertices, ML_Color color);
|
||||
|
||||
void ML_circle(int x, int y, int radius, ML_Color color);
|
||||
void ML_filled_circle(int x, int y, int radius, ML_Color color);
|
||||
|
||||
void ML_ellipse(int x, int y, int radius1, int radius2, ML_Color color);
|
||||
void ML_ellipse_in_rect(int x1, int y1, int x2, int y2, ML_Color color);
|
||||
void ML_filled_ellipse(int x, int y, int radius1, int radius2, ML_Color color);
|
||||
void ML_filled_ellipse_in_rect(int x, int y, int radius1, int radius2, ML_Color color);
|
||||
|
||||
void ML_horizontal_scroll(int scroll);
|
||||
void ML_vertical_scroll(int scroll);
|
||||
|
||||
void ML_bmp_or(const unsigned char *bmp, int x, int y, int width, int height);
|
||||
void ML_bmp_and(const unsigned char *bmp, int x, int y, int width, int height);
|
||||
void ML_bmp_xor(const unsigned char *bmp, int x, int y, int width, int height);
|
||||
void ML_bmp_or_cl(const unsigned char *bmp, int x, int y, int width, int height);
|
||||
void ML_bmp_and_cl(const unsigned char *bmp, int x, int y, int width, int height);
|
||||
void ML_bmp_xor_cl(const unsigned char *bmp, int x, int y, int width, int height);
|
||||
|
||||
void ML_bmp_8_or(const unsigned char *bmp, int x, int y);
|
||||
void ML_bmp_8_and(const unsigned char *bmp, int x, int y);
|
||||
void ML_bmp_8_xor(const unsigned char *bmp, int x, int y);
|
||||
void ML_bmp_8_or_cl(const unsigned char *bmp, int x, int y);
|
||||
void ML_bmp_8_and_cl(const unsigned char *bmp, int x, int y);
|
||||
void ML_bmp_8_xor_cl(const unsigned char *bmp, int x, int y);
|
||||
|
||||
void ML_bmp_16_or(const unsigned short *bmp, int x, int y);
|
||||
void ML_bmp_16_and(const unsigned short *bmp, int x, int y);
|
||||
void ML_bmp_16_xor(const unsigned short *bmp, int x, int y);
|
||||
void ML_bmp_16_or_cl(const unsigned short *bmp, int x, int y);
|
||||
void ML_bmp_16_and_cl(const unsigned short *bmp, int x, int y);
|
||||
void ML_bmp_16_xor_cl(const unsigned short *bmp, int x, int y);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif //MONOCHROMELIB
|
BIN
eActivityIcon.bmp
Normal file
BIN
eActivityIcon.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 106 B |
Reference in a new issue