Rename internal/opengl -> internal/graphics

This commit is contained in:
Hajime Hoshi 2014-12-31 02:55:17 +09:00
parent 0f569807e2
commit 450a8da267
10 changed files with 22 additions and 22 deletions

View File

@ -15,14 +15,14 @@
package ebiten package ebiten
import ( import (
"github.com/hajimehoshi/ebiten/internal/opengl" "github.com/hajimehoshi/ebiten/internal/graphics"
) )
// Filter represents the type of filter to be used when an image is maginified or minified. // Filter represents the type of filter to be used when an image is maginified or minified.
type Filter opengl.Filter type Filter graphics.Filter
// Filters // Filters
const ( const (
FilterNearest = Filter(opengl.FilterNearest) FilterNearest = Filter(graphics.FilterNearest)
FilterLinear = Filter(opengl.FilterLinear) FilterLinear = Filter(graphics.FilterLinear)
) )

View File

@ -15,16 +15,16 @@
package ebiten package ebiten
import ( import (
"github.com/hajimehoshi/ebiten/internal/opengl" "github.com/hajimehoshi/ebiten/internal/graphics"
) )
func newGraphicsContext(screenWidth, screenHeight, screenScale int) (*graphicsContext, error) { func newGraphicsContext(screenWidth, screenHeight, screenScale int) (*graphicsContext, error) {
f, err := opengl.NewZeroFramebuffer(screenWidth*screenScale, screenHeight*screenScale) f, err := graphics.NewZeroFramebuffer(screenWidth*screenScale, screenHeight*screenScale)
if err != nil { if err != nil {
return nil, err return nil, err
} }
texture, err := opengl.NewTexture(screenWidth, screenHeight, opengl.Filter(FilterNearest)) texture, err := graphics.NewTexture(screenWidth, screenHeight, graphics.Filter(FilterNearest))
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -16,18 +16,18 @@ package ebiten
import ( import (
"github.com/hajimehoshi/ebiten/internal" "github.com/hajimehoshi/ebiten/internal"
"github.com/hajimehoshi/ebiten/internal/opengl" "github.com/hajimehoshi/ebiten/internal/graphics"
"image" "image"
"image/color" "image/color"
) )
type innerImage struct { type innerImage struct {
framebuffer *opengl.Framebuffer framebuffer *graphics.Framebuffer
texture *opengl.Texture texture *graphics.Texture
} }
func newInnerImage(texture *opengl.Texture) (*innerImage, error) { func newInnerImage(texture *graphics.Texture) (*innerImage, error) {
framebuffer, err := opengl.NewFramebufferFromTexture(texture) framebuffer, err := graphics.NewFramebufferFromTexture(texture)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package opengl package graphics
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/go-gl/gl" "github.com/go-gl/gl"
"github.com/hajimehoshi/ebiten/internal" "github.com/hajimehoshi/ebiten/internal"
"github.com/hajimehoshi/ebiten/internal/opengl/internal/shader" "github.com/hajimehoshi/ebiten/internal/graphics/internal/shader"
) )
func orthoProjectionMatrix(left, right, bottom, top int) [4][4]float64 { func orthoProjectionMatrix(left, right, bottom, top int) [4][4]float64 {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package opengl package graphics
import ( import (
"github.com/go-gl/gl" "github.com/go-gl/gl"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package opengl package graphics
import ( import (
"errors" "errors"

12
ui.go
View File

@ -17,7 +17,7 @@ package ebiten
import ( import (
"fmt" "fmt"
glfw "github.com/go-gl/glfw3" glfw "github.com/go-gl/glfw3"
"github.com/hajimehoshi/ebiten/internal/opengl" "github.com/hajimehoshi/ebiten/internal/graphics"
"image" "image"
"runtime" "runtime"
) )
@ -47,7 +47,7 @@ func init() {
} }
currentUI.run() currentUI.run()
currentUI.use(func() { currentUI.use(func() {
opengl.Init() graphics.Init()
glfw.SwapInterval(1) glfw.SwapInterval(1)
}) })
} }
@ -149,8 +149,8 @@ func (u *ui) newImageFromImage(img image.Image, filter Filter) (*Image, error) {
var innerImage *innerImage var innerImage *innerImage
var err error var err error
u.use(func() { u.use(func() {
var texture *opengl.Texture var texture *graphics.Texture
texture, err = opengl.NewTextureFromImage(img, opengl.Filter(filter)) texture, err = graphics.NewTextureFromImage(img, graphics.Filter(filter))
if err != nil { if err != nil {
return return
} }
@ -166,8 +166,8 @@ func (u *ui) newImage(width, height int, filter Filter) (*Image, error) {
var innerImage *innerImage var innerImage *innerImage
var err error var err error
u.use(func() { u.use(func() {
var texture *opengl.Texture var texture *graphics.Texture
texture, err = opengl.NewTexture(width, height, opengl.Filter(filter)) texture, err = graphics.NewTexture(width, height, graphics.Filter(filter))
if err != nil { if err != nil {
return return
} }