19928/jj_vitp/Implementation/support/vitp_text.e
Jocelyn Fiat 6dde6425c2 init
2024-06-17 09:09:33 +02:00

68 lines
1.3 KiB
Plaintext

note
description: "[
All(?) text in VITP is represented by this class.
This can then be associated with a widget.
]"
author: "Jimmy J. Johnson"
class
VITP_TEXT
inherit
VITP_ITEM
rename
make as vitp_item_make
redefine
hash_code
end
create
make
feature {NONE} -- Initialization
make (a_item: like item)
-- Create text that is associated with `a_item'
require
item_exists: a_item /= Void
do
vitp_item_make (a_item.name)
item := a_item
end
feature -- Access
item: VITP_ITEM
-- The game item to which the Current text is associated
name_text: STRING
-- The name of the `item'
do
Result := item.name
end
suffix: STRING
-- This is added to the name of a VITP string so it can be created
-- with the object in which the string should be placed, using the
-- name of the object as the key (on creation).
-- When searching a hash table for the text you must add `suffix' to
-- the name.
do
Result := " text"
end
hash_code: INTEGER
-- Code based on `name' with the string `suffix' added on
-- This prevents a collision with the text that is named the same as
-- the game object on which the text resides.
do
Result := (name + suffix).hash_code
end
invariant
item_exists: item /= Void
end