Les membres ayant 30 points peuvent parler sur les canaux annonces, projets et hs du chat.
La shoutbox n'est pas chargée par défaut pour des raisons de performances. Cliquez pour charger.

Forum Casio - Autres questions


Index du Forum » Autres questions » Problème d'affichage, clignotements.
Magister Hors ligne Membre Points: 3 Défis: 0 Message

Problème d'affichage, clignotements.

Posté le 18/03/2022 23:21

Bonjour !

Je viens à peine de commencer à apprendre comment faire de petits programmes sur ma calculatrice Casio 35+, pour m'amuser. Cependant, sur certains de mes "jeux", je n'arrive pas à afficher certaines choses correctement. J'ai déjà cherché si des articles avaient déjà été rédigé, mais je n'ai rien trouvé. En gros, voilà ce que ça donne théoriquement:

X et Y sont des coordonnées
Lbl 1
Izs X
Izs Y
Cls
Text Y,X,"Texte"
Goto 1
(j'ai fais une version très très simplifiée, c'est juste pour illustrer mon problème de toute façon)

Le problème, c'est que en affichant le texte, il reste une trace sur l'écran, donc je le clear pour pouvoir réafficher ensuite. Mais, cela provoque un clignotement pas très fluide, et pas joli pour ce que je veux faire. Vous sauriez comment régler ce problème s'il vous plait ?


Redcmd Hors ligne Membre Points: 380 Défis: 7 Message

Citer : Posté le 19/03/2022 01:05 | #


That shouldn't cause any flashing
Cls does not update the display, only the vram
and that code runs very fast on my calculator

You're not mixing up Cls with ClrText and Text with Locate are you?
ClrText and Locate are for Text Mode
Cls and Text are for Graphical Mode
Lephenixnoir Hors ligne Administrateur Points: 24234 Défis: 170 Message

Citer : Posté le 19/03/2022 09:00 | #


Cls does not update the display, only the vram

It absolutely does; everything in Casio BASIC is direct-mode, with an update at every command. You might remember it's one of its main flaws


Le problème, c'est que en affichant le texte, il reste une trace sur l'écran, donc je le clear pour pouvoir réafficher ensuite. Mais, cela provoque un clignotement pas très fluide, et pas joli pour ce que je veux faire. Vous sauriez comment régler ce problème s'il vous plait ?

Il n'y a pas de façon "simple" d'effacer une portion de l'écran. Le plus commun, en fait c'est d'écrire des espaces avec Text pour effacer des carrés de 3×5.

Ce que tu peux faire dans ton cas, c'est simplement :

Lbl 1
Text Y,X, "     "
Isz X
Isz Y
Text Y,X,"Texte"
Goto 1

Note que si tu te déplaçais uniquement en X tu pourrais écrire directement " Texte" (espace au début) ou "Texte " (espace à la fin) pour effacer ta trace.

Et sur une note tout à fait indépendante, je suggère d'utiliser des boucles For/While autant que possible, le Goto ça ne t'emmènera pas très loin en comparaison
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Massena Hors ligne Ancien rédacteur Points: 2219 Défis: 11 Message

Citer : Posté le 19/03/2022 09:02 | #


J'avais déjà testé ce matin, ça ne change rien pour l'affichage de "Texte", ça clignote toujours autant.
C'est surtout parce que le texte se déplace rapidement donc on le voit mal à cause de l'écran, je crois pas qu'on puisse y faire grand chose ^^'
Lephenixnoir Hors ligne Administrateur Points: 24234 Défis: 170 Message

Citer : Posté le 19/03/2022 09:05 | #


Ah ! J'avais pas pensé à ça. Oui si la boucle va tellement vite que le texte reste effacé plus longtemps qu'il ne reste affiché, ça ne risque pas d'aller. J'ai supposé qu'il faisait des trucs plus compliqués... :x

J'ai pas la calto pour tester là tout de suite mais si tu réarranges peut-être que ça va un poil mieux ?

Lbl 1
Isz X
Isz Y
Text Y-1,X-1,"      "
Text Y,X,"Texte"
// Voire insérer un For ici
Goto 1

Mais effectivement je connais pas de solution sérieuse aux problèmes de timings qui apparaissent ensuite x)
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Redcmd Hors ligne Membre Points: 380 Défis: 7 Message

Citer : Posté le 19/03/2022 11:59 | #


Lephenixnoir a écrit :
It absolutely does; everything in Casio BASIC is direct-mode, with an update at every command. You might remember it's one of its main flaws

Almost every display command updates the screen
two commands I know that don't follow this rule is cls and BG-Pict
and I don't think BG-Pict actually updates the vram
I think cls writes the background to vram, with BG-None (aka BG-Pict 0) being hardcoded to blank (or just a seperate clear vram function)
https://www.planet-casio.com/Fr/forums/topic15950-1-effacer-un-pixel-dessine-par-le-drawstat.html#170535
https://www.planet-casio.com/Fr/forums/topic15950-1-effacer-un-pixel-dessine-par-le-drawstat.html#170545

By 'flashing', do you mean ghosting?
where you are able to see the text multiple times because the display is slow?
or is the text moving too fast that it appears gray instead of black?
you can slow down the program with just a For 1->T To 50: Next loop
Magister Hors ligne Membre Points: 3 Défis: 0 Message

Citer : Posté le 19/03/2022 18:46 | #


Redcmd a écrit :

By 'flashing', do you mean ghosting?
where you are able to see the text multiple times because the display is slow?
or is the text moving too fast that it appears gray instead of black?
you can slow down the program with just a For 1->T To 50: Next loop


I mean that the text is displayed but its removed right after, so it becomes gray, and it repeats itself. Can you explain me what you mean by "slow down the program" ?

Lephenixnoir a écrit :

Lbl 1
Isz X
Isz Y
Text Y-1,X-1,"      "
Text Y,X,"Texte"
Goto 1



Alors, j'ai essayé, mais le problème persiste. Par contre, jme suis dis que ça serait mieux d'effacer le texte après l'avoir affiché. Donc plutôt quelque chose comme ça:
Lbl 1
Isz X
Isz Y
Text Y,X,"Texte"
Text Y-1,X-1,"      "
Goto 1

Mais ça marche pas non plus ahah
Redcmd Hors ligne Membre Points: 380 Défis: 7 Message

Citer : Posté le 19/03/2022 21:49 | #


Sorry I had my calculator overclocked
I now see what you're concerned about

I unclocked it and noticed something very peculiar (was super painful to navigate)
display commands write the vram to screen once before their operation, then they do it again after their operation

So whats happening with you program is the cls command clears vram only, it does not copy the vram to the display
Then the Text copies vram to the display, writes the string "Texte" to the vram, then copies the vram to the display
This is whats causing the flickering

Copying from vram to screen is already very slow, and now I realise that basic does it twice per draw command!
and from what I can see, Text mode (Locate X, Y, "Texte"), does not have this issue
which would explain why its just that little bit faster

I also just noticed that F-Line updates the screen after every single pixel
so a line of 127 pixels would update the screen 128 times!! (maybe even 129 times)
Text does draw the entire text to vram first before updating the screen. so its only twice (that I can see)
Lephenixnoir Hors ligne Administrateur Points: 24234 Défis: 170 Message

Citer : Posté le 19/03/2022 21:54 | #


I also just noticed that F-Line updates the screen after every single pixel
so a line of 127 pixels would update the screen 128 times!! (maybe even 129 times)

Are you sure about this one? I just compared rendering 63 lines of length 2 vs. 63 lines of length 127, and there is no appreciable difference in performance. Considering updating the display (1-2.5 ms) is much slower than drawing some pixels (couple of µs), I should have observed a 60x slowdown.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Redcmd Hors ligne Membre Points: 380 Défis: 7 Message

Citer : Posté le 20/03/2022 08:20 | #


Im not sure
maybe underclocking messes with too many things


Heres a small video showcasing it
Notice how the screen is cleared instantly
and also how both lines are drawn from two different sides
But the line takes quite some time to complete
maybe the screen refresh is done on an interrupt
and when I was navigating the menu's the whole screen almost gets drawn instantly (maybe a 100ms delay)

0 → Y
Lbl 0
Cls
F-Line 127, Y, 1, Y
Isz Y
F-Line 1, Y, 127, Y
Goto 0

Lephenixnoir Hors ligne Administrateur Points: 24234 Défis: 170 Message

Citer : Posté le 20/03/2022 08:49 | #


Sounds like an regular/interrupt-based refresh is possible. Clearly the lines are drawn from different sides at least. But this looks super-slow for a single line. How fast is the calculator/video here?
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Redcmd Hors ligne Membre Points: 380 Défis: 7 Message

Citer : Posté le 20/03/2022 09:16 | #


The calculator has been underclocked to 0.23MHz from its normal 29.49MHz
The video is at normal speed 1x
Lephenixnoir Hors ligne Administrateur Points: 24234 Défis: 170 Message

Citer : Posté le 20/03/2022 09:47 | #


Ah, that's the problem. With a 100x slowdown, the transfer time to the VRAM, which is at least 1 ms, probably takes around 100 ms, during which the display refreshes at least 6 times. That doesn't explain why the lines appear in rendering order, but I'm pretty sure twisting the CPU speed/display speed factor this much is a general problem.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)

LienAjouter une imageAjouter une vidéoAjouter un lien vers un profilAjouter du codeCiterAjouter un spoiler(texte affichable/masquable par un clic)Ajouter une barre de progressionItaliqueGrasSoulignéAfficher du texte barréCentréJustifiéPlus petitPlus grandPlus de smileys !
Cliquez pour épingler Cliquez pour détacher Cliquez pour fermer
Alignement de l'image: Redimensionnement de l'image (en pixel):
Afficher la liste des membres
:bow: :cool: :good: :love: ^^
:omg: :fusil: :aie: :argh: :mdr:
:boulet2: :thx: :champ: :whistle: :bounce:
valider
 :)  ;)  :D  :p
 :lol:  8)  :(  :@
 0_0  :oops:  :grr:  :E
 :O  :sry:  :mmm:  :waza:
 :'(  :here:  ^^  >:)

Σ π θ ± α β γ δ Δ σ λ
Veuillez donner la réponse en chiffre
Vous devez activer le Javascript dans votre navigateur pour pouvoir valider ce formulaire.

Si vous n'avez pas volontairement désactivé cette fonctionnalité de votre navigateur, il s'agit probablement d'un bug : contactez l'équipe de Planète Casio.

Planète Casio v4.3 © créé par Neuronix et Muelsaco 2004 - 2024 | Il y a 87 connectés | Nous contacter | Qui sommes-nous ? | Licences et remerciements

Planète Casio est un site communautaire non affilié à Casio. Toute reproduction de Planète Casio, même partielle, est interdite.
Les programmes et autres publications présentes sur Planète Casio restent la propriété de leurs auteurs et peuvent être soumis à des licences ou copyrights.
CASIO est une marque déposée par CASIO Computer Co., Ltd