? GPAINT vs GFILL ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password
This website has been moved, please see this post

GPAINT vs GFILL

So here's something I've discovered when programming the light system for Wonderflonium. Pretty much, don't fill your entire screen with one color using GPAINT; use GFILL instead. To make the light system work, I am just making the screen dark and lighting up areas around light sources. To make the screen totally black, I used GPAINT at first. But this dropped the speed all the way down to an inconsistent 50 FPS, which caused all sorts of bad things like a BG flicker. But when I switched to GFILL, the program ran at a smooth 60 FPS, which looked so much better (especially since I have weapons animated with SPANIM.) I believe this is because GPAINT uses some sort of algorithm to find pixels of the same color, while GFILL only fills the specified area and doesn't have to check if it's allowed to fill certain pixels.
Author
rando
Updated
Rating
0 votes
Categories
Keywords
  • speed
  • gottagofast
  • sanic
  • optimization
7 Comment(s) MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Reading I like to read books! Hobbies Wait... Some people use GPAINT to clear the screen??? *Visible alarm* rando rando Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Second Year My account is over 2 years old Website Avatar Taboo I didn't change my avatar for 180 days Website What I did was GCLS then use GPAINT to make everything black, which was slow as heck snail_ snail_ Power User QSP Contest 1 Contest Participant I participated in the first SmileBASIC Source QSP Contest! Helper Received for being very helpful around SmileBASIC Source Achievements Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements GCLS color will clear the entire graphic page with the specified color. 12Me21 12Me21 Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Well, it's faster to use GFILL if you just need to fill the visible part of the screen GCLS:GPAINT 0,0,#RED: 70 per second GCLS #RED: 1200 per second GFILL 0,0,399,239,#RED: 2900 per second snail_ snail_ Power User QSP Contest 1 Contest Participant I participated in the first SmileBASIC Source QSP Contest! Helper Received for being very helpful around SmileBASIC Source Achievements Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements What if you use GCLIP? chicken chicken GCLIP 1,0,0,399,239 lets GCLS match GFILL. rando rando Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Second Year My account is over 2 years old Website Avatar Taboo I didn't change my avatar for 180 days Website 12me21 I actually used GCLS anyway Maybe I should change that... EDIT: It's changed and it works properly. The way I handle it is pretty much IF DAY THEN GCLS ELSE GFILL