mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 18:52:44 +01:00
internal/ui: refactoring
This commit is contained in:
parent
47e70f2544
commit
e1f18b53f5
@ -67,27 +67,18 @@ func newGraphicsDriver(creator graphicsDriverCreator, graphicsLibrary GraphicsLi
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
if g == nil {
|
|
||||||
return nil, 0, fmt.Errorf("ui: %s is specified but OpenGL is not available", graphicsLibrary)
|
|
||||||
}
|
|
||||||
return g, GraphicsLibraryOpenGL, nil
|
return g, GraphicsLibraryOpenGL, nil
|
||||||
case GraphicsLibraryDirectX:
|
case GraphicsLibraryDirectX:
|
||||||
g, err := creator.newDirectX()
|
g, err := creator.newDirectX()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
if g == nil {
|
|
||||||
return nil, 0, fmt.Errorf("ui: %s is specified but DirectX is not available.", graphicsLibrary)
|
|
||||||
}
|
|
||||||
return g, GraphicsLibraryDirectX, nil
|
return g, GraphicsLibraryDirectX, nil
|
||||||
case GraphicsLibraryMetal:
|
case GraphicsLibraryMetal:
|
||||||
g, err := creator.newMetal()
|
g, err := creator.newMetal()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
if g == nil {
|
|
||||||
return nil, 0, fmt.Errorf("ui: %s is specified but Metal is not available", graphicsLibrary)
|
|
||||||
}
|
|
||||||
return g, GraphicsLibraryMetal, nil
|
return g, GraphicsLibraryMetal, nil
|
||||||
default:
|
default:
|
||||||
return nil, 0, fmt.Errorf("ui: an unsupported graphics library is specified: %d", graphicsLibrary)
|
return nil, 0, fmt.Errorf("ui: an unsupported graphics library is specified: %d", graphicsLibrary)
|
||||||
|
Loading…
Reference in New Issue
Block a user