Skip to content

Commit

Permalink
Remove eng texture constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Hager committed Jul 14, 2014
1 parent 2fea0f3 commit e2d3961
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 98 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2013 Joseph Hager. All rights reserved.
Copyright (c) 2014 Joseph Hager. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
Expand Down
4 changes: 2 additions & 2 deletions canvas.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func NewCanvas(width, height int) *Canvas {
canvas.height = height

texture := NewTexture(image.NewRGBA(image.Rect(0, 0, width, height)))
texture.SetFilter(FilterLinear, FilterLinear)
texture.SetWrap(WrapClampToEdge, WrapClampToEdge)
texture.SetFilter(gl.LINEAR, gl.LINEAR)
texture.SetWrap(gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE)

gl.GenFramebuffers(1, &canvas.id)

Expand Down
161 changes: 70 additions & 91 deletions eng.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package eng provides functionality for creating 2d games.
package eng

import (
Expand All @@ -27,96 +26,76 @@ var (

// Common OpenGL constants
const (
BlendZero = gl.ZERO
BlendOne = gl.ONE
BlendSrcColor = gl.SRC_COLOR
BlendOneMinusSrcColor = gl.ONE_MINUS_SRC_COLOR
BlendDstColor = gl.DST_COLOR
BlendOneMinusDstColor = gl.ONE_MINUS_DST_COLOR
BlendSrcAlpha = gl.SRC_ALPHA
BlendOneMinusSrcAlpha = gl.ONE_MINUS_SRC_ALPHA
BlendDstAlpha = gl.DST_ALPHA
BlendOneMinusDstAlpha = gl.ONE_MINUS_DST_ALPHA
FilterNearest = gl.NEAREST
FilterLinear = gl.LINEAR
FilterMipMap = gl.LINEAR_MIPMAP_LINEAR
FilterLinearMipMapLinear = gl.LINEAR_MIPMAP_LINEAR
FilterNearestMipMapLinear = gl.NEAREST_MIPMAP_LINEAR
FilterLinearMipMapNearest = gl.LINEAR_MIPMAP_NEAREST
FilterNearestMipMapNearest = gl.NEAREST_MIPMAP_NEAREST
WrapClampToEdge = gl.CLAMP_TO_EDGE
WrapRepeat = gl.REPEAT
WrapMirroredRepeat = gl.MIRRORED_REPEAT
Escape = Key(glfw.KeyEscape)
F1 = Key(glfw.KeyF1)
F2 = Key(glfw.KeyF2)
F3 = Key(glfw.KeyF3)
F4 = Key(glfw.KeyF4)
F5 = Key(glfw.KeyF5)
F6 = Key(glfw.KeyF6)
F7 = Key(glfw.KeyF7)
F8 = Key(glfw.KeyF8)
F9 = Key(glfw.KeyF9)
F10 = Key(glfw.KeyF10)
F11 = Key(glfw.KeyF11)
F12 = Key(glfw.KeyF12)
F13 = Key(glfw.KeyF13)
F14 = Key(glfw.KeyF14)
F15 = Key(glfw.KeyF15)
F16 = Key(glfw.KeyF16)
F17 = Key(glfw.KeyF17)
F18 = Key(glfw.KeyF18)
F19 = Key(glfw.KeyF19)
F20 = Key(glfw.KeyF20)
F21 = Key(glfw.KeyF21)
F22 = Key(glfw.KeyF22)
F23 = Key(glfw.KeyF23)
F24 = Key(glfw.KeyF24)
F25 = Key(glfw.KeyF25)
Up = Key(glfw.KeyUp)
Down = Key(glfw.KeyDown)
Left = Key(glfw.KeyLeft)
Right = Key(glfw.KeyRight)
LeftShift = Key(glfw.KeyLeftShift)
RightShift = Key(glfw.KeyRightShift)
LeftControl = Key(glfw.KeyLeftControl)
RightControl = Key(glfw.KeyRightControl)
LeftAlt = Key(glfw.KeyLeftAlt)
RightAlt = Key(glfw.KeyRightAlt)
Tab = Key(glfw.KeyTab)
Space = Key(glfw.KeySpace)
Enter = Key(glfw.KeyEnter)
Backspace = Key(glfw.KeyBackspace)
Insert = Key(glfw.KeyInsert)
Delete = Key(glfw.KeyDelete)
PageUp = Key(glfw.KeyPageUp)
PageDown = Key(glfw.KeyPageDown)
Home = Key(glfw.KeyHome)
End = Key(glfw.KeyEnd)
Kp0 = Key(glfw.KeyKp0)
Kp1 = Key(glfw.KeyKp1)
Kp2 = Key(glfw.KeyKp2)
Kp3 = Key(glfw.KeyKp3)
Kp4 = Key(glfw.KeyKp4)
Kp5 = Key(glfw.KeyKp5)
Kp6 = Key(glfw.KeyKp6)
Kp7 = Key(glfw.KeyKp7)
Kp8 = Key(glfw.KeyKp8)
Kp9 = Key(glfw.KeyKp9)
KpDivide = Key(glfw.KeyKpDivide)
KpMultiply = Key(glfw.KeyKpMultiply)
KpSubtract = Key(glfw.KeyKpSubtract)
KpAdd = Key(glfw.KeyKpAdd)
KpDecimal = Key(glfw.KeyKpDecimal)
KpEqual = Key(glfw.KeyKpEqual)
KpEnter = Key(glfw.KeyKpEnter)
NumLock = Key(glfw.KeyNumLock)
CapsLock = Key(glfw.KeyCapsLock)
ScrollLock = Key(glfw.KeyScrollLock)
Pause = Key(glfw.KeyPause)
LeftSuper = Key(glfw.KeyLeftSuper)
RightSuper = Key(glfw.KeyRightSuper)
Menu = Key(glfw.KeyMenu)
Escape = Key(glfw.KeyEscape)
F1 = Key(glfw.KeyF1)
F2 = Key(glfw.KeyF2)
F3 = Key(glfw.KeyF3)
F4 = Key(glfw.KeyF4)
F5 = Key(glfw.KeyF5)
F6 = Key(glfw.KeyF6)
F7 = Key(glfw.KeyF7)
F8 = Key(glfw.KeyF8)
F9 = Key(glfw.KeyF9)
F10 = Key(glfw.KeyF10)
F11 = Key(glfw.KeyF11)
F12 = Key(glfw.KeyF12)
F13 = Key(glfw.KeyF13)
F14 = Key(glfw.KeyF14)
F15 = Key(glfw.KeyF15)
F16 = Key(glfw.KeyF16)
F17 = Key(glfw.KeyF17)
F18 = Key(glfw.KeyF18)
F19 = Key(glfw.KeyF19)
F20 = Key(glfw.KeyF20)
F21 = Key(glfw.KeyF21)
F22 = Key(glfw.KeyF22)
F23 = Key(glfw.KeyF23)
F24 = Key(glfw.KeyF24)
F25 = Key(glfw.KeyF25)
Up = Key(glfw.KeyUp)
Down = Key(glfw.KeyDown)
Left = Key(glfw.KeyLeft)
Right = Key(glfw.KeyRight)
LeftShift = Key(glfw.KeyLeftShift)
RightShift = Key(glfw.KeyRightShift)
LeftControl = Key(glfw.KeyLeftControl)
RightControl = Key(glfw.KeyRightControl)
LeftAlt = Key(glfw.KeyLeftAlt)
RightAlt = Key(glfw.KeyRightAlt)
Tab = Key(glfw.KeyTab)
Space = Key(glfw.KeySpace)
Enter = Key(glfw.KeyEnter)
Backspace = Key(glfw.KeyBackspace)
Insert = Key(glfw.KeyInsert)
Delete = Key(glfw.KeyDelete)
PageUp = Key(glfw.KeyPageUp)
PageDown = Key(glfw.KeyPageDown)
Home = Key(glfw.KeyHome)
End = Key(glfw.KeyEnd)
Kp0 = Key(glfw.KeyKp0)
Kp1 = Key(glfw.KeyKp1)
Kp2 = Key(glfw.KeyKp2)
Kp3 = Key(glfw.KeyKp3)
Kp4 = Key(glfw.KeyKp4)
Kp5 = Key(glfw.KeyKp5)
Kp6 = Key(glfw.KeyKp6)
Kp7 = Key(glfw.KeyKp7)
Kp8 = Key(glfw.KeyKp8)
Kp9 = Key(glfw.KeyKp9)
KpDivide = Key(glfw.KeyKpDivide)
KpMultiply = Key(glfw.KeyKpMultiply)
KpSubtract = Key(glfw.KeyKpSubtract)
KpAdd = Key(glfw.KeyKpAdd)
KpDecimal = Key(glfw.KeyKpDecimal)
KpEqual = Key(glfw.KeyKpEqual)
KpEnter = Key(glfw.KeyKpEnter)
NumLock = Key(glfw.KeyNumLock)
CapsLock = Key(glfw.KeyCapsLock)
ScrollLock = Key(glfw.KeyScrollLock)
Pause = Key(glfw.KeyPause)
LeftSuper = Key(glfw.KeyLeftSuper)
RightSuper = Key(glfw.KeyRightSuper)
Menu = Key(glfw.KeyMenu)
)

var (
Expand Down
8 changes: 4 additions & 4 deletions texture.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ func NewTexture(data interface{}) *Texture {
gl.Enable(gl.TEXTURE_2D)
gl.BindTexture(gl.TEXTURE_2D, id)

gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, WrapClampToEdge)
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, WrapClampToEdge)
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, FilterLinearMipMapNearest)
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, FilterNearest)
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR)
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST)
gl.TexParameteri(gl.TEXTURE_2D, gl.GENERATE_MIPMAP, gl.TRUE)

gl.PixelStorei(gl.UNPACK_ALIGNMENT, 1)
Expand Down

0 comments on commit e2d3961

Please sign in to comment.