pass a buffer to return the NEWGAL engine name: mg_InitGAL

This commit is contained in:
Vincent Wei
2020-01-06 18:31:07 +08:00
parent 29a51d2cf2
commit c8e35931cf
2 changed files with 21 additions and 20 deletions
+1 -1
View File
@@ -757,7 +757,7 @@ extern GAL_Surface* __gal_screen;
#define GAL_BMask(surface) (surface->format->Bmask)
#define GAL_AMask(surface) (surface->format->Amask)
extern int mg_InitGAL (void);
extern int mg_InitGAL (char* engine);
/* Since 4.0.0; suspend/resume video device, for switching virtual terminals */
extern int GAL_SuspendVideo(void);
+20 -19
View File
@@ -11,35 +11,35 @@
//
//////////////////////////////////////////////////////////////////////////////
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
*
* Copyright (C) 2002~2020, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*
* Or,
*
*
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
*
*
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
*
*
* For more information about the commercial license, please refer to
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
*/
@@ -61,6 +61,7 @@
#include "newgal.h"
#include "misc.h"
#include "license.h"
#include "sharedres.h"
GAL_Surface* __gal_screen;
@@ -84,15 +85,14 @@ BOOL GAL_ParseVideoMode (const char* mode, int* w, int* h, int* depth)
return TRUE;
}
int mg_InitGAL (void)
int mg_InitGAL (char* engine)
{
int i;
int w, h, depth;
char engine [LEN_ENGINE_NAME + 1];
char mode [LEN_VIDEO_MODE + 1];
#if defined (WIN32) || !defined(__NOUNIX__)
char* env_value;
char* env_value;
#endif
LICENSE_CHECK_CUSTIMER_ID ();
@@ -115,7 +115,7 @@ int mg_InitGAL (void)
strcpy(engine, "dummy");
# endif
#endif /* _MG_MINIMALGDI */
if (GAL_VideoInit (engine, 0)) {
GAL_VideoQuit ();
fprintf (stderr, "NEWGAL: Does not find matched engine: %s.\n", engine);
@@ -148,8 +148,8 @@ int mg_InitGAL (void)
#ifndef _MGRM_THREADS
if (w != __gal_screen->w || h != __gal_screen->h) {
fprintf (stderr, "The resolution specified in MiniGUI.cfg is not "
"the same as the actual resolution: %dx%d.\n"
"This may confuse the clients. Please change it.\n",
"the same as the actual resolution: %dx%d.\n"
"This may confuse the clients. Please change it.\n",
__gal_screen->w, __gal_screen->h);
GAL_VideoQuit ();
return ERR_GFX_ENGINE;
@@ -162,11 +162,12 @@ int mg_InitGAL (void)
__gal_screen->dpi = GDCAP_DPI_MINIMAL;
for (i = 0; i < 17; i++) {
SysPixelIndex [i] = GAL_MapRGB (__gal_screen->format,
SysPixelColor [i].r,
SysPixelColor [i].g,
SysPixelIndex [i] = GAL_MapRGB (__gal_screen->format,
SysPixelColor [i].r,
SysPixelColor [i].g,
SysPixelColor [i].b);
}
return 0;
}