internal/ui: simplify build tags

This commit is contained in:
Hajime Hoshi 2022-02-11 20:47:14 +09:00
parent f839b52abb
commit 76848f48e6
2 changed files with 10 additions and 6 deletions

View File

@ -12,22 +12,26 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build ((ios && arm) || (ios && arm64)) && !ebitengl && !ebitencbackend
// +build ios,arm ios,arm64
// +build !ebitengl
// +build !ebitencbackend
//go:build ios && !ebitengl && !ebitencbackend
// +build ios,!ebitengl,!ebitencbackend
package ui
import (
"fmt"
"runtime"
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver"
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/metal"
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/metal/mtl"
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/opengl"
)
func Graphics() graphicsdriver.Graphics {
if runtime.GOARCH == "386" || runtime.GOARCH == "amd64" {
return opengl.Get()
}
if _, err := mtl.CreateSystemDefaultDevice(); err != nil {
panic(fmt.Sprintf("mobile: mtl.CreateSystemDefaultDevice failed on iOS: %v", err))
}

View File

@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !darwin || (ios && 386) || (ios && amd64) || ebitengl
// +build !darwin ios,386 ios,amd64 ebitengl
//go:build !darwin || ebitengl
// +build !darwin ebitengl
package ui