Created
February 23, 2011 03:39
-
-
Save anonymous/839973 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(gen-class :extends android.view.SurfaceView | |
:implements [android.view.SurfaceHolder$Callback] | |
:name org.stine.program.MainSurface | |
:init init | |
:constructors {[android.content.Context] [android.content.Context]} | |
:exposes-methods {setMeasuredDimension superSetMeasuredDimension} | |
:prefix mainsurf-) | |
(defn mainsurf-init [context] | |
[[context]]) | |
(defn mainsurf-onDraw [this ^android.graphics.Canvas canvas] | |
(doto canvas | |
(.drawRGB 100 10 0))) | |
(defn mainsurf-onMeasure [this | |
^android.view.View$MeasureSpec width | |
^android.view.View$MeasureSpec height] | |
(let [processSpec (fn [spec] | |
(let [mode (View$MeasureSpec/getMode spec) | |
size (View$MeasureSpec/getSize spec)] | |
(condp = mode | |
View$MeasureSpec/EXACTLY size | |
View$MeasureSpec/AT_MOST size | |
View$MeasureSpec/UNSPECIFIED size | |
100)))] | |
(.superSetMeasuredDimension this | |
(int (processSpec width)) | |
(int (processSpec height))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment