-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
77 lines (62 loc) · 1.37 KB
/
Copy pathmain.cpp
File metadata and controls
77 lines (62 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <unistd.h>
#include <string.h>
#include "gb.h"
gb cpu;
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <iostream>
#include <dirent.h>
#include <stdio.h>
using namespace std;
void updateInput()
{
}
#define PIXEL_SIZE 2
int main(int argc, char** argv)
{
sf::RenderWindow window(sf::VideoMode(SCR_W*PIXEL_SIZE,
SCR_H*PIXEL_SIZE),
"gaemboy. HYPER ALPHA VERSION v0.001a");
sf::RectangleShape shape;
shape.setSize(sf::Vector2f(PIXEL_SIZE, PIXEL_SIZE));
shape.setFillColor(sf::Color::White);
cpu.init();
if (argc > 1)
{
if (strcmp(argv[1], "-d") == 0)
cpu.dbg_mode = true;
if (strcmp(argv[1], "-dl") == 0) {
cpu.dbg_mode = true;
cpu.dbg_stepby = true;
}
if (strcmp(argv[1], "-l") == 0)
cpu.dbg_stepby = true;
}
//char* rom = argv[2];
//char gamepath[6+strlen(argv[2])+1];
//strcpy(gamepath, "gaems/");
//strcat(gamepath, argv[2]);
cpu.load("mario.gb");
//sf::Clock clock;
//sf::Time dt;
unsigned char ff = 0;
//clock.restart();
while(1)
{
// updateInput();
cpu.cycle();
if (!cpu.lcd_draw_flag) continue;
cpu.lcd_draw_flag = false;
for (int y = 0; y < SCR_H; ++y)
{
for (int x = 0; x < SCR_W; ++x)
{
shape.setFillColor(sf::Color(ff-x,ff-y,ff++,255));
shape.setPosition(x*PIXEL_SIZE,y*PIXEL_SIZE);
window.draw(shape);
}
}
window.display();
// cpu.req_int(0);
}
}