This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # babashka (2)
- # beginners (51)
- # calva (79)
- # cestmeetup (1)
- # chlorine-clover (1)
- # cider (6)
- # clj-kondo (1)
- # cljdoc (4)
- # cljsrn (2)
- # clojure (31)
- # clojure-europe (2)
- # clojurescript (5)
- # conjure (4)
- # cursive (26)
- # datascript (4)
- # datomic (1)
- # figwheel (1)
- # figwheel-main (2)
- # off-topic (25)
- # reagent (2)
- # reveal (4)
- # shadow-cljs (21)
- # xtdb (1)
I’m in the midst of a hackathon type thing, and we’re building a “text-based” adventure game. As in, you text from your cell phone. The trouble is, message length is a bit of a problem, so I want to create images of the text to send vs MMS as opposed to SMS. I’ve messed with Graphics2D, but text layout is a bit of a bummer. I’m looking for something simple that will let me just dump a big string in, and not have to worry about x/y coordinates. I’m imagining something like raw HTML->Image.
not exactly sure what you're looking for, but https://github.com/phronmophobic/membrane might help. graphics2d should also be pretty straight forward if you're just trying to create images from text
(require '[membrane.skia :as skia]) (require '[membrane.ui :as ui]) (skia/draw-to-image! "myimage.png" (ui/label "X X XXXXX XX " (ui/font "Menlo.ttc" 12)) )
this assumes mac osx, but I can provide an example for whichever platform you're targetting
What would be the main difference for Linux? I don’t see anything in your example that makes me think it’s specific to OSX?
i’m looking for feedback, so let me know if you have any suggestions or improvements
Does this exist (freely (I found a paid library/api to do it)), or do you have any other ideas?
letfn is necessary when you bind two functions which call each other. (With
let, the first function couldn't call the second.)
I'm getting errors of "Inconsistent stackmap frames at branch target" which I'm guessing at this point is a compiler bug? I've created a minimal standalone example here (including the error I'm seeing and full edn report): https://gist.github.com/WickedShell/2acaaf5e40a15352123e2bad338e06ae changing line 49 of core.clj to just return a number instead of calling haversine-distance will fix the error
Not sure if it's the cause (not at a computer) but your return type tag is in the wrong spot, it should be before the symbol not before the arg vector: https://gist.github.com/WickedShell/2acaaf5e40a15352123e2bad338e06ae#file-core-clj-L29
Oh wow, absolutely correct, and resolves it. What's horrifying is I got that hint wrong 4 years ago, and everything else has been fine with it....
np! Probably is related to a clojure or java upgrade and some transitive behaviors in conjunction with a long standing bad tag
Wait, actually I'm not sure I'm wrong there. All my type hints are done that way, and that's actually how the docs say to do it... https://clojure.org/reference/java_interop#typehints
Wow, so they do. I certainly always have put them before the var symbol. I will need to look more closely
based on that discussion, moving the
^double hint to the symbol means its no longer a proper primitive hint, which means the hint no longer does anything useful, but in this case it also prevents the code path that has the compiler bug
can you post this to https://ask.clojure.org - that will get it into my queue to make it a bug
@U064X3EF3 I'll be out of town till Tuesday, but I'll post it there once I'm back, thanks!