mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
parent
5027bc1af5
commit
83f93df78b
@ -79,6 +79,15 @@ func invokeOriginalGobind(lang string) (pkgName string, err error) {
|
||||
return pkgs[0].Name, nil
|
||||
}
|
||||
|
||||
func forceGL() bool {
|
||||
for _, tag := range strings.Split(*tags, ",") {
|
||||
if tag == "ebitengl" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func run() error {
|
||||
writeFile := func(filename string, content string) error {
|
||||
if err := ioutil.WriteFile(filepath.Join(*outdir, filename), []byte(content), 0644); err != nil {
|
||||
@ -100,6 +109,12 @@ func run() error {
|
||||
content = strings.ReplaceAll(content, "{{.PrefixUpper}}", prefixUpper)
|
||||
content = strings.ReplaceAll(content, "{{.PrefixLower}}", prefixLower)
|
||||
content = strings.ReplaceAll(content, "{{.JavaPkg}}", *javaPkg)
|
||||
|
||||
f := "0"
|
||||
if forceGL() {
|
||||
f = "1"
|
||||
}
|
||||
content = strings.ReplaceAll(content, "{{.ForceGL}}", f)
|
||||
return content
|
||||
}
|
||||
|
||||
@ -135,7 +150,7 @@ const objcM = `// Code generated by ebitenmobile. DO NOT EDIT.
|
||||
|
||||
#import <TargetConditionals.h>
|
||||
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
#if TARGET_IPHONE_SIMULATOR || {{.ForceGL}}
|
||||
#define EBITEN_METAL 0
|
||||
#else
|
||||
#define EBITEN_METAL 1
|
||||
|
File diff suppressed because one or more lines are too long
7
doc.go
7
doc.go
@ -51,4 +51,11 @@
|
||||
// In the API document, 'the main thread' means the goroutine in init(), main() and their callees without 'go'
|
||||
// statement. It is assured that 'the main thread' runs on the OS main thread. There are some Ebiten functions that
|
||||
// must be called on the main thread under some conditions (typically, before ebiten.Run is called).
|
||||
//
|
||||
// Build tags
|
||||
//
|
||||
// 'ebitendebug' outputs a log of graphics commands. This is useful to know what happens in Ebiten. In general, the
|
||||
// number of graphics commands affects the performance of your game.
|
||||
//
|
||||
// 'ebitengl' forces to use OpenGL in any environments.
|
||||
package ebiten
|
||||
|
@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
// +build darwin,ios,arm darwin,ios,arm64
|
||||
// +build !ebitengl
|
||||
|
||||
package ebiten
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
// +build darwin,!ios
|
||||
// +build !js
|
||||
// +build !ebitengl
|
||||
|
||||
package ebiten
|
||||
|
||||
|
@ -12,9 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build android darwin,ios,386 darwin,ios,amd64 freebsd js linux windows
|
||||
|
||||
// As the Go playground tries to compile this with CGO_ENABLED=0 and GOOS=linux, check Cgo on build tags.
|
||||
// +build android darwin,ios,386 darwin,ios,amd64 freebsd js linux windows ebitengl
|
||||
|
||||
package ebiten
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user