Author Topic: Hide "Display"s?  (Read 6532 times)

0 Members and 1 Guest are viewing this topic.

Offline MusicallyInspired

Hide "Display"s?
« on: June 05, 2007, 01:56:09 PM »
Is it possible to hide a display of words after a certain amount of cycles like you can with a view or is it maybe possible to wipe all displays on the screen if that's not possible?


Brass Lantern Prop Competition

Offline lskovlun

Re: Hide "Display"s?
« Reply #1 on: June 05, 2007, 02:54:10 PM »
Is it possible to hide a display of words after a certain amount of cycles like you can with a view or is it maybe possible to wipe all displays on the screen if that's not possible?
Yes, it's possible. You need to use the dsSAVEPIXELS and dsRESTOREPIXELS arguments to Display(). You can see how in my Keypad class - that class also demonstrates another trick that may be relevant to you: You can call Animate() with appropriate arguments to force a redraw of the screen.

Offline MusicallyInspired

Re: Hide "Display"s?
« Reply #2 on: June 05, 2007, 03:01:07 PM »
Nice. How then exactly do I implement those?

Also, I'm trying to hide the cursour as soon as the title screen appears until a certain case. I can't seem to find the code for that either.
Brass Lantern Prop Competition

Offline Doan Sephim

Re: Hide "Display"s?
« Reply #3 on: June 05, 2007, 04:22:10 PM »
First, you need to make a local variable (like, "htext")

Then, in the changeState method

Code: [Select]
(case 1 = seconds 1 // or cycles x
           = htext Display( 900 0 // text resource
                    dsCOORD 57 130
                    dsALIGN alCENTER
                    dsCOLOUR clCYAN
                    dsBACKGROUND clBLACK
                    dsWIDTH 200
                    dsSAVEPIXELS // saves the pixels the text overwrites
           )
)(case 2 = seconds 1 // or cycles x
           Display(
                    ""
                    dsRESTOREPIXELS htext // re-displays those pixels
           )
)

I think that should work. There is also an exaple of this in my march competition entry if you need more reference.

I'm not as sure about the cursor though...I'm sure there's a way, but I don't know it.
« Last Edit: June 05, 2007, 04:24:00 PM by Doan Sephim »
Artificial Intelligence Competition

Offline MusicallyInspired

Re: Hide "Display"s?
« Reply #4 on: June 06, 2007, 12:33:58 PM »
Doesn't seem to be working. Do I put the local variable for htext at the bottom where the instances are?
Brass Lantern Prop Competition

Offline Doan Sephim

Re: Hide "Display"s?
« Reply #5 on: June 06, 2007, 12:37:08 PM »
I tend to put the local variables here:
Code: [Select]
(include "sci.sh")
(include "game.sh")

(script 900)

(use "controls")
(use "cycle")
(use "feature")
(use "game")
(use "inv")
(use "main")
(use "obj")

(local

htext = 0
stateSwitch = 0

)

Offline MusicallyInspired

Re: Hide "Display"s?
« Reply #6 on: June 06, 2007, 01:04:01 PM »
It looks like it's messing up the text when I run the game. All I see is an "8" and a comma or something.

I have this at the top:

Code: [Select]
(use "main")
(use "game")
(use "menubar")
(use "obj")
(use "cycle")
(use "user")
(use "controls")
(use "feature")

(local
title1 = 0
title2 = 0
)

And this in my cases:

Code: [Select]
(method (changeState newState)
  = state newState
  (switch(state)
    (case 0
        (theRomance:
        init()
  )
  (theThrone:
  init()
  )
        (= title1 "SCI Pre-Alpha Version 1.0")
        Display(
@title1
            dsFONT 4
            dsCOORD 98 170
dsCOLOUR clMAROON
dsBACKGROUND clTRANSPARENT
dsSAVEPIXELS
  )
          (= title2 "By: Brandon Blume")
          Display(
          @title2
dsFONT 4
            dsCOORD 115 180
dsCOLOUR clMAROON
dsBACKGROUND clTRANSPARENT
dsSAVEPIXELS
  )  
          (theSpark1:
          init()
          setCycle(Fwd)
  )
          (theSpark2:
          init()
          setCycle(Fwd)
  )
  (theSpark3:
          init()
          setCycle(Fwd)
  )
  (theSpark4:
          init()
          setCycle(Fwd)
  )
  (theSpark5:
          init()
          setCycle(Fwd)
  )
  (theSpark6:
          init()
          setCycle(Fwd)
  )
  (theSpark7:
          init()
          setCycle(Fwd)
  )
  (theSpark8:
          init()
          setCycle(Fwd)
  )
          = seconds 10
    )
    (case 1
        (theRomance:
        dispose()
  )
        (theThrone:
        dispose()
  )
  Display(
  ""
  dsRESTOREPIXELS title1
  dsRESTOREPIXELS title2
  )
 
  = seconds 2
    )
    (case 2
        (buttonIntro:
        init()
  )
  (buttonBegin:
  init()
  )
  (buttonCred:
  init()
  )
  (buttonCont:
  init()
  )
    )
    )
)

What I've done before trying this was display text with the exact same words except black over the orignial so it looks like it's gone but really isn't.
« Last Edit: June 06, 2007, 01:10:28 PM by MusicallyInspired »
Brass Lantern Prop Competition

Offline Doan Sephim

Re: Hide "Display"s?
« Reply #7 on: June 06, 2007, 01:12:47 PM »
I'n not really familiar with using @title.

Instead of using
Code: [Select]
(= title1 "SCI Pre-Alpha Version 1.0")why not just put the "SCI Pre-Alpha Version 1.0" as a text resource?

Then to get it to display
Code: [Select]
= title1 Display( 800 0 // 800 is the title screen number and 0 is the first text resource
                    dsCOORD 57 130
                    dsALIGN alCENTER
                    dsCOLOUR clCYAN
                    dsBACKGROUND clBLACK
                    dsWIDTH 200
                    dsSAVEPIXELS // saves the pixels the text overwrites
             )

Or, if you don't want to use text resources:
Code: [Select]
= title1 Display( "SCI Pre-Alpha Version 1.0"
                    dsCOORD 57 130
                    dsALIGN alCENTER
                    dsCOLOUR clCYAN
                    dsBACKGROUND clBLACK
                    dsWIDTH 200
                    dsSAVEPIXELS // saves the pixels the text overwrites
            )

And for the disappearing act:
Code: [Select]
= title1 Display( "" dsRESTOREPIXELS htext)
I know I am not really working with what you are doing with your code, but I'n not really familiar with it, and I know the way I have it set up works.
« Last Edit: June 06, 2007, 01:16:41 PM by Doan Sephim »
Artificial Intelligence Competition

Offline MusicallyInspired

Re: Hide "Display"s?
« Reply #8 on: June 06, 2007, 01:52:16 PM »
Thank you! That seems to work. I was just getting the code messed up then.
Brass Lantern Prop Competition

Offline lskovlun

Re: Hide "Display"s?
« Reply #9 on: June 07, 2007, 05:27:52 AM »
Code: [Select]
 Display(
 ""
 dsRESTOREPIXELS title1
 dsRESTOREPIXELS title2
 )
I believe you can't have more than one RESTOREPIXELS in each call to Display().

Offline MusicallyInspired

Re: Hide "Display"s?
« Reply #10 on: June 07, 2007, 09:29:41 AM »
Yeah, I've already changed that. :)
Brass Lantern Prop Competition

Offline Cloudee1

Re: Hide "Display"s?
« Reply #11 on: January 30, 2011, 07:04:53 PM »
Nice. How then exactly do I implement those?

Also, I'm trying to hide the cursour as soon as the title screen appears until a certain case. I can't seem to find the code for that either.
Hey Brandon, there is one super dirty trick that I have come up with for hiding the cursor, when for some or other I feel the need ... splash screen or cutscene maybe. Anyway, just save one with nothing drawn on it. whenever you want to hide the cursor just set it to the invisible one.

you'll need to be damn sure that there isn't a chance though that they will need it before it becomes visible again, clicking on a button for instance would be really really hard to accomplish
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.024 seconds with 22 queries.