forked from mamedev/mame
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
678b7ed
commit 9a652f8
Showing
23 changed files
with
608 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "emu.h" | ||
|
||
#include "drivenum.h" | ||
|
||
GAME_EXTERN(___empty); | ||
GAME_EXTERN(genesis); | ||
|
||
const game_driver * const driver_list::s_drivers_sorted[2] = | ||
{ | ||
&GAME_NAME(___empty), | ||
&GAME_NAME(genesis), | ||
}; | ||
|
||
std::size_t const driver_list::s_driver_count = 2; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Drawing; | ||
using System.Drawing.Drawing2D; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace zanac.MAmidiMEmo.ComponentModel | ||
{ | ||
//https://stackoverflow.com/questions/26884446/how-to-scale-on-high-dpi-the-image-of-a-windows-form-button | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public static class ImageUtility | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="container"></param> | ||
public static void AdjustControlImagesDpiScale(Control container) | ||
{ | ||
var dpiScale = GetDpiScale(container).Value; | ||
if (CloseToOne(dpiScale)) | ||
return; | ||
|
||
AdjustControlImagesDpiScale(container.Controls, dpiScale); | ||
} | ||
|
||
private static void AdjustButtonImageDpiScale(ButtonBase button, float dpiScale) | ||
{ | ||
var image = button.Image; | ||
if (image == null) | ||
return; | ||
|
||
button.Image = ScaleImage(image, dpiScale); | ||
} | ||
|
||
private static void AdjustControlImagesDpiScale(Control.ControlCollection controls, float dpiScale) | ||
{ | ||
foreach (Control control in controls) | ||
{ | ||
var button = control as ButtonBase; | ||
if (button != null) | ||
AdjustButtonImageDpiScale(button, dpiScale); | ||
else | ||
{ | ||
var pictureBox = control as PictureBox; | ||
if (pictureBox != null) | ||
AdjustPictureBoxDpiScale(pictureBox, dpiScale); | ||
} | ||
|
||
AdjustControlImagesDpiScale(control.Controls, dpiScale); | ||
} | ||
} | ||
|
||
private static void AdjustPictureBoxDpiScale(PictureBox pictureBox, float dpiScale) | ||
{ | ||
var image = pictureBox.Image; | ||
if (image == null) | ||
return; | ||
|
||
if (pictureBox.SizeMode == PictureBoxSizeMode.CenterImage) | ||
pictureBox.Image = ScaleImage(pictureBox.Image, dpiScale); | ||
} | ||
|
||
private static bool CloseToOne(float dpiScale) | ||
{ | ||
return Math.Abs(dpiScale - 1) < 0.001; | ||
} | ||
|
||
private static Lazy<float> GetDpiScale(Control control) | ||
{ | ||
return new Lazy<float>(() => | ||
{ | ||
using (var graphics = control.CreateGraphics()) | ||
return graphics.DpiX / 96.0f; | ||
}); | ||
} | ||
|
||
private static Image ScaleImage(Image image, float dpiScale) | ||
{ | ||
var newSize = ScaleSize(image.Size, dpiScale); | ||
var newBitmap = new Bitmap(newSize.Width, newSize.Height); | ||
|
||
using (var g = Graphics.FromImage(newBitmap)) | ||
{ | ||
// According to this blog post http://blogs.msdn.com/b/visualstudio/archive/2014/03/19/improving-high-dpi-support-for-visual-studio-2013.aspx | ||
// NearestNeighbor is more adapted for 200% and 200%+ DPI | ||
|
||
var interpolationMode = InterpolationMode.HighQualityBicubic; | ||
if (dpiScale >= 2.0f) | ||
interpolationMode = InterpolationMode.NearestNeighbor; | ||
|
||
g.InterpolationMode = interpolationMode; | ||
g.DrawImage(image, new Rectangle(new Point(), newSize)); | ||
} | ||
|
||
return newBitmap; | ||
} | ||
|
||
private static Size ScaleSize(Size size, float scale) | ||
{ | ||
return new Size((int)(size.Width * scale), (int)(size.Height * scale)); | ||
} | ||
} | ||
} |
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Data; | ||
using System.Drawing; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
using zanac.MAmidiMEmo.ComponentModel; | ||
|
||
namespace zanac.MAmidiMEmo.Gui | ||
{ | ||
public partial class FormAbout : Form | ||
{ | ||
public FormAbout() | ||
{ | ||
InitializeComponent(); | ||
|
||
labelVer.Text = string.Format(labelVer.Text, Program.FILE_VERSION); | ||
|
||
ImageUtility.AdjustControlImagesDpiScale(this); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.