/************************************************************************** * * Othello II v2.53 - 08/02/2004 * * Copyright (C) 2000-2004 François LEIBER * * This file is part of Othello II. * * Othello II is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Othello II is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *************************************************************************/ unsigned short *Plane1 = NULL, *Plane2 = NULL; // Adresse des niveaux de gris SCR_RECT ECRAN = { {0, 0, 239, 127} }; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Reprogrammation des fonctions graphiques usuelles afin de fonctionner en niveaux de gris ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// short init_gray(void) { GrayOn(); HW2 = _GrayIsRealHW2(); Nouveau1 = GetIntVec(AUTO_INT_1); Plane1 = GetPlane(0); Plane2 = GetPlane(1); return IsGrayMode(); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void clr(void) { memset(Plane1, 0, LCD_SIZE); memset(Plane2, 0, LCD_SIZE); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void lcd_save(char *buffer) { memcpy(buffer, Plane1, LCD_SIZE); memcpy(buffer + LCD_SIZE, Plane2, LCD_SIZE); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void lcd_restore(char *buffer) { memcpy(Plane1, buffer, LCD_SIZE); memcpy(Plane2, buffer + LCD_SIZE, LCD_SIZE); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void draw_line(short x1, short y1, short x2, short y2, short mode, short plans) { if (plans & 2) { SetPlane(1); DrawLine(x1, y1, x2, y2, mode); } if (plans & 1) { SetPlane(0); DrawLine(x1, y1, x2, y2, mode); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void draw_str(short x, short y, char *str, short mode, short plans) { if (plans & 2) { SetPlane(1); DrawStr(x, y, str, mode); } if (plans & 1) { SetPlane(0); DrawStr(x, y, str, mode); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void printf_long(short x, short y, char *str, unsigned long nbre, short plans) { if (plans & 2) { SetPlane(1); printf_xy(x, y, str, nbre); } if (plans & 1) { SetPlane(0); printf_xy(x, y, str, nbre); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void printf_long2(short x, short y, char *str, unsigned long nbre, unsigned long nbre2, short plans) { if (plans & 2) { SetPlane(1); printf_xy(x, y, str, nbre, nbre2); } if (plans & 1) { SetPlane(0); printf_xy(x, y, str, nbre, nbre2); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void draw_rect(short x1, short y1, short x2, short y2, short couleur, short plans) { if (plans & 2) { SetPlane(1); DrawClipRect(MakeWinRect(x1, y1, x2, y2), &ECRAN, couleur); } if (plans & 1) { SetPlane(0); DrawClipRect(MakeWinRect(x1, y1, x2, y2), &ECRAN, couleur); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void fill_rect(short x1, short y1, short x2, short y2, short couleur, short plans) { SCR_RECT rect = { {x1, y1, x2, y2} }; if (plans & 2) { SetPlane(1); ScrRectFill(&rect, &ECRAN, couleur); } if (plans & 1) { SetPlane(0); ScrRectFill(&rect, &ECRAN, couleur); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void draw_multi(short x, short y, MULTI_LINE * multi, short plans) { if (plans & 2) { SetPlane(1); DrawMultiLines(x, y, multi); } if (plans & 1) { SetPlane(0); DrawMultiLines(x, y, multi); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void bitmap_put(short x, short y, char *bmp, short mode, short plans) { if (plans & 2) { SetPlane(1); BitmapPut(x, y, bmp, &ECRAN, mode); } if (plans & 1) { SetPlane(0); BitmapPut(x, y, bmp, &ECRAN, mode); } }