aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2023-12-30 12:32:35 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2023-12-30 12:32:35 +0530
commita9dd9bb87d64ec5a71f305639578db539d1fca2b (patch)
tree82e86ecd904cead1c953c6d8bd8ecf23dfdb485e
parent21c8277b0f98c0b282d6d96bca04161b0d8b0ebf (diff)
refactor
-rw-r--r--src/main.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 941072d..933e816 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -14,16 +14,16 @@ Platform pPlatform(
VIDEO_WIDTH, VIDEO_HEIGHT
);
-Chip8* pChip8;
+Chip8* chip8 = new Chip8();
void mainLoop() {
Platform* platform = &pPlatform;
- platform->ProcessInput(&pChip8->keypad);
+ platform->ProcessInput(&chip8->keypad);
usleep(2 * 1000);
- platform->ProcessInput(&pChip8->keypad);
- pChip8->Cycle();
- platform->Update(pChip8->video, 10);
+ platform->ProcessInput(&chip8->keypad);
+ chip8->Cycle();
+ platform->Update(chip8->video, 10);
}
#ifdef __EMSCRIPTEN__
@@ -48,22 +48,12 @@ int main(int argc, char** argv) {
#endif
- Chip8* chip8 = new Chip8();
Table* table = new Table(chip8);
chip8->SetTable(table);
chip8->LoadROM(filename);
- pChip8 = chip8;
-
- /* Platform platform(
- WINDOW_TITLE,
- VIDEO_WIDTH * videoScale,
- VIDEO_HEIGHT * videoScale,
- VIDEO_WIDTH, VIDEO_HEIGHT
- ); */
-
// std::thread timerThread(&Chip8::TimerUpdateThread, chip8, &platform);
#ifdef __EMSCRIPTEN__