GuiColorPickerHSV hue bar blinks while changing/dragging the color panel value

Aperta Adatta ai principianti
#587 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
74/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c
Ambito
frontend

Direzione di ricerca

Leggi l’implementazione di GuiColorPickerHSV mostrata nell’issue e verifica come GuiColorPanelHSV e GuiColorBarHue segnalano le modifiche e vengono renderizzati. Assicurati che la barra della tonalità venga chiamata a ogni frame preservando il risultato di changed, quindi prova il selettore dei colori trascinando sul pannello e conferma che la barra della tonalità non lampeggi più. Il parametro inutilizzato text è una questione separata sollevata nell’issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

int GuiColorPickerHSV(Rectangle bounds, const char *text, Vector3 *colorHsv)
{
    int result = RESULT_NONE;

    Vector3 tempHsv = { 0 };

    if (colorHsv == NULL)
    {
        const Vector3 tempColor = { 200.0f/255.0f, 0.0f, 0.0f };
        tempHsv = ConvertRGBtoHSV(tempColor);
        colorHsv = &tempHsv;
    }

    result = GuiColorPanelHSV(bounds, NULL, colorHsv);

    Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height };

    if (result == RESULT_NONE) result = GuiColorBarHue(boundsHue, NULL, &colorHsv->x);

    return result;
}

When GuiColorPanelHSV returns RESULT_CHANGED the later call to GuiColorBarHue never happens, this causes the hue bar to not be rendered for that frame and thus causing blinking while dragging the mouse over the color panel.

In my zig code I ported the function and implemented this change:

const second_result = ray.GuiColorBarHue(bounds_hue, null, &color_hsv.x);
if (result == ray.RESULT_NONE) result = second_result;

Which would be equivalent to:

int secondResult = GuiColorBarHue(boundsHue, NULL, &colorHsv->x);
if (result == RESULT_NONE) result = secondResult;

I am not sure whether there is another better solution, but at least this allows both functions to return changed without a previous changed being overwritten with none and always call the GuiColorBarHue function to make sure it is rendered.


I also noticed the text parameter is unused, why is it there and should it be used?

Lingua principale
C
Stelle
5.3k
Fork
410
Merge medio
1g 22h
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di raysan5/raygui

Tutte le issue di raysan5/raygui

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.