2014-12-24 03:04:10 +01:00
|
|
|
// Copyright 2014 Hajime Hoshi
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2014-12-09 15:16:04 +01:00
|
|
|
|
2014-12-09 14:09:22 +01:00
|
|
|
package ebiten
|
2013-12-02 13:45:10 +01:00
|
|
|
|
2014-12-22 20:32:36 +01:00
|
|
|
import (
|
2022-10-02 16:24:15 +02:00
|
|
|
"github.com/hajimehoshi/ebiten/v2/internal/builtinshader"
|
2022-07-30 19:56:16 +02:00
|
|
|
"github.com/hajimehoshi/ebiten/v2/internal/ui"
|
2014-12-22 20:32:36 +01:00
|
|
|
)
|
|
|
|
|
2023-01-28 11:06:38 +01:00
|
|
|
// Filter represents the type of texture filter to be used when an image is magnified or minified.
|
2014-12-31 06:57:51 +01:00
|
|
|
type Filter int
|
2014-12-10 17:06:38 +01:00
|
|
|
|
|
|
|
const (
|
2016-08-01 18:47:25 +02:00
|
|
|
// FilterNearest represents nearest (crisp-edged) filter
|
2022-10-02 16:24:15 +02:00
|
|
|
FilterNearest Filter = Filter(builtinshader.FilterNearest)
|
2016-08-01 18:47:25 +02:00
|
|
|
|
|
|
|
// FilterLinear represents linear filter
|
2022-10-02 16:24:15 +02:00
|
|
|
FilterLinear Filter = Filter(builtinshader.FilterLinear)
|
2014-12-10 17:06:38 +01:00
|
|
|
)
|
2014-12-31 06:57:51 +01:00
|
|
|
|
2023-01-28 11:06:38 +01:00
|
|
|
// GraphicsLibrary represents graphics libraries supported by the engine.
|
2022-12-09 06:07:04 +01:00
|
|
|
type GraphicsLibrary int
|
2022-07-30 19:56:16 +02:00
|
|
|
|
|
|
|
const (
|
2022-12-09 06:07:04 +01:00
|
|
|
GraphicsLibraryAuto GraphicsLibrary = GraphicsLibrary(ui.GraphicsLibraryAuto)
|
|
|
|
|
2022-07-30 19:56:16 +02:00
|
|
|
// GraphicsLibraryUnknown represents the state at which graphics library cannot be determined,
|
|
|
|
// e.g. hasn't loaded yet or failed to initialize.
|
2022-12-09 06:07:04 +01:00
|
|
|
GraphicsLibraryUnknown GraphicsLibrary = GraphicsLibrary(ui.GraphicsLibraryUnknown)
|
2022-08-07 21:37:03 +02:00
|
|
|
|
|
|
|
// GraphicsLibraryOpenGL represents the graphics library OpenGL.
|
2022-12-09 06:07:04 +01:00
|
|
|
GraphicsLibraryOpenGL GraphicsLibrary = GraphicsLibrary(ui.GraphicsLibraryOpenGL)
|
2022-08-07 21:37:03 +02:00
|
|
|
|
|
|
|
// GraphicsLibraryDirectX represents the graphics library Microsoft DirectX.
|
2022-12-09 06:07:04 +01:00
|
|
|
GraphicsLibraryDirectX GraphicsLibrary = GraphicsLibrary(ui.GraphicsLibraryDirectX)
|
2022-08-07 21:37:03 +02:00
|
|
|
|
|
|
|
// GraphicsLibraryMetal represents the graphics library Apple's Metal.
|
2022-12-09 06:07:04 +01:00
|
|
|
GraphicsLibraryMetal GraphicsLibrary = GraphicsLibrary(ui.GraphicsLibraryMetal)
|
2022-07-30 19:56:16 +02:00
|
|
|
)
|
|
|
|
|
2022-12-09 06:07:04 +01:00
|
|
|
// String returns a string representing the graphics library.
|
|
|
|
func (g GraphicsLibrary) String() string {
|
|
|
|
return ui.GraphicsLibrary(g).String()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ensures GraphicsLibraryAuto is zero (the default value for RunOptions).
|
|
|
|
var _ [GraphicsLibraryAuto]int = [0]int{}
|
|
|
|
|
2022-07-30 19:56:16 +02:00
|
|
|
// DebugInfo is a struct to store debug info about the graphics.
|
|
|
|
type DebugInfo struct {
|
|
|
|
// GraphicsLibrary represents the graphics library currently in use.
|
|
|
|
GraphicsLibrary GraphicsLibrary
|
|
|
|
}
|
|
|
|
|
|
|
|
// ReadDebugInfo writes debug info (e.g. current graphics library) into a provided struct.
|
|
|
|
func ReadDebugInfo(d *DebugInfo) {
|
2023-10-15 10:21:56 +02:00
|
|
|
d.GraphicsLibrary = GraphicsLibrary(ui.Get().GraphicsLibrary())
|
2022-07-30 19:56:16 +02:00
|
|
|
}
|