0

This is the java code I'm trying to implement in clojure:

manager.load("data/mytexture.png", Texture.class);

I've tried this:

(.load "resources/bucket.png" (.class Texture))

which yields:

Execution error (IllegalArgumentException) at bucket-drops.core/fn$fn (core.clj:79).
No matching field found: class for class java.lang.Class

and

(.load "resources/bucket.png" Texture/class)

yielding

Syntax error compiling at (bucket_drops/core.clj:79:19).
Unable to find static field: class in class com.badlogic.gdx.graphics.Texture

So, how to actually access .class?

2
  • manager.load(...) is (.load manager ...) Commented Apr 17 at 21:35
  • 1
    While that is correct, it has nothing to do with the problem. Actually, I have the load stuff wrapped up in a doto. Commented Apr 17 at 21:42

2 Answers 2

3

I guess load is method of AssetManager from LibGDX. Import both classes:

(:import (com.badlogic.gdx.assets AssetManager)
           (com.badlogic.gdx.graphics Texture))

Then call

(.load manager "resources/bucket.png" Texture)

Or use doto:

(doto manager
  (.load "resources/bucket.png" Texture))
Sign up to request clarification or add additional context in comments.

Comments

3

You don't have to. Texture is a class itself, so use it.

For example in case of a String class:

String
;; => java.lang.String
(type String)
;; => java.lang.Class

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.