Opened 15 years ago

Closed 15 years ago

Last modified 6 years ago

#7740 closed feature request (wontfix)

Common::Line

Reported by: m-kiewitz Owned by: fingolfin
Priority: normal Component: Engine: SCI
Version: Keywords:
Cc: Game:

Description

Hi there,

Could someone please implement some basic Common::Line somewhat like Common::Rect? Then I could use that for the new sci gui code.

Regards M. Kiewitz

Ticket imported from: #2869872. Ticket imported from: feature-requests/556.

Change History (10)

comment:1 by bluegr, 15 years ago

Er... we do have such functionality in graphics/primitives.h (drawLine and drawThickLine), which is already used by the SCI engine

Please ask in -devel first next time :)

Closing as invalid

comment:2 by bluegr, 15 years ago

Resolution: invalid
Status: newclosed

comment:3 by lordhoto, 15 years ago

I'm not sure whether this is for drawing lines though, the request could be for a generic data type representing lines.

It could probably be easily achieved by using two Common::Point entries for the two points defining a line and the some helpers for checking whether it's horizontal / vertical / non of both etc. Anyway the description of what the new Common::Line data type should achieve is missing, thus before you tell us what exactly it should contain and feature I guess there's nothing we can do about it.

Also of course I do not see what prevents you from just introducing the data type yourself. You could after all either first only include it in the SCI code base or just post a tracker to the patch tracker, so we can talk whether it's fine for inclusion in the common code base.

comment:4 by m-kiewitz, 15 years ago

It's not for drawing lines but for using it as parameter in functions like Common::Rect. I'm already using that for rectangles (instead of rect_t) and I would like to use a similar one for lines. Line-Drawing is critical in SCI, so I have to do it by myself anyway..

Of course I could make my own Common::Line, but then I would just use 2 Common::Points together. I don't know who does the common stuff and I would really like someone more experienced in ScummVM do it. I mean this could get used by other engines as well and I don't know those at all.

comment:5 by lordhoto, 15 years ago

Resolution: invalid
Status: closednew

comment:6 by lordhoto, 15 years ago

Actually in theory everyone could touch common code in ScummVM ;-).

Anyway as you describe it, your idea of Common::Line is just to hold the two coordinates defining the line? I do not see anything bad about doing a struct Common::Line with two Common::Point members here. You could also add some constructors for creating a Common::Line via 4 ints (means two sets of coordinates) or 2 Common::Point (also two coordinates).

Some things, which could be features by Common::Point, one could consider might be: - check whether it's horizontal / vertical - length (probably overkill for our use ;-) - collision - ...

About the reuse value for other engines: It seems so far none needed this (or they did just define their own types ;-). So I doubt there's any advantage in not thinking yourself about what a possible Common::Line, which could be used by most/all engines in ScummVM, contain and what not. Also of course someone, who does need such a data type might give more helpful feedback what it should feature than someone who does not need it at all. After all our code in common/ etc. isn't designed for every use case out there, but rather towards what our engines / backends needs. So if you want to let the people doing "the common stuff" worry about how it should look, you should at least tell them what you exactly need in the data structure (and if possible any other engine developer out there, who also want to take advantage of it), so it can be decided what the data structure will feature in the end.

comment:7 by fingolfin, 15 years ago

I see no purpose in a Common::Line class. First off, no other engine needs it, so if you write a Line class, keep it local to SCI.

Secondly, I don't even see the need for this in SCI -- just pass start and end point... Or name 1-2 examples where a Line class provides any advantage.

comment:8 by m-kiewitz, 15 years ago

Well, will make it local to my SciGUIgfx.

About Line class: clipping could get done via a line class. Of course, when making it local it won't matter. I can then just write a method and pass a structure.

comment:9 by fingolfin, 15 years ago

Owner: set to fingolfin
Resolution: wontfix
Status: newclosed

comment:10 by digitall, 6 years ago

Component: Engine: SCI
Note: See TracTickets for help on using tickets.