-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
801 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ build/ | |
cmake-build-debug/ | ||
.idea/ | ||
src/.vscode/ | ||
src/dmg_boot.gb | ||
roms/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[submodule "vendor/imgui/imgui"] | ||
path = vendor/imgui/imgui | ||
url = https://github.com/ocornut/imgui.git | ||
[submodule "vendor/glfw"] | ||
path = vendor/glfw | ||
url = https://github.com/glfw/glfw.git | ||
[submodule "vendor/glew-cmake"] | ||
path = vendor/glew-cmake | ||
url = https://github.com/Aviii06/glew-cmake.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,37 @@ | ||
#add_subdirectory(core) | ||
|
||
add_executable(${PROJECT_NAME} main.cpp) | ||
|
||
add_subdirectory(gui) | ||
set(SOURCES | ||
# ------- | ||
# Source Files | ||
cpu.cpp | ||
gameBoy.cpp | ||
mmap.cpp | ||
graphics.cpp | ||
core/cpu.cpp | ||
core/gameBoy.cpp | ||
core/mmap.cpp | ||
core/graphics.cpp | ||
# ------- | ||
# Header Files | ||
cpu.h | ||
gameBoy.h | ||
mmap.h | ||
types.h | ||
graphics.h | ||
core/cpu.h | ||
core/gameBoy.h | ||
core/mmap.h | ||
common/types.h | ||
core/graphics.h | ||
) | ||
|
||
target_sources(${PROJECT_NAME} PRIVATE ${SOURCES}) | ||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) | ||
find_package(SDL2 REQUIRED) | ||
include_directories(${SDL2_INCLUDE_DIRS}) | ||
|
||
file(COPY ../roms DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) | ||
|
||
if (MSVC) | ||
set_target_properties( | ||
${PROJECT_NAME} PROPERTIES | ||
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/") | ||
endif () | ||
|
||
target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARIES}) | ||
target_link_libraries(${PROJECT_NAME} gui_gbemu) | ||
|
||
set(SDL2_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/include") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#pragma once | ||
|
||
#include <cmath> | ||
|
||
// Structure to standardize the vertices used in the meshes | ||
struct Vec4 | ||
{ | ||
float x, y, z, w; | ||
|
||
Vec4() | ||
: x(0.0f) | ||
, y(0.0f) | ||
, z(0.0f) | ||
, w(0.0f) | ||
{ | ||
} | ||
|
||
Vec4(float x, float y, float z, float w) | ||
: x(x) | ||
, y(y) | ||
, z(z) | ||
, w(w) | ||
{ | ||
} | ||
|
||
Vec4 operator*(float scalar) { return Vec4(x * scalar, y * scalar, z * scalar, w * scalar); } | ||
|
||
Vec4 operator+(Vec4 other) { return Vec4(x + other.x, y + other.y, z + other.z, w + other.w); } | ||
}; | ||
|
||
struct Vec3 | ||
{ | ||
float x, y, z; | ||
|
||
Vec3() | ||
: x(0.0f) | ||
, y(0.0f) | ||
, z(0.0f) | ||
{ | ||
} | ||
|
||
Vec3(float x, float y, float z) | ||
: x(x) | ||
, y(y) | ||
, z(z) | ||
{ | ||
} | ||
|
||
Vec3(const Vec3& other) | ||
: x(other.x) | ||
, y(other.y) | ||
, z(other.z) | ||
{ | ||
} | ||
|
||
Vec3 operator*(float scalar) { return Vec3(x * scalar, y * scalar, z * scalar); } | ||
|
||
Vec3 operator+(Vec3 other) { return Vec3(x + other.x, y + other.y, z + other.z); } | ||
|
||
Vec3 operator-(Vec3 other) { return Vec3(x - other.x, y - other.y, z - other.z); } | ||
}; | ||
|
||
struct Vec2 | ||
{ | ||
float x, y; | ||
|
||
Vec2() | ||
: x(0.0f) | ||
, y(0.0f) | ||
{ | ||
} | ||
|
||
Vec2(float x, float y) | ||
: x(x) | ||
, y(y) | ||
{ | ||
} | ||
|
||
Vec2 operator*(float scalar) { return Vec2(x * scalar, y * scalar); } | ||
|
||
Vec2 operator*(double scalar) { return Vec2(x * scalar, y * scalar); } | ||
|
||
Vec2 operator+(Vec2 other) { return Vec2(x + other.x, y + other.y); } | ||
|
||
Vec2 operator-(Vec2 other) { return Vec2(x - other.x, y - other.y); } | ||
|
||
Vec2 Perpendicular() { return Vec2(-y, x); } | ||
|
||
Vec2 Normalize() | ||
{ | ||
float length = std::sqrt(x * x + y * y); | ||
return Vec2(x / length, y / length); | ||
} | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
set(SOURCES | ||
# ------- | ||
# Source Files | ||
cpu.cpp | ||
gameBoy.cpp | ||
mmap.cpp | ||
graphics.cpp | ||
# ------- | ||
# Header Files | ||
cpu.h | ||
gameBoy.h | ||
mmap.h | ||
../common/types.h | ||
graphics.h | ||
) | ||
|
||
target_sources(${PROJECT_NAME} PRIVATE ${SOURCES}) | ||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) | ||
find_package(SDL2 REQUIRED) | ||
include_directories(${SDL2_INCLUDE_DIRS}) | ||
|
||
if (MSVC) | ||
set_target_properties( | ||
${PROJECT_NAME} PROPERTIES | ||
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/") | ||
endif () | ||
|
||
target_link_libraries(${PROJECT_NAME} gui_gbemu) | ||
|
||
set(SDL2_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/include") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#include "types.h" | ||
#include "common/types.h" | ||
#include "cpu.h" | ||
#include <stdio.h> | ||
#ifndef DEBUG | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "types.h" | ||
#include "common/types.h" | ||
#include "mmap.h" | ||
#include "graphics.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "types.h" | ||
#include "common/types.h" | ||
#include <stdio.h> | ||
|
||
// The Memory Map for GBE | ||
|
Oops, something went wrong.