ID:982926
 
(See the best response by Kaiochao.)

Problem description:

I tried using a label, but it isn't very flexible with image=[player.icon], and I tried browsing it, but that's just desperate. Grids seems good except that it leaves ugly grid lines and manages to mess up the picture one way or another.

How can I display "player.icon" to a window?
Best response
You could use a map control and a HUD object.
That semi works.

            var/obj/o1 = new
o1.icon = player1.icon
o1.icon_state = player1.icon_state
player.client.screen += o1
o1.screen_loc = "player1image:1,1"


It's a little small though. Is there a way to increase the icon size?

EDIT:

Nevermind, I got it. Thanks!
In response to Speedro
I don't see why you'd have a problem outputting an image to a label. What's happening there?

Using a HUD Object and map control is just ew.
Try having any variable image set. It won't work - or at least it will be very tedious as far as I'm aware. Setting an image on a label (works):

image='blah.dmi'

What I want to do but does not work with any variation I've tried:

image=[player.icon]
In response to Red Hall Dev
Placing a HUD object on a map control centers it, stretches it, lets you choose a background color, lets you put (map)text over it, and even lets you show multiple images like an object with overlays, a grid of items (alternative to using a Grid control). There's nothing ew about using the map control for things other than a player's screen.
In response to Kaiochao
Kaiochao wrote:
Placing a HUD object on a map control centers it, stretches it, lets you choose a background color, lets you put (map)text over it, and even lets you show multiple images like an object with overlays, a grid of items (alternative to using a Grid control). There's nothing ew about using the map control for things other than a player's screen.

Well nothing except that a label will do all of that except place writing over it. For that you'd place an extra label over it with 100% transparency.

As far as I know they're not making a game HUD so it's inappropriate to use HUD objects in displaying an image on the interface.

Of course if they were building a game HUD it would make sense.
In response to Speedro
Speedro wrote:
Try having any variable image set. It won't work - or at least it will be very tedious as far as I'm aware. Setting an image on a label (works):

image='blah.dmi'

What I want to do but does not work with any variation I've tried:

image=[player.icon]

Confirmed To Work:

mob
icon = 'player.dmi'
Login()

var/image/I = "[icon]"
winset(src,"default.label1","image = [I]")

In response to Red Hall Dev
Why is it inappropriate? Having multiple Map controls is a feature not used enough. To me, they're much more flexible and it makes more sense to me in an object-oriented language to use an object instead of winset(). And maptext is much better than using an "extra label with 100% transparency."

In the code shown by the OP, he utilizes icon_state. You probably can't do that with a label unless you use the icon() proc, which is more trouble than it's worth.
In response to Kaiochao
Kaiochao wrote:
Why is it inappropriate? Having multiple Map controls is a feature not used enough. To me, they're much more flexible and it makes more sense to me in an object-oriented language to use an object instead of winset(). And maptext is much better than using an "extra label with 100% transparency."

In the code shown by the OP, he utilizes icon_state. You probably can't do that with a label unless you use the icon() proc, which is more trouble than it's worth.

You're right about map controls only if you're talking about using them for the in-game HUD. Otherwise they're very inefficient in comparison to a simple label.

As for icon_states, that depends on what OP wants to do. He never said. If he just wants to capture a single frame then icon() is by far his best option. I don't really understand your obsession with map objects.

If he wants to create a copy of his player, then that's definitely a map object solution.
In response to Red Hall Dev
You're giving absolutely zero reasons why HUD objects should be restricted to HUDs. They aren't inefficient; they're only updated when they're changed.

As I said in my post, the original poster's code example clearly shows use of icon_state.

It's not an obsession. You're just making an argument with absolutely nothing to back it up; I've only been repeating myself. I've actually only used this feature twice.
Either solution is fine, given the OP's spec. If you'd like to debate the various merits of when you feel each feature is appropriate for a given situation, please make a new topic in design philosophy and lay out your scenario properly, and quantify your performance arguments, should performance be one of your determining factors.
var/portrait=fcopy_rsc(player.icon)
winset(src,"WindowName.LabelName","image=\ref[portrait]")


Its not difficult to put an icon into a label, you just have to do it a specific way.