From 1c49459f95d76aa5085af3e0ccf4091276c45527 Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Sat, 5 Apr 2014 16:40:56 +0200 Subject: [PATCH] Initial commit Game already kinda working. Also include french, errors, different naming than original, mess, code poorness and dirt --- .gitignore | 5 + 2048.G1A | Bin 0 -> 18952 bytes 2048.c | 510 ++++++++++++++++++ 2048.dlr | 355 +++++++++++++ 2048.dlw | 126 +++++ 2048.g1w | 17 + AddinInfo.txt | 12 + FXSH_Build.bat | 22 + MainIcon.bmp | Bin 0 -> 138 bytes MonochromeLib.c | 1289 +++++++++++++++++++++++++++++++++++++++++++++ MonochromeLib.h | 151 ++++++ eActivityIcon.bmp | Bin 0 -> 106 bytes 12 files changed, 2487 insertions(+) create mode 100644 .gitignore create mode 100644 2048.G1A create mode 100644 2048.c create mode 100644 2048.dlr create mode 100644 2048.dlw create mode 100644 2048.g1w create mode 100644 AddinInfo.txt create mode 100644 FXSH_Build.bat create mode 100644 MainIcon.bmp create mode 100644 MonochromeLib.c create mode 100644 MonochromeLib.h create mode 100644 eActivityIcon.bmp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eccebd8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/Debug/* +/INIT/* +/SDCard/* +/imgres/* +*.sublime-* diff --git a/2048.G1A b/2048.G1A new file mode 100644 index 0000000000000000000000000000000000000000..1907562aa47743a570fbf083d720438391ea3723 GIT binary patch literal 18952 zcmeHv34Bx6neVx}vVCQ-$OaR$BwD>;2g#Cb%L_)N{`kw3hLHCl-AK-KHt5E2F+}?x=e}cmQ z%zB;CG}EUB-s=OoJYwWhQlJOo^kADEU#LXqUQEyz5pW z<-B1lGp=Isw@#nb?dZa+DqDZ zZy@c-2~zt?J*WM?_Q^8U<&_OwGgsHk_HISld0Q#?Am$ji+!wEZNk6fPqNVoWPx_F= z8UGz3_q=EFX#8VD&UyD}Sz_%}-BkTl!&Ku`(-e|6Pa)lw38dS+kCFjqbX!c?F+a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H75|L;=z2HOh3YhECSNFP$Fum?pFcrU*b^sUVeW}zBMgoX?bc)o^^eUv^*sy$C?}?DNl+qSrcQT$`fKTt(usKa&?T+s)`}Y zl`(o&6+#Ei7hg;M zZckY$Dk-yW#@aFa_g}1ZStZWU0a-R%cj7YP-C6!`M!?^VAfJKtsn~h*!v}u++Skc> z(|NOl>Y$#Yy1F{L9;cq5Iw?;V&Y3NFoH|B*mvTYw7Y)%_ub^<#hqQJ$8r9AYaP__TJLM8lmGkp@#OiEKTdx>{YUsr zPlu+jng03mZPTZh2TXWupHELg{+H7?p=7}H(eyi}FD{?wOKwizhTN~FC!yrFY3%at zQ@0O}#N#^nY6?Dn6SQ{xw+~ER{xp8zGA_Yw!xgk0nhu(-U;eG>oy%YHt%abK>FL`C zLkGWt{z5#3rg0ryg2yI&=1Vp~yz&)t!gmN(Lh!HSKjPbo8%3Mo>nl9z!ap#b@gEKm RmQ-5+A&hI7|F+q}{|&brb5sBT literal 0 HcmV?d00001 diff --git a/2048.c b/2048.c new file mode 100644 index 0000000..238daa8 --- /dev/null +++ b/2048.c @@ -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 + diff --git a/2048.dlr b/2048.dlr new file mode 100644 index 0000000..1b4f87e --- /dev/null +++ b/2048.dlr @@ -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 diff --git a/2048.dlw b/2048.dlw new file mode 100644 index 0000000..a7fe65f --- /dev/null +++ b/2048.dlw @@ -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 diff --git a/2048.g1w b/2048.g1w new file mode 100644 index 0000000..3fbe358 --- /dev/null +++ b/2048.g1w @@ -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 diff --git a/AddinInfo.txt b/AddinInfo.txt new file mode 100644 index 0000000..ade570b --- /dev/null +++ b/AddinInfo.txt @@ -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" diff --git a/FXSH_Build.bat b/FXSH_Build.bat new file mode 100644 index 0000000..4d2590a --- /dev/null +++ b/FXSH_Build.bat @@ -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 + diff --git a/MainIcon.bmp b/MainIcon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..85104d77ee8ca01a7c66ee298049f01b223b7dea GIT binary patch literal 138 zcmZ?r?P7ocJ0PV2#Bx9^48)8;2m(Gpe3%b{!2(d?|Ns9C4M6t)|Nj{Nu>WKD8;(S? y)dBhcfBa#q{{d77#t)9)srWwo_Kx4HxOepCs~ literal 0 HcmV?d00001 diff --git a/MonochromeLib.c b/MonochromeLib.c new file mode 100644 index 0000000..9b753c8 --- /dev/null +++ b/MonochromeLib.c @@ -0,0 +1,1289 @@ +/*************************************************************/ +/** MonochromeLib - monochrome graphic library for fx-9860G **/ +/** MonochromeLib is free software **/ +/** **/ +/** @author Pierre "PierrotLL" Le Gall **/ +/** @contact legallpierre89@gmail.com **/ +/** **/ +/** @file MonochromeLib.c **/ +/** Code file of MonochromeLib **/ +/** **/ +/** @date 11-22-2011 **/ +/*************************************************************/ + +#include "MonochromeLib.h" +#include + + +/******************************/ +/** Dependencies management **/ +/******************************/ + +#ifdef ML_ALL + #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 +#endif + +#ifdef ML_POLYGON + #define ML_LINE +#endif + +#ifdef ML_LINE + #define ML_PIXEL +#endif + +#ifdef ML_POINT + #define ML_PIXEL + #define ML_RECTANGLE +#endif + +#ifdef ML_RECTANGLE + #define ML_HORIZONTAL_LINE +#endif + +#ifdef ML_FILLED_POLYGON + #define ML_HORIZONTAL_LINE +#endif + +#ifdef ML_CIRCLE + #define ML_PIXEL +#endif + +#ifdef ML_FILLED_CIRCLE + #define ML_HORIZONTAL_LINE +#endif + +#ifdef ML_ELLIPSE_IN_RECT + #define ML_ELLIPSE +#endif + +#ifdef ML_ELLIPSE + #define ML_PIXEL +#endif + +#ifdef ML_FILLED_ELLIPSE_IN_RECT + #define ML_FILLED_ELLIPSE +#endif + +#ifdef ML_FILLED_ELLIPSE + #define ML_HORIZONTAL_LINE +#endif + + +/***************/ +/** Functions **/ +/***************/ + +#define sgn(x) (x<0?-1:1) +#define rnd(x) ((int)(x+0.5)) + +//Thanks to Simon Lothar for this function +static int SysCallCode[] = {0xD201422B,0x60F20000,0x80010070}; +static int (*SysCall)( int R4, int R5, int R6, int R7, int FNo ) = (void*)&SysCallCode; +char* ML_vram_adress() +{ + return (char*)((*SysCall)(0, 0, 0, 0, 309)); +} + +#ifdef ML_CLEAR_VRAM +void ML_clear_vram() +{ + int i, end, *pointer_long, vram; + char *pointer_byte; + vram = (int)ML_vram_adress(); + end = 4-vram&3; + pointer_byte = (char*)vram; + for(i=0 ; i>3)] |= 128>>(x&7); + break; + case ML_WHITE: + vram[(y<<4)+(x>>3)] &= ~(128>>(x&7)); + break; + case ML_XOR: + vram[(y<<4)+(x>>3)] ^= 128>>(x&7); + break; + case ML_CHECKER: + if(y&1^x&1) vram[(y<<4)+(x>>3)] &= ~(128>>(x&7)); + else vram[(y<<4)+(x>>3)] |= 128>>(x&7); + break; + } +} +#endif + +#ifdef ML_POINT +void ML_point(int x, int y, int width, ML_Color color) +{ + if(width < 1) return; + if(width == 1) ML_pixel(x, y, color); + else + { + int padding, pair; + padding = width>>1; + pair = !(width&1); + ML_rectangle(x-padding+pair, y-padding+pair, x+padding, y+padding, 0, 0, color); + } +} +#endif + +#ifdef ML_PIXEL_TEST +ML_Color ML_pixel_test(int x, int y) +{ + char *vram, byte; + if(x&~127 || y&~63) return ML_TRANSPARENT; + vram = ML_vram_adress(); + byte = 1<<(7-(x&7)); + return (vram[(y<<4)+(x>>3)] & byte ? ML_BLACK : ML_WHITE); + +} +#endif + +#ifdef ML_LINE +void ML_line(int x1, int y1, int x2, int y2, ML_Color color) +{ + int i, x, y, dx, dy, sx, sy, cumul; + x = x1; + y = y1; + dx = x2 - x1; + dy = y2 - y1; + sx = sgn(dx); + sy = sgn(dy); + dx = abs(dx); + dy = abs(dy); + ML_pixel(x, y, color); + if(dx > dy) + { + cumul = dx / 2; + for(i=1 ; i dx) + { + cumul -= dx; + y += sy; + } + ML_pixel(x, y, color); + } + } + else + { + cumul = dy / 2; + for(i=1 ; i dy) + { + cumul -= dy; + x += sx; + } + ML_pixel(x, y, color); + } + } +} +#endif + +#ifdef ML_HORIZONTAL_LINE +void ML_horizontal_line(int y, int x1, int x2, ML_Color color) +{ + int i; + char checker; + char* vram = ML_vram_adress(); + if(y&~63 || (x1<0 && x2<0) || (x1>127 && x2>127)) return; + if(x1 > x2) + { + i = x1; + x1 = x2; + x2 = i; + } + if(x1 < 0) x1 = 0; + if(x2 > 127) x2 = 127; + switch(color) + { + case ML_BLACK: + if(x1>>3 != x2>>3) + { + vram[(y<<4)+(x1>>3)] |= 255 >> (x1&7); + vram[(y<<4)+(x2>>3)] |= 255 << 7-(x2&7); + for(i=(x1>>3)+1 ; i>3 ; i++) + vram[(y<<4) + i] = 255; + } + else vram[(y<<4)+(x1>>3)] |= (255>>(x1%8 + 7-x2%8))<<(7-(x2&7)); + break; + case ML_WHITE: + if(x1>>3 != x2>>3) + { + vram[(y<<4)+(x1>>3)] &= 255 << 8-(x1&7); + vram[(y<<4)+(x2>>3)] &= 255 >> 1+(x2&7); + for(i=(x1>>3)+1 ; i>3 ; i++) + vram[(y<<4) + i] = 0; + } + else vram[(y<<4)+(x1>>3)] &= (255<<8-(x1&7)) | (255>>1+(x2&7)); + break; + case ML_XOR: + if(x1>>3 != x2>>3) + { + vram[(y<<4)+(x1>>3)] ^= 255 >> (x1&7); + vram[(y<<4)+(x2>>3)] ^= 255 << 7-(x2&7); + for(i=(x1>>3)+1 ; i<(x2>>3) ; i++) + vram[(y<<4) + i] ^= 255; + } + else vram[(y<<4)+(x1>>3)] ^= (255>>((x1&7) + 7-(x2&7)))<<(7-(x2&7)); + break; + case ML_CHECKER: + checker = (y&1 ? 85 : 170); + if(x1>>3 != x2>>3) + { + vram[(y<<4)+(x1>>3)] &= 255 << 8-(x1&7); + vram[(y<<4)+(x2>>3)] &= 255 >> 1+(x2&7); + vram[(y<<4)+(x1>>3)] |= checker & 255>>(x1&7); + vram[(y<<4)+(x2>>3)] |= checker & 255<<7-(x2&7); + for(i=(x1>>3)+1 ; i>3 ; i++) + vram[(y<<4) + i] = checker; + } + else + { + vram[(y<<4)+(x1>>3)] &= (255<<8-(x1&7)) | (255>>1+(x2&7)); + vram[(y<<4)+(x1>>3)] |= checker & (255>>(x1%8 + 7-x2%8))<<(7-(x2&7)); + } + break; + } +} + +#endif + +#ifdef ML_VERTICAL_LINE +void ML_vertical_line(int x, int y1, int y2, ML_Color color) +{ + int i, j; + char checker, byte, *vram = ML_vram_adress(); + if(x&~127 || (y1<0 && y2<0) || (y1>63 && y2>63)) return; + if(y1 > y2) + { + int tmp = y1; + y1 = y2; + y2 = tmp; + } + if(y1 < 0) y1 = 0; + if(y2 > 63) y2 = 63; + + i = (y1<<4)+(x>>3); + j = (y2<<4)+(x>>3); + switch(color) + { + case ML_BLACK: + byte = 128>>(x&7); + for( ; i<=j ; i+=16) + vram[i] |= byte; + break; + case ML_WHITE: + byte = ~(128>>(x&7)); + for( ; i<=j ; i+=16) + vram[i] &= byte; + break; + case ML_XOR: + byte = 128>>(x&7); + for( ; i<=j ; i+=16) + vram[i] ^= byte; + break; + case ML_CHECKER: + byte = 128>>(x&7); + checker = y1&1^x&1; + for( ; i<=j ; i+=16) + { + if(checker) vram[i] &= ~byte; + else vram[i] |= byte; + checker = !checker; + } + break; + } +} +#endif + +#ifdef ML_RECTANGLE +void ML_rectangle(int x1, int y1, int x2, int y2, int border_width, ML_Color border_color, ML_Color fill_color) +{ + int i; + if(x1 > x2) + { + i = x1; + x1 = x2; + x2 = i; + } + if(y1 > y2) + { + i = y1; + y1 = y2; + y2 = i; + } + if(border_width > (x2-x1)/2+1) border_width = (x2-x1)/2+1; + if(border_width > (y2-y1)/2+1) border_width = (y2-y1)/2+1; + if(border_color != ML_TRANSPARENT && border_width > 0) + { + for(i=0 ; i t[i]) + { + j++; + tmp = t[j]; + t[j] = t[i]; + t[i] = tmp; + } + } + t[r] = t[j+1]; + t[j+1] = x; + return j + 1; +} + +static void ML_filled_polygon_quicksord(int* t, int p, int r) +{ + int q; + if(p < r) + { + q = ML_filled_polygon_quicksord_partition(t, p, r); + ML_filled_polygon_quicksord(t, p, q-1); + ML_filled_polygon_quicksord(t, q+1, r); + } +} + + +void ML_filled_polygon(const int *x, const int *y, int nb_vertices, ML_Color color) +{ + int i, j, dx, dy, ymin, ymax; + int *cut_in_line, nb_cut; + if(nb_vertices < 3) return; + cut_in_line = malloc(nb_vertices*sizeof(int)); + if(!cut_in_line) return; + ymin = ymax = y[0]; + for(i=1 ; i ymax) ymax = y[i]; + } + for(i=ymin ; i<=ymax ; i++) + { + nb_cut = 0; + for(j=0 ; j=i) || (y[j]>=i && y[(j+1)%nb_vertices]<=i)) + { + dy = abs(y[j]-y[(j+1)%nb_vertices]); + if(dy) + { + dx = x[(j+1)%nb_vertices]-x[j]; + cut_in_line[nb_cut] = x[j] + rnd(abs(i-y[j]+sgn(i-y[j])/2)*dx/dy); + nb_cut++; + } + } + } + ML_filled_polygon_quicksord(cut_in_line, 0, nb_cut-1); + j = 0; + while(j plot_x) + { + if(d < 0) + d += 2*plot_x+3; + else + { + d += 2*(plot_x-plot_y)+5; + plot_y--; + } + plot_x++; + if(plot_y >= plot_x) + { + ML_pixel(x+plot_x, y+plot_y, color); + ML_pixel(x-plot_x, y+plot_y, color); + ML_pixel(x+plot_x, y-plot_y, color); + ML_pixel(x-plot_x, y-plot_y, color); + } + if(plot_y > plot_x) + { + ML_pixel(x+plot_y, y+plot_x, color); + ML_pixel(x-plot_y, y+plot_x, color); + ML_pixel(x+plot_y, y-plot_x, color); + ML_pixel(x-plot_y, y-plot_x, color); + } + } +} +#endif + +#ifdef ML_FILLED_CIRCLE +void ML_filled_circle(int x, int y, int radius, ML_Color color) +{ + int plot_x, plot_y, d; + + if(radius < 0) return; + plot_x = 0; + plot_y = radius; + d = 1 - radius; + + ML_horizontal_line(y, x-plot_y, x+plot_y, color); + while(plot_y > plot_x) + { + if(d < 0) + d += 2*plot_x+3; + else { + d += 2*(plot_x-plot_y)+5; + plot_y--; + ML_horizontal_line(y+plot_y+1, x-plot_x, x+plot_x, color); + ML_horizontal_line(y-plot_y-1, x-plot_x, x+plot_x, color); + } + plot_x++; + if(plot_y >= plot_x) + { + ML_horizontal_line(y+plot_x, x-plot_y, x+plot_y, color); + ML_horizontal_line(y-plot_x, x-plot_y, x+plot_y, color); + } + } +} +#endif + +#ifdef ML_ELLIPSE +void ML_ellipse(int x, int y, int radius1, int radius2, ML_Color color) +{ + int plot_x, plot_y; + float d1, d2; + if(radius1 < 1 || radius2 < 1) return; + plot_x = 0; + plot_y = radius2; + d1 = radius2*radius2 - radius1*radius1*radius2 + radius1*radius1/4; + ML_pixel(x, y+plot_y, color); + ML_pixel(x, y-plot_y, color); + while(radius1*radius1*(plot_y-.5) > radius2*radius2*(plot_x+1)) + { + if(d1 < 0) + { + d1 += radius2*radius2*(2*plot_x+3); + plot_x++; + } else { + d1 += radius2*radius2*(2*plot_x+3) + radius1*radius1*(-2*plot_y+2); + plot_x++; + plot_y--; + } + ML_pixel(x+plot_x, y+plot_y, color); + ML_pixel(x-plot_x, y+plot_y, color); + ML_pixel(x+plot_x, y-plot_y, color); + ML_pixel(x-plot_x, y-plot_y, color); + } + d2 = radius2*radius2*(plot_x+.5)*(plot_x+.5) + radius1*radius1*(plot_y-1)*(plot_y-1) - radius1*radius1*radius2*radius2; + while(plot_y > 0) + { + if(d2 < 0) + { + d2 += radius2*radius2*(2*plot_x+2) + radius1*radius1*(-2*plot_y+3); + plot_y--; + plot_x++; + } else { + d2 += radius1*radius1*(-2*plot_y+3); + plot_y--; + } + ML_pixel(x+plot_x, y+plot_y, color); + ML_pixel(x-plot_x, y+plot_y, color); + if(plot_y > 0) + { + ML_pixel(x+plot_x, y-plot_y, color); + ML_pixel(x-plot_x, y-plot_y, color); + } + } +} +#endif + +#ifdef ML_ELLIPSE_IN_RECT +void ML_ellipse_in_rect(int x1, int y1, int x2, int y2, ML_Color color) +{ + int radius1, radius2; + if(x1 > x2) + { + int tmp = x1; + x1 = x2; + x2 = tmp; + } + if(y1 > y2) + { + int tmp = y1; + y1 = y2; + y2 = tmp; + } + radius1 = (x2-x1)/2; + radius2 = (y2-y1)/2; + ML_ellipse(x1+radius1, y1+radius2, radius1, radius2, color); +} +#endif + +#ifdef ML_FILLED_ELLIPSE +void ML_filled_ellipse(int x, int y, int radius1, int radius2, ML_Color color) +{ + int plot_x, plot_y; + float d1, d2; + if(radius1 < 1 || radius2 < 1) return; + plot_x = 0; + plot_y = radius2; + d1 = radius2*radius2 - radius1*radius1*radius2 + radius1*radius1/4; + while(radius1*radius1*(plot_y-.5) > radius2*radius2*(plot_x+1)) + { + if(d1 < 0) + { + d1 += radius2*radius2*(2*plot_x+3); + plot_x++; + } else { + d1 += radius2*radius2*(2*plot_x+3) + radius1*radius1*(-2*plot_y+2); + ML_horizontal_line(y+plot_y, x-plot_x, x+plot_x, color); + ML_horizontal_line(y-plot_y, x-plot_x, x+plot_x, color); + plot_x++; + plot_y--; + } + } + ML_horizontal_line(y+plot_y, x-plot_x, x+plot_x, color); + ML_horizontal_line(y-plot_y, x-plot_x, x+plot_x, color); + d2 = radius2*radius2*(plot_x+.5)*(plot_x+.5) + radius1*radius1*(plot_y-1)*(plot_y-1) - radius1*radius1*radius2*radius2; + while(plot_y > 0) + { + if(d2 < 0) + { + d2 += radius2*radius2*(2*plot_x+2) + radius1*radius1*(-2*plot_y+3); + plot_y--; + plot_x++; + } else { + d2 += radius1*radius1*(-2*plot_y+3); + plot_y--; + } + ML_horizontal_line(y+plot_y, x-plot_x, x+plot_x, color); + if(plot_y > 0) + ML_horizontal_line(y-plot_y, x-plot_x, x+plot_x, color); + } +} +#endif + +#ifdef ML_FILLED_ELLIPSE_IN_RECT +void ML_filled_ellipse_in_rect(int x1, int y1, int x2, int y2, ML_Color color) +{ + int radius1, radius2; + if(x1 > x2) + { + int tmp = x1; + x1 = x2; + x2 = tmp; + } + if(y1 > y2) + { + int tmp = y1; + y1 = y2; + y2 = tmp; + } + radius1 = (x2-x1)/2; + radius2 = (y2-y1)/2; + ML_filled_ellipse(x1+radius1, y1+radius2, radius1, radius2, color); +} +#endif + +#ifdef ML_HORIZONTAL_SCROLL +void ML_horizontal_scroll(int scroll) +{ + int i, j; + char line[16], shift, *vram; + unsigned char next; + unsigned short word; + vram = ML_vram_adress(); + scroll %= 128; + shift = 8-(scroll&7); + for(i=0 ; i<64 ; i++) + { + for(j=0 ; j<16 ; j++) line[j] = vram[(i<<4)+((j-(scroll>>3)+15)&15)]; + next = line[15]; + vram[(i<<4)+15] = 0; + for(j=15 ; j>0 ; j--) + { + word = next << shift; + next = line[j-1]; + vram[(i<<4)+j] |= *((char*)&word+1); + vram[(i<<4)+j-1] = *((char*)&word); + } + word = next << shift; + vram[(i<<4)] |= *((char*)&word+1); + vram[(i<<4)+15] |= *((char*)&word); + } +} +#endif + +#ifdef ML_VERTICAL_SCROLL +void ML_vertical_scroll(int scroll) +{ + int i, j; + char column[64], *vram = ML_vram_adress(); + scroll %= 64; + for(i=0 ; i<16 ; i++) + { + for(j=0 ; j<64 ; j++) column[j] = vram[(j<<4)+i]; + for(j=0 ; j<64 ; j++) vram[(j<<4)+i] = column[(j-scroll+64)&63]; + } +} +#endif + +#ifdef ML_BMP_OR +void ML_bmp_or(const unsigned char *bmp, int x, int y, int width, int height) +{ + unsigned short line; + char shift, *screen, *p=(char*)&line; + int i, j, begin=0, end=height, real_width=(width-1>>3<<3)+8; + if(!bmp || x<0 || x>128-width || y<1-height || y>63 || width<1 || height<1) return; + if(y < 0) begin = -y; + if(y+height > 64) end = 64-y; + shift = 8-(x&7); + screen = ML_vram_adress()+(y+begin<<4)+(x>>3); + for(i=begin ; i>3 ; j++) + { + line = bmp[i*(real_width>>3)+j]<>3)+j] & -1<<(real_width-width))<>3<<3)+8; + if(!bmp || x<0 || x>128-width || y<1-height || y>63 || width<1 || height<1) return; + if(y < 0) begin = -y; + if(y+height > 64) end = 64-y; + shift = 8-(x&7); + screen = ML_vram_adress()+(y+begin<<4)+(x>>3); + for(i=begin ; i>3 ; j++) + { + line = ~((unsigned char)~bmp[i*(real_width>>3)+j]<>3)+j] | (unsigned char)-1>>8-(width&7))<>3<<3)+8; + if(!bmp || x<0 || x>128-width || y<1-height || y>63 || width<1 || height<1) return; + if(y < 0) begin = -y; + if(y+height > 64) end = 64-y; + shift = 8-(x&7); + screen = ML_vram_adress()+(y+begin<<4)+(x>>3); + for(i=begin ; i>3 ; j++) + { + line = bmp[i*(real_width>>3)+j]<>3)+j] & -1<<(real_width-width))<127 || y<1-height || y>63 || height<1 || width<1) return; + p = (char*)&line; + real_width = (width-1>>3<<3)+8; + if(y < 0) begin_y = -y; + else begin_y = 0; + if(y+height > 64) end_y = 64-y; + else end_y = height; + shift = 8-(x&7); + if(x<0) + { + begin_x = -x>>3; + if(shift != 8) bool1 = 0; + } else begin_x = 0; + if(x+real_width > 128) end_x = 15-(x>>3), bool2 = 0; + else end_x = real_width-1>>3; + bool3 = (end_x == real_width-1>>3); + screen = ML_vram_adress()+(y+begin_y<<4)+(x>>3); + + for(i=begin_y ; i>3)+begin_x] << shift; + if(bool1) screen[begin_x] |= *p; + if(shift!=8) screen[begin_x+1] |= *(p+1); + for(j=begin_x+1 ; j>3)+j] << shift; + screen[j] |= *p; + if(shift!=8) screen[j+1] |= *(p+1); + } + } + line = bmp[i*(real_width>>3)+end_x]; + if(bool3) line &= -1<127 || y<1-height || y>63 || height<1 || width<1) return; + p = (char*)&line; + real_width = (width-1>>3<<3)+8; + if(y < 0) begin_y = -y; + else begin_y = 0; + if(y+height > 64) end_y = 64-y; + else end_y = height; + shift = 8-(x&7); + if(x<0) + { + begin_x = -x>>3; + if(shift != 8) bool1 = 0; + } else begin_x = 0; + if(x+real_width > 128) end_x = 15-(x>>3), bool2 = 0; + else end_x = real_width-1>>3; + bool3 = (end_x == real_width-1>>3); + screen = ML_vram_adress()+(y+begin_y<<4)+(x>>3); + + for(i=begin_y ; i>3)+begin_x]<>3)+j]<>3)+end_x]; + if(bool3) line &= -1<127 || y<1-height || y>63 || height<1 || width<1) return; + p = (char*)&line; + real_width = (width-1>>3<<3)+8; + if(y < 0) begin_y = -y; + else begin_y = 0; + if(y+height > 64) end_y = 64-y; + else end_y = height; + shift = 8-(x&7); + if(x<0) + { + begin_x = -x>>3; + if(shift != 8) bool1 = 0; + } else begin_x = 0; + if(x+real_width > 128) end_x = 15-(x>>3), bool2 = 0; + else end_x = real_width-1>>3; + bool3 = (end_x == real_width-1>>3); + screen = ML_vram_adress()+(y+begin_y<<4)+(x>>3); + + for(i=begin_y ; i>3)+begin_x] << shift; + if(bool1) screen[begin_x] ^= *p; + if(shift!=8) screen[begin_x+1] ^= *(p+1); + for(j=begin_x+1 ; j>3)+j] << shift; + screen[j] ^= *p; + if(shift!=8) screen[j+1] ^= *(p+1); + } + } + line = bmp[i*(real_width>>3)+end_x]; + if(bool3) line &= -1<120 || y<-7 || y>63) return; + if(y < 0) begin = -y; + if(y > 56) end = 64-y; + shift = 8-(x&7); + screen = ML_vram_adress()+(y+begin<<4)+(x>>3); + for(i=begin ; i120 || y<-7 || y>63) return; + if(y < 0) begin = -y; + if(y > 56) end = 64-y; + shift = 8-(x&7); + screen = ML_vram_adress()+(y+begin<<4)+(x>>3); + for(i=begin ; i120 || y<-7 || y>63) return; + if(y < 0) begin = -y; + if(y > 56) end = 64-y; + shift = 8-(x&7); + screen = ML_vram_adress()+(y+begin<<4)+(x>>3); + for(i=begin ; i127 || y<-7 || y>63) return; + if(y < 0) begin = -y; + if(y > 56) end = 64-y; + shift = 8-(x&7); + if(x < 0) bool1 = 0; + if(x>120 || shift==8) bool2 = 0; + screen = ML_vram_adress()+(y+begin<<4)+(x>>3); + for(i=begin ; i127 || y<-7 || y>63) return; + if(y < 0) begin = -y; + if(y > 56) end = 64-y; + shift = 8-(x&7); + if(x < 0) bool1 = 0; + if(x>120 || shift==8) bool2 = 0; + screen = ML_vram_adress()+(y+begin<<4)+(x>>3); + for(i=begin ; i127 || y<-7 || y>63) return; + if(y < 0) begin = -y; + if(y > 56) end = 64-y; + shift = 8-(x&7); + if(x < 0) bool1 = 0; + if(x>120 || shift==8) bool2 = 0; + screen = ML_vram_adress()+(y+begin<<4)+(x>>3); + for(i=begin ; i112 || y<-15 || y>63) return; + if(y < 0) begin = -y; + if(y > 48) end = 64-y; + shift = 8-(x&7); + screen = ML_vram_adress()+(y+begin<<4)+(x>>3); + for(i=begin ; i112 || y<-15 || y>63) return; + if(y < 0) begin = -y; + if(y > 48) end = 64-y; + shift = 8-(x&7); + screen = ML_vram_adress()+(y+begin<<4)+(x>>3); + for(i=begin ; i112 || y<-15 || y>63) return; + if(y < 0) begin = -y; + if(y > 48) end = 64-y; + shift = 8-(x&7); + screen = ML_vram_adress()+(y+begin<<4)+(x>>3); + for(i=begin ; i127 || y<-15 || y>63) return; + if(y < 0) begin = -y; + if(y > 48) end = 64-y; + shift = 8-(x&7); + if(x < 0) bool1 = 0; + if(x<-8 || x>119) bool2 = 0; + if(x>111 || shift==8) bool3 = 0; + screen = ML_vram_adress()+(y+begin<<4)+(x>>3); + for(i=begin ; i127 || y<-15 || y>63) return; + if(y < 0) begin = -y; + if(y > 48) end = 64-y; + shift = 8-(x&7); + if(x < 0) bool1 = 0; + if(x<-8 || x>119) bool2 = 0; + if(x>111 || shift==8) bool3 = 0; + screen = ML_vram_adress()+(y+begin<<4)+(x>>3); + for(i=begin ; i127 || y<-15 || y>63) return; + if(y < 0) begin = -y; + if(y > 48) end = 64-y; + shift = 8-(x&7); + if(x < 0) bool1 = 0; + if(x<-8 || x>119) bool2 = 0; + if(x>111 || shift==8) bool3 = 0; + screen = ML_vram_adress()+(y+begin<<4)+(x>>3); + for(i=begin ; iH6J0PV2#Iiul4aAH<2m(4le3%b{!2(d?|NsABR{j6~9}BdG>}vpg2e#q!0kAbRE6` literal 0 HcmV?d00001