mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
ebitenutil: Seal OpenFile on mobiles
This commit is contained in:
parent
bf807799bf
commit
7d99ce35ba
@ -12,7 +12,10 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build darwin linux windows
|
||||
// +build !js
|
||||
// +build !android
|
||||
// +build !ios
|
||||
|
||||
package ebitenutil
|
||||
|
||||
@ -23,6 +26,7 @@ import (
|
||||
// OpenFile opens a file and returns a stream for its data.
|
||||
//
|
||||
// This function is available both on desktops and browsers.
|
||||
// Note that this doesn't work on mobiles.
|
||||
func OpenFile(path string) (ReadSeekCloser, error) {
|
||||
return os.Open(path)
|
||||
}
|
||||
|
@ -12,6 +12,10 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build darwin,!arm,!arm64 linux windows
|
||||
// +build !android
|
||||
// +build !ios
|
||||
|
||||
package ebitenutil
|
||||
|
||||
import (
|
||||
@ -23,6 +27,7 @@ import (
|
||||
// NewImageFromFile loads the file path and returns ebiten.Image and image.Image.
|
||||
//
|
||||
// The current directory for path depends on your environment. This will vary on your desktop or web browser.
|
||||
// Note that this doesn't work on browsers.
|
||||
// It'll be safer to embed your resource, e.g., with github.com/jteeuwen/go-bindata instead of using this function.
|
||||
func NewImageFromFile(path string, filter ebiten.Filter) (*ebiten.Image, image.Image, error) {
|
||||
file, err := OpenFile(path)
|
||||
|
Loading…
Reference in New Issue
Block a user