mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 20:18:59 +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 {
|
||||
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
|
||||
case GraphicsLibraryDirectX:
|
||||
g, err := creator.newDirectX()
|
||||
if err != nil {
|
||||
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
|
||||
case GraphicsLibraryMetal:
|
||||
g, err := creator.newMetal()
|
||||
if err != nil {
|
||||
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
|
||||
default:
|
||||
return nil, 0, fmt.Errorf("ui: an unsupported graphics library is specified: %d", graphicsLibrary)
|
||||
|
Loading…
Reference in New Issue
Block a user