mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/graphicsdriver/opengl: refactoring: remove contextPlatform
This commit is contained in:
parent
8926a4213e
commit
40c38eb9ee
@ -22,6 +22,7 @@ import (
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver"
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/opengl/gl"
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/shaderir"
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/shaderir/glsl"
|
||||
)
|
||||
|
||||
type blendFactor int
|
||||
@ -105,8 +106,6 @@ type context struct {
|
||||
highp bool
|
||||
highpOnce sync.Once
|
||||
initOnce sync.Once
|
||||
|
||||
contextPlatform
|
||||
}
|
||||
|
||||
func (c *context) bindTexture(t textureNative) {
|
||||
@ -482,3 +481,10 @@ func (c *context) newElementArrayBuffer(size int) buffer {
|
||||
c.ctx.BufferInit(gl.ELEMENT_ARRAY_BUFFER, size, gl.DYNAMIC_DRAW)
|
||||
return buffer(b)
|
||||
}
|
||||
|
||||
func (c *context) glslVersion() glsl.GLSLVersion {
|
||||
if c.ctx.IsES() {
|
||||
return glsl.GLSLVersionES300
|
||||
}
|
||||
return glsl.GLSLVersionDefault
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
// 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.
|
||||
|
||||
package opengl
|
||||
|
||||
import (
|
||||
"syscall/js"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/shaderir/glsl"
|
||||
)
|
||||
|
||||
type contextPlatform struct {
|
||||
canvas js.Value
|
||||
}
|
||||
|
||||
func (c *context) glslVersion() glsl.GLSLVersion {
|
||||
return glsl.GLSLVersionES300
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
// 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.
|
||||
|
||||
//go:build !js
|
||||
|
||||
package opengl
|
||||
|
||||
import (
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/shaderir/glsl"
|
||||
)
|
||||
|
||||
type contextPlatform struct {
|
||||
}
|
||||
|
||||
func (c *context) glslVersion() glsl.GLSLVersion {
|
||||
if c.ctx.IsES() {
|
||||
return glsl.GLSLVersionES300
|
||||
}
|
||||
return glsl.GLSLVersionDefault
|
||||
}
|
@ -43,8 +43,5 @@ func NewGraphics(canvas js.Value) (graphicsdriver.Graphics, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
g := newGraphics(ctx)
|
||||
g.context.canvas = canvas
|
||||
|
||||
return g, nil
|
||||
return newGraphics(ctx), nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user