📄 gal.c
字号:
/*** $Id: gal.c,v 1.31 2003/09/04 02:47:51 weiym Exp $** ** The Graphics Abstract Layer of MiniGUI.**** Copyright (C) 2003 Feynman Software.** Copyright (C) 2000, 2001, 2002 Wei Yongming.**** Current maintainer: Wei Yongming.**** Create date: 2000/06/11*//*** This program 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.**** This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*//*** TODO:*/ #include <stdio.h>#include <string.h>#include "common.h"#include "minigui.h"#include "gal.h"#ifdef _NATIVE_GAL_ENGINE#include "native/native.h"#endif#ifdef _VGA16_GAL #include "vga16.h"#endif#ifdef _SVGALIB #include "svgalib.h"#endif#ifdef _LIBGGI #include "libggi.h"#endif#ifdef _EP7211_GAL #include "ep7211.h"#endif#ifdef _ADS_GAL #include "ads.h"#endif#define LEN_ENGINE_NAME 8static GFX gfxes [] = {#ifdef _NATIVE_GAL_ENGINE#ifdef _QVFB_IAL {"qvfb", InitNative, TermNative},#endif {"fbcon", InitNative, TermNative},#endif#ifdef _VGA16_GAL {"VGA16", InitVGA16, TermVGA16},#endif#ifdef _SVGALIB {"SVGALib", InitSVGALib, TermSVGALib},#endif#ifdef _LIBGGI {"LibGGI", InitLibGGI, TermLibGGI},#endif#ifdef _EP7211_GAL {"EP7211",InitEP7211, TermEP7211},#endif#ifdef _ADS_GAL {"ADS", InitADS, TermADS},#endif};GFX* cur_gfx;#define NR_GFXES (sizeof (gfxes) / sizeof (GFX))#ifdef _INCORE_RES #include "incoreres.h"#endifint InitGAL (void){ int i;#ifndef _INCORE_RES char buff [LEN_ENGINE_NAME + 1];#else const char* buff = GAL_ENGINE;#endif /* _INCORE_RES */printf("\nMiniGUI: in src/gal/gal.c:InitGAL()");printf("\n"); if (NR_GFXES == 0) return ERR_NO_ENGINE;#ifndef _INCORE_RES if (GetValueFromEtcFile (ETCFILEPATH, "system", "gal_engine", buff, LEN_ENGINE_NAME) < 0 ) return ERR_CONFIG_FILE;#endif /* !_INCORE_RES */ for (i = 0; i < NR_GFXES; i++) { if ( strncasecmp (gfxes[i].id, buff, LEN_ENGINE_NAME) == 0) { cur_gfx = gfxes + i; break; } } if (cur_gfx == NULL) { fprintf (stderr, "GAL: Does not find matched engine.\n"); return ERR_NO_MATCH; } if (!GAL_InitGfx (cur_gfx)) { fprintf (stderr, "GAL: Init GAL engine failure.\n"); return ERR_GFX_ENGINE; }#ifdef _DEBUG printf ("GAL: Use %s engine.\n", cur_gfx->id);#endif return 0;}void TerminateGAL (void){ GAL_TermGfx (cur_gfx);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -