{"id":13407219,"url":"https://github.com/axmandm/sgdk-title-screen","last_synced_at":"2025-03-14T11:31:07.276Z","repository":{"id":222853696,"uuid":"274512640","full_name":"axmandm/sgdk-title-screen","owner":"axmandm","description":null,"archived":false,"fork":false,"pushed_at":"2020-06-23T21:33:50.000Z","size":356,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-07-31T20:26:52.452Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Assembly","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/axmandm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-23T21:30:11.000Z","updated_at":"2024-01-08T16:57:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"0c5fae1f-fefe-401d-b86a-0089d394e59c","html_url":"https://github.com/axmandm/sgdk-title-screen","commit_stats":null,"previous_names":["axmandm/sgdk-title-screen"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axmandm%2Fsgdk-title-screen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axmandm%2Fsgdk-title-screen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axmandm%2Fsgdk-title-screen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axmandm%2Fsgdk-title-screen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/axmandm","download_url":"https://codeload.github.com/axmandm/sgdk-title-screen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243569353,"owners_count":20312413,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:00:30.316Z","updated_at":"2025-03-14T11:31:07.268Z","avatar_url":"https://github.com/axmandm.png","language":"Assembly","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"This builds on https://github.com/axmandm/sgdk-background-image, to add a title screen to our program.\n\nThis is the largest change yet, and a number of new functions are added, to simplify repetitive actions throughout.\n\nA new function is added centeredText, to calculate the correct position horizontally for messages on screen.\n\n```\n/*Draws text in the center of the screen, along with the vertical line position*/\nvoid centeredText(char s[], int v_pos){\n\tVDP_drawText(s, 20 - strlen(s)/2 ,v_pos);\n}\n```\n\nThis is used in conjunction with:\n\n```\n/*Define the text messages used in game, and a variable for vertical positioning*/\nint v_pos;\nchar msg_start[12] = \"Press Start\\0\";\nchar msg_author[16] = \"By Damian, 2020\\0\";\nchar msg_game_over[11] = \"Game Over!\\0\";\n```\n\nCalled as:\n\n`centeredText(msg_start, 21);`\n\nWhen a message is to be displayed on screen.\n\nWithin int main(), the loop is changed, to detect if the game is running, and the title has been displayed.\n\nDeclare some new variables at the top of main.c\n\n```\n/*Game running variable - used throughout to 'switch' based on if true*/\nbool game_running = FALSE;\nbool title_shown = FALSE;\n```\n\nAlter int main():\n\n```\nwhile (game_running == FALSE)\n{\n  TITLE CODE\n}\n```\nThe same method is used to call the title image as in https://github.com/axmandm/sgdk-background-image.\n\nSome code is added to clear the screen, which in future could be used to fade/wipe the screen between background images instead.\n\n```\n/*Clear the screen*/\nVDP_clearPlane(BG_A, 1);\nVDP_clearPlane(BG_B, 1);\nVDP_clearPlane(WINDOW, 1);\n```\n\nAlter handleJoyEvent to act differently in game, and at the title screen\n\n```\nif (game_running == FALSE)\n{\n  TITLE BUTTON HANDLING\n}\n```\n\nThe main loop is critical to making this all work - breaking out the different sections of the program into voids broke a number of things, including XGM audio.\n\nOccasionally, when there is a button press that triggers an audio stop, i.e. SND_stopPlay_XGM(); the audio will 'rush ahead' to catch up with the action taken. This can be got around by *pausing* the music instead.\n\n`XGM_pausePlay\t();`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxmandm%2Fsgdk-title-screen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxmandm%2Fsgdk-title-screen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxmandm%2Fsgdk-title-screen/lists"}