-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added the basest of the base window creation, pulled in GLFW as a dep…
…endency
- Loading branch information
Israfil
committed
Feb 8, 2025
1 parent
d7be82e
commit 0bb385f
Showing
10 changed files
with
215 additions
and
12 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 |
---|---|---|
@@ -0,0 +1,112 @@ | ||
--- | ||
BasedOnStyle: LLVM | ||
IndentAccessModifiers: true | ||
AccessModifierOffset: 0 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlines: Right | ||
InsertNewlineAtEOF: true | ||
AlignOperands: true | ||
AlignTrailingComments: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: Always | ||
AlignConsecutiveShortCaseStatements: | ||
Enabled: true | ||
AcrossEmptyLines: true | ||
AcrossComments: true | ||
AlignCaseColons: false | ||
AllowShortCaseLabelsOnASingleLine: true | ||
AllowShortFunctionsOnASingleLine: All | ||
AllowShortIfStatementsOnASingleLine: AllIfsAndElse | ||
AllowShortLoopsOnASingleLine: true | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: true | ||
BinPackArguments: true | ||
BinPackParameters: true | ||
BraceWrapping: | ||
AfterClass: true | ||
AfterControlStatement: true | ||
AfterEnum: true | ||
AfterFunction: true | ||
AfterNamespace: true | ||
AfterObjCDeclaration: true | ||
AfterStruct: true | ||
AfterUnion: true | ||
AfterExternBlock: true | ||
BeforeCatch: true | ||
BeforeElse: true | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: true | ||
SplitEmptyNamespace: true | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeBraces: Custom | ||
BreakBeforeInheritanceComma: false | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializersBeforeComma: false | ||
BreakConstructorInitializers: BeforeColon | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakStringLiterals: true | ||
ColumnLimit: 75 | ||
CommentPragmas: '^ pragma::' | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: false | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: false | ||
ForEachMacros: | ||
- foreach | ||
- Q_FOREACH | ||
- BOOST_FOREACH | ||
IncludeBlocks: Preserve | ||
IncludeCategories: | ||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/' | ||
Priority: 2 | ||
- Regex: '^(<|"(gtest|gmock|isl|json)/)' | ||
Priority: 3 | ||
- Regex: ".*" | ||
Priority: 1 | ||
IncludeIsMainRegex: "(Test)?$" | ||
IndentCaseLabels: true | ||
IndentPPDirectives: BeforeHash | ||
IndentWidth: 4 | ||
IndentWrappedFunctionNames: false | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
MacroBlockBegin: "" | ||
MacroBlockEnd: "" | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: All | ||
ObjCBlockIndentWidth: 2 | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: true | ||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 19 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 60 | ||
PointerAlignment: Right | ||
ReflowComments: true | ||
SortIncludes: true | ||
SortUsingDeclarations: true | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterTemplateKeyword: true | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: true | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false |
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,6 +1,11 @@ | ||
int main(int argc, char** argv) { | ||
(void)argc; | ||
(void)argv; | ||
#include <Window.hpp> | ||
|
||
return 0; | ||
int main(int argc, char **argv) | ||
{ | ||
(void)argc; | ||
(void)argv; | ||
|
||
Lightbleeder::Window::Get(); | ||
|
||
return 0; | ||
} |
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,6 @@ | ||
set(ABYSSGUARD_FILE "Abyssguard.cpp") | ||
|
||
add_executable(Stormsinger ${ABYSSGUARD_FILE}) | ||
add_dependencies(Stormsinger Lightbleeder) | ||
target_link_libraries(Stormsinger Lightbleeder) | ||
target_include_directories(Stormsinger PRIVATE "${CMAKE_SOURCE_DIR}/Lightbleeder/Include") | ||
target_link_libraries(Stormsinger Lightbleeder) |
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,4 +1,7 @@ | ||
set(LIGHTBLEEDER_SOURCES "Lightbleeder.cpp") | ||
set(LIGHTBLEEDER_HEADERS "Lightbleeder.hpp") | ||
set(LIGHTBLEEDER_SOURCES "Source/Lightbleeder.cpp" "Source/Window.cpp") | ||
set(LIGHTBLEEDER_HEADERS "Include/Lightbleeder.hpp" "Source/Window.cpp") | ||
|
||
add_library(Lightbleeder STATIC ${LIGHTBLEEDER_SOURCES} ${LIGHTBLEEDER_HEADERS}) | ||
add_library(Lightbleeder STATIC ${LIGHTBLEEDER_SOURCES} ${LIGHTBLEEDER_HEADERS}) | ||
add_dependencies(Lightbleeder glfw) | ||
target_include_directories(Lightbleeder PRIVATE "Include") | ||
target_link_libraries(Lightbleeder PUBLIC glfw3) |
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,35 @@ | ||
#ifndef LIGHTBLEEDER_WINDOW_HPP | ||
#define LIGHTBLEEDER_WINDOW_HPP | ||
|
||
#include <GLFW/glfw3.h> | ||
|
||
#include <string_view> | ||
|
||
namespace Lightbleeder | ||
{ | ||
class Window | ||
{ | ||
private: | ||
GLFWwindow *window; | ||
Window(); | ||
|
||
public: | ||
static Window &Get() | ||
{ | ||
static Window instance; | ||
return instance; | ||
} | ||
|
||
inline void SetTitle(const std::string_view title) noexcept | ||
{ | ||
glfwSetWindowTitle(window, title.data()); | ||
} | ||
|
||
// We don't want to allow copying or moving the window's data | ||
// in any way. | ||
Window(Window const &) = delete; | ||
void operator=(const Window &) = delete; | ||
}; | ||
} | ||
|
||
#endif // LIGHTBLEEDER_WINDOW_HPP |
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,34 @@ | ||
#include <Window.hpp> | ||
|
||
#include <iostream> | ||
#include <stdexcept> | ||
|
||
namespace Lightbleeder | ||
{ | ||
Window::Window() | ||
{ | ||
glfwSetErrorCallback([](int error, const char *description) { | ||
std::cout << "Error " << error << ": " << description | ||
<< std::endl; | ||
}); | ||
|
||
bool initialized = glfwInit(); | ||
if (!initialized) | ||
// TODO: Log system. | ||
throw std::runtime_error("Failed to initialize GLFW."); | ||
|
||
glfwDefaultWindowHints(); | ||
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); | ||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); | ||
|
||
GLFWmonitor *monitor = glfwGetPrimaryMonitor(); | ||
const GLFWvidmode *mode = glfwGetVideoMode(monitor); | ||
|
||
window = glfwCreateWindow(mode->width, mode->height, | ||
"Lightbleeder", monitor, nullptr); | ||
if (window == nullptr) | ||
throw std::runtime_error("Failed to create window."); | ||
|
||
while (!glfwWindowShouldClose(window)) { glfwPollEvents(); } | ||
} | ||
} |
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,8 +1,9 @@ | ||
// Executable that creates and formats the Sunbringer asset archive. | ||
|
||
int main(int argc, char** argv) { | ||
(void)argc; | ||
(void)argv; | ||
int main(int argc, char **argv) | ||
{ | ||
(void)argc; | ||
(void)argv; | ||
|
||
return 0; | ||
return 0; | ||
} |