Drawing on GUIs (SOLVED)

Started by Gord10, Mon 25/01/2010 22:16:17

Previous topic - Next topic

Gord10

My apologies in case this topic belongs to Beginners Technical Problems, I couldn't be sure of it. My main question/problem is about drawing on GUI's and/or how to use dynamic sprites for them.

What I want to do is simple: A quest log book that keeps our goals, whether finished or to be. Finished quests are struckthrough as in the example.



I managed to create a quest book that works the way I want, but I'm not satisfied with the way the text is struckthrough: The line is as long as the whole width, instead of the text. It is because the texts are actually unpressable buttons whose backgrounds are changed according on the condition of the quest. I am unable to change the visible width of this sprite that contains the strikingthrough line, it seems. Everything could be perfect if I used dynamic sprites and drawing surfaces.

My solution is to prepare a struckthrough font. But I know I am going to need to learn how to draw a GUI inside the game. I have tried to use dynamic sprites as permanent GUI sprites, but it seem to contravane to the nature of dynamic sprites?
Games are art!
My horror game, Self

skuttleman

It seems to me it might be easier to import a font identical to the one you're using in your example, where all the characters have a line through them. Then all you have to do is change the font number for completed quests.

Khris

In order to use DynamicSprites as button or GUI backgrounds, they have to be defined outside any function (otherwise they are destroyed as soon as the function finishes, ending the element that uses them up at displaying sprite 0/the blue cup).

Shane 'ProgZmax' Stevens

If this is only for specific cases you could always draw the crossed and un-crossed out versions in a paint program and import them as graphics to use for button.NormalGraphic.  Another option would be to place another unclickable button at a higher z-order than the ones you use for the quest titles and then load in a line graphic to the button when the quest is finished.  This way you could even animate it drawing across the topic.

SSH

My Hypertext module has a strikethrough option:

Hypertext.SetPrefixStyle('-', fontnum, eHypertextSpecial_Strikethrough);

and then you just use Hypertext.ShowOnButton(questButtonThree, "-Struck through text-") to apply. Although, I haven't tested it on very recent AGSes.
12

Gord10

Thank you all! The whole problem was dynamic sprites and drawing surfaces being defined inside functions, as Khris stated. Now I'm able to use struckthrough button backgrounds after defining them in a global life scope.

@skuttleman: Yes, that was what we would do in case I couldn't manage drawing lines.
@ProgZmax: The first is a good idea, too, but has some obvious disadvantages that we would avoid in this project. The second wouldn't do any different than what I have accomplished before starting this thread, unless the visible line width can be changed.
@SSH: Unfortunately I couldn't work the module for the recent AGS, but the codes itself gave me some ideas for a future usage.
Games are art!
My horror game, Self

Khris

Although it doesn't really make a difference, DrawingSurfaces can safely be declared inside the function.

Shane 'ProgZmax' Stevens

If you made the topmost button the max width of the topic and then loading in the appropriate line graphic for that topic it would work fine, yes.  It would also be trivial to implement.

SMF spam blocked by CleanTalk