il y a 6 ans
#include <Gamebuino-Meta.h> Image Sprites; Image Font("DrMario/font.bmp"); uint8_t PrevMode = -1; void setup() { gb.begin(); loadmode(0); } void loop() { while(!gb.update()); gb.display.clear(); //gb.display.print("hello, world"); switch (PrevMode){ case 0: //menu break; case 1: //in-game break; } } void loadmode(uint8_t Mode){ if(PrevMode != Mode){ if(PrevMode == -1){ } PrevMode = Mode; switch (Mode){ case 0: //menu Image Sprites("DrMario/menu.bmp"); break; case 1: //in-game Image Sprites("DrMario/ingame.png"); break; } } }
I'm having problems.
1) I don't trust that this is the correct way to re-use an Image variable. I'm worried it's redeclaring Sprites as a local variable
2) It doesn't like my switch case. I get "jump to case label [-fpermissive]" on "case 1: //in-game" in loadmode.
NEW il y a 6 ans
1) I don't trust that this is the correct way to re-use an Image variable. I'm worried it's redeclaring Sprites as a local variable
with myImage.init() and put in it the parameters you would use in the normal constructor
And as to sprite sheets....did you see https://gamebuino.com/creations/images the section "Sprite sheet & Tilemapper" ?
2) It doesn't like my switch case. I get "jump to case label [-fpermissive]" on "case 1: //in-game" in loadmode.
I am not entirely sure but you are trying to use locally defined (as in, inside the switch statement) variables outside
Also, please use code tags instead of quote for code
And then i also glanced over this:
Image Sprites("DrMario/ingame.png");
The library doesn't support PNGs
NEW il y a 6 ans
I switched to .init.
The documentation claimed it supports PNG, specifically because anything less than 50% visible would count as an invisible pixel. Only PNG supports transparency like that
The other issue seems to have gone away. Thank you, I'll keep the code tag in mind too
NEW il y a 6 ans
The documentation claimed it supports PNG, specifically because anything less than 50% visible would count as an invisible pixel. Only PNG supports transparency like that
Where is that? Must have been a mistake on my end. And BMP does support transparency, 32-bit depth BMPs ;)