#178239 - NeonHB - Thu Oct 16, 2014 4:23 am
Hi, my name is NeonHB and yesterday I signed up here in an attempt to seek for help with certain issues that I'm going through in Visual HAM. I'm new to making homebrew, and this is my first legit project that I'm trying to finish. What I'm trying to create is a short fiction in homebrew form, so it's not really a game, but rather a story. The story is already written in a text file in my PC, and I already have the main menu and the first few pages done along with the designs, fonts, and some of the code. Since all the text and designs are on the actual images themselves, it's only a matter of displaying images depending on the input received.
[Images not permitted - Click here to view it]
Home Menu above.
[Images not permitted - Click here to view it]
Page1 above.
[Images not permitted - Click here to view it]
Page2 above.
As shown on the images above, that's what I've passed over so far from the text file to the homebrew. The issue lies in the input and the brightness. I'm trying to make it so that every time you flip pages on the GBA, it fades from normal to dark and from dark to normal again, revealing the next page during the process. I looked through the Visual HAM samples, ripped out the code that works with the brightness from the brightness sample, and implemented it into my code to figure it out. It does something, but not the way I want it to.
You can download a ROM showing the brightness issue below. It's programmed to loop the fade in the main menu when you hold the A button. To me it seems like it fades really fast, giving a distorted/static effect. I'm not entirely sure.
download ROM with brightness issue
My other issue relates to the input. When you press a button to flip a page, it'll flip more pages than wanted in a rapid speed as if you were holding the button instead of tapping it. I thought of implementing a timer and having it count one second between image flips to prevent it from going so fast but I couldn't figure out the timer sample, nor do I think that it works because it doesn't even compile as-is and instead gives cryptic errors. The fade isn't a big killer for me but I'd at least like to figure out the rapid input/image flip. After I figure that out I can continue to pass over the story, start working on sounds and polish whatever needs to be polished at the time.
download ROM with input issue
Also, I have two separate programs despite them being the same exact homebrew to make it easier to figure out what's wrong. Below I'll leave the code for both programs.
Program with brightness-fade issue:
Program with rapid input issue:
Any help is appreciated.
[Images not permitted - Click here to view it]
Home Menu above.
[Images not permitted - Click here to view it]
Page1 above.
[Images not permitted - Click here to view it]
Page2 above.
As shown on the images above, that's what I've passed over so far from the text file to the homebrew. The issue lies in the input and the brightness. I'm trying to make it so that every time you flip pages on the GBA, it fades from normal to dark and from dark to normal again, revealing the next page during the process. I looked through the Visual HAM samples, ripped out the code that works with the brightness from the brightness sample, and implemented it into my code to figure it out. It does something, but not the way I want it to.
You can download a ROM showing the brightness issue below. It's programmed to loop the fade in the main menu when you hold the A button. To me it seems like it fades really fast, giving a distorted/static effect. I'm not entirely sure.
download ROM with brightness issue
My other issue relates to the input. When you press a button to flip a page, it'll flip more pages than wanted in a rapid speed as if you were holding the button instead of tapping it. I thought of implementing a timer and having it count one second between image flips to prevent it from going so fast but I couldn't figure out the timer sample, nor do I think that it works because it doesn't even compile as-is and instead gives cryptic errors. The fade isn't a big killer for me but I'd at least like to figure out the rapid input/image flip. After I figure that out I can continue to pass over the story, start working on sounds and polish whatever needs to be polished at the time.
download ROM with input issue
Also, I have two separate programs despite them being the same exact homebrew to make it easier to figure out what's wrong. Below I'll leave the code for both programs.
Program with brightness-fade issue:
Code: |
// Includes the main Visual HAM header file. #include <mygba.h> // Includes the image and palette of the Home Menu. #include "C:/Users/Neon/Documents/Melody/Home/Home.pal.c" #include "C:/Users/Neon/Documents/Melody/Home/Home.raw.c" //Global Variables Below. All three are taken from the Visual Ham brightness sample. u32 g_Frames=0; u8 g_NewFrame=1; u8 g_BrightIntensity=16; int main(){ bool key_pressed = 0; ham_Init(); // Sets background mode to four. ham_SetBgMode(4); // Loads Home Menu image and palette. Also Flips Home Menu Image. ham_LoadBGPal((void*)Home_Palette,256); ham_LoadBitmap((void*)Home_Bitmap); ham_FlipBGBuffer(); // While A is pressed the fade will start to loop. while(key_pressed == 0){if (F_CTRLINPUT_A_PRESSED){ // Visual HAM Brightness sample starts here. // Loop // Its a new frame? if(g_NewFrame) { // Just to skip some frames if(!(g_Frames&7)) { // Fade screen from normal to black if((g_BrightIntensity >= 32) && (g_BrightIntensity < 48)) { ham_SetFxMode(FX_LAYER_SELECT(1,1,1,1,1,0), // Source layer FX_LAYER_SELECT(0,0,0,0,0,0), // Target layer FX_MODE_DARKEN); // Effect mode // Set the intensity of the source and target layer ham_SetFxBrightnessLevel(g_BrightIntensity&15); // intensity } else // Fade screen from black to normal // Set the intensity of the source and target layer ham_SetFxBrightnessLevel(64-g_BrightIntensity); // intensity } else g_BrightIntensity=0; // Increase bright helper variable g_BrightIntensity++; } } } return 0; } |
Program with rapid input issue:
Code: |
//Includes the main Visual HAM header file.
#include <mygba.h> // Includes the images and palettes of the Home Menu, Page 1 and Page 2. #include "C:/Users/Neon/Documents/Melody/Home/Home.pal.c" #include "C:/Users/Neon/Documents/Melody/Home/Home.raw.c" #include "C:/Users/Neon/Documents/Melody/Page1/Page1.pal.c" #include "C:/Users/Neon/Documents/Melody/Page1/Page1.raw.c" #include "C:/Users/Neon/Documents/Melody/Page2/Page2.pal.c" #include "C:/Users/Neon/Documents/Melody/Page2/Page2.raw.c" int main() { bool key_pressed = 0; ham_Init(); // Sets up the background mode to four. ham_SetBgMode(4); // Loads Home Menu image and palette. Also Flips Home Menu Image. ham_LoadBGPal((void*)Home_Palette,256); ham_LoadBitmap((void*)Home_Bitmap); ham_FlipBGBuffer(); while (key_pressed ==0) // If any button is pressed in the Home Menu, it will go to page 1. { if (F_CTRLINPUT_A_PRESSED || F_CTRLINPUT_B_PRESSED || F_CTRLINPUT_UP_PRESSED || F_CTRLINPUT_DOWN_PRESSED || F_CTRLINPUT_LEFT_PRESSED || F_CTRLINPUT_RIGHT_PRESSED || F_CTRLINPUT_START_PRESSED || F_CTRLINPUT_SELECT_PRESSED || F_CTRLINPUT_L_PRESSED || F_CTRLINPUT_R_PRESSED) { // Loads Page1 image and palette. Also Flips Page1 Image, assuming that any button was pressed in the Home Menu. ham_LoadBGPal((void*)Page1_Palette,256); ham_LoadBitmap((void*)Page1_Bitmap); ham_FlipBGBuffer(); // If R is pressed, it will load Page 2 from within Page 1. if (F_CTRLINPUT_R_PRESSED) { // Loads Page2 image and palette. Also Flips Page2 Image, assuming that R was pressed in Page 1 ham_LoadBGPal((void*)Page2_Palette,256); ham_LoadBitmap((void*)Page2_Bitmap); ham_FlipBGBuffer(); } } } return 0; } // End of main() |
Any help is appreciated.