[02 Mar 2006] doing realtime status update

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
GMKai
Posts: 160
Joined: Mon Feb 15, 2010 10:58 am

[02 Mar 2006] doing realtime status update

Post by GMKai »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 02 Mar 2006 08:36:40 +0100

Hello,

I have an status bar which is done by Textobjects,

but display is destroyed when changes are submitted, as it is not cleared correctly. this is the responsible code:

Code: Select all

Function p_StatusBarUpdate()
    Undo(#Textobject,6)
    Undo(#Textobject,7)
    Undo(#Textobject,8)
    FreeTextObject(6)
    FreeTextObject(7)
    FreeTextObject(8)
    Switch shootonscreen
     Case 0:
        Undo(#Brush,4)
        FreeBrush(4)
        CreateBrush(4,150,Height-18-350,#green)
        MixBrush(4,5,"0%")
     Case 5:
        Undo(#Brush,4)
        FreeBrush(4)
        CreateBrush(4,150,Height-18-350,#green)
        MixBrush(4,5,"25%")
     Case 10:
        Undo(#Brush,4)
        FreeBrush(4)
        CreateBrush(4,150,Height-18-350,#green)
        MixBrush(4,5,"50%")
     Case 15:
        Undo(#Brush,4)
        FreeBrush(4)
        CreateBrush(4,150,Height-18-350,#green)
        MixBrush(4,5,"75%")
     Case 20:
        MixBrush(4,5,"100%")
    EndSwitch
    DisplayBrush(4,RBorder,#Bottom)
    CreateTextObject(6,Lives)
    CreateTextObject(7,CurrentLevel)
    CreateTextObject(8,Score)
    DisplayTextObject(6,RBorder,68)
    DisplayTextObject(7,RBorder,168)
    DisplayTextObject(8,RBorder,268)
EndFunction
User avatar
airsoftsoftwair
Posts: 5914
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[04 Mar 2006] Re: doing realtime status update

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Sat, 04 Mar 2006 23:47:52 +0100

Could you be a bit more specific? What does not work correctly?
GMKai
Posts: 160
Joined: Mon Feb 15, 2010 10:58 am

[06 Mar 2006] Re: doing realtime status update

Post by GMKai »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 06 Mar 2006 10:59:30 +0100

Hello,

what goes wrong, is that the values are overwritten instead of replaced, which I don't get as I try to "undo" and "free" the values before writing new ones. The coloured bar on the bottom works fine. What helped was to bring a new brush over the status-area but that lead to flickering display there. Any help?
User avatar
airsoftsoftwair
Posts: 5914
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[08 Mar 2006] Re: doing realtime status update

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Wed, 08 Mar 2006 11:53:06 +0100
Hello,

what goes wrong, is that the values are overwritten instead of replaced, which I don't get as I try to "undo" and "free" the values before writing new ones. The coloured bar on the bottom works fine. What helped was to bring a new brush over the status-area but that lead to flickering display there. Any help?
The problem must be somewhere else. I tested the code snippet and it works fine here. However, it's a bit awkward. Using layers is not a good idea when you have to do screen updates. I would suggest to turn layers off, use sprites for the objects that move, and simple brushes for the status bar. To update the status bar, just draw the background + text to a brush (using SelectBrush()) and display this brush then. Using this way you can update the whole status bar with just one call to DisplayBrush() and there will be no flickering whatsoever.
Locked