Previous 199869 Revisions Next

r34482 Sunday 18th January, 2015 at 21:57:30 UTC by Couriersud
- Fix SDL Windows compile.
- Aligned strconv.h (same code on sdl and mainline).
- Aligned font code between sdl and mainline
[src/osd/sdl]sdlmain.c strconv.h
[src/osd/windows]strconv.h

trunk/src/osd/sdl/sdlmain.c
r242993r242994
3131#include <unistd.h>
3232#endif
3333
34// only for strconv.h
35#if defined(SDLMAME_WIN32)
36#define WIN32_LEAN_AND_MEAN
37#include <windows.h>
38#endif
39
40
3441#ifdef SDLMAME_OS2
3542#define INCL_DOS
3643#include <os2.h>
r242993r242994
4754#include "emu.h"
4855#include "clifront.h"
4956#include "emuopts.h"
57#include "strconv.h"
5058
5159// OSD headers
5260#include "video.h"
r242993r242994
12031211   return result;
12041212}
12051213
1206osd_font sdl_osd_interface::font_open(const char *_name, int &height)
1214osd_font *sdl_osd_interface::font_open(const char *_name, int &height)
12071215{
12081216   // accept qualifiers from the name
12091217   astring name(_name);
r242993r242994
12281236   logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
12291237
12301238   // copy in the face name
1231   TCHAR *face = wstring_from_utf8(name);
1232   wcsncpy(logfont.lfFaceName, face, sizeof(logfont.lfFaceName) / sizeof(TCHAR));
1239   TCHAR *face = tstring_from_utf8(name);
1240   _tcsncpy(logfont.lfFaceName, face, sizeof(logfont.lfFaceName) / sizeof(TCHAR));
12331241   logfont.lfFaceName[sizeof(logfont.lfFaceName) / sizeof(TCHAR)-1] = 0;
12341242   osd_free(face);
12351243
12361244   // create the font
12371245   height = logfont.lfHeight;
1238   osd_font font = reinterpret_cast<osd_font>(CreateFontIndirect(&logfont));
1246   osd_font *font = reinterpret_cast<osd_font *>(CreateFontIndirect(&logfont));
12391247   if (font == NULL)
12401248      return NULL;
12411249
r242993r242994
12481256   DeleteDC(dummyDC);
12491257
12501258   // if it doesn't match our request, fail
1251   char *utf = utf8_from_wstring(realname);
1259   char *utf = utf8_from_tstring(realname);
12521260   int result = core_stricmp(utf, name);
12531261   osd_free(utf);
12541262
r242993r242994
12671275//  a given OSD font
12681276//-------------------------------------------------
12691277
1270void sdl_osd_interface::font_close(osd_font font)
1278void sdl_osd_interface::font_close(osd_font *font)
12711279{
12721280   // delete the font ojbect
12731281   if (font != NULL)
r242993r242994
12831291//  pixel of a black & white font
12841292//-------------------------------------------------
12851293
1286bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
1294bool sdl_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
12871295{
12881296   // create a dummy DC to work with
12891297   HDC dummyDC = CreateCompatibleDC(NULL);
r242993r242994
14251433//  font with the given name
14261434//-------------------------------------------------
14271435
1428osd_font sdl_osd_interface::font_open(const char *_name, int &height)
1436osd_font *sdl_osd_interface::font_open(const char *_name, int &height)
14291437{
1430   return (osd_font)NULL;
1438   return (osd_font *)NULL;
14311439}
14321440
14331441//-------------------------------------------------
r242993r242994
14351443//  a given OSD font
14361444//-------------------------------------------------
14371445
1438void sdl_osd_interface::font_close(osd_font font)
1446void sdl_osd_interface::font_close(osd_font *font)
14391447{
14401448}
14411449
r242993r242994
14471455//  pixel of a black & white font
14481456//-------------------------------------------------
14491457
1450bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
1458bool sdl_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
14511459{
14521460   return false;
14531461}
trunk/src/osd/sdl/strconv.h
r242993r242994
1// license:BSD-3-Clause
2// copyright-holders:Aaron Giles
13//============================================================
24//
3//  strconv.h - SDL string conversion
5//  strconv.h - String conversion
46//
57//  Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
68//  Visit http://mamedev.org for licensing and usage restrictions.
79//
810//============================================================
911
10#ifndef __SDLSTRCONV__
11#define __SDLSTRCONV__
12#ifndef __OSD_STRCONV__
13#define __OSD_STRCONV__
1214
1315#include "osdcore.h"
1416
r242993r242994
1820//  FUNCTION PROTOTYPES
1921//============================================================
2022
21#ifdef SDLMAME_WIN32
23#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
2224
25#define WIN32_LEAN_AND_MEAN
26#include <windows.h>
2327// the result of these functions has to be released with osd_free()
2428
2529CHAR *astring_from_utf8(const char *s);
r242993r242994
3640#define utf8_from_tstring   utf8_from_astring
3741#endif // UNICODE
3842
43#if defined(SDLMAME_WIN32)
44#define _tcsncpy wcsncpy
45#endif
46
3947#endif //SDLMAME_WIN32
4048
41#endif // __SDLSTRCONV__
49
50#endif // __OSD_STRCONV__
trunk/src/osd/windows/strconv.h
r242993r242994
22// copyright-holders:Aaron Giles
33//============================================================
44//
5//  strconv.h - Win32 string conversion
5//  strconv.h - String conversion
66//
7//  Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
8//  Visit http://mamedev.org for licensing and usage restrictions.
9//
710//============================================================
811
9#ifndef __WIN_STRCONV__
10#define __WIN_STRCONV__
12#ifndef __OSD_STRCONV__
13#define __OSD_STRCONV__
1114
1215#include "osdcore.h"
1316
r242993r242994
1720//  FUNCTION PROTOTYPES
1821//============================================================
1922
23#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
24
2025// the result of these functions has to be released with osd_free()
2126
2227CHAR *astring_from_utf8(const char *s);
r242993r242994
3338#define utf8_from_tstring   utf8_from_astring
3439#endif // UNICODE
3540
41#endif //SDLMAME_WIN32
3642
3743
38#endif // __WIN_STRCONV__
44#endif // __OSD_STRCONV__


Previous 199869 Revisions Next


© 1997-2024 The MAME Team