add sdl to project
This commit is contained in:
parent
8f840ff1fe
commit
c2aa9c0f31
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "gui/3rdparty/sdl"]
|
||||
path = gui/3rdparty/sdl
|
||||
url = git@github.com:libsdl-org/SDL.git
|
1
gui/3rdparty/sdl
vendored
Submodule
1
gui/3rdparty/sdl
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 675fc8c38f3f5685d177f0ecf7f43d57a109992e
|
|
@ -1,7 +1,10 @@
|
|||
add_subdirectory(3rdparty/sdl)
|
||||
|
||||
add_executable(netsim
|
||||
"src/main.cpp"
|
||||
)
|
||||
|
||||
target_link_libraries(netsim PRIVATE
|
||||
libnetsim
|
||||
SDL3::SDL3
|
||||
)
|
|
@ -1,8 +1,16 @@
|
|||
#include <iostream>
|
||||
|
||||
#include <SDL.h>
|
||||
#include "Netsim.hpp"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
|
||||
SDL_Window* window;
|
||||
SDL_Renderer* renderer;
|
||||
SDL_CreateWindowAndRenderer(1000, 1000, NULL, &window, &renderer);
|
||||
SDL_SetWindowTitle(window, "netsim");
|
||||
|
||||
Network network("Testnet");
|
||||
|
||||
network.addDevice(Device::create("FA:56:A7:12:04:ED"));
|
||||
|
@ -10,5 +18,29 @@ int main(int argc, char** argv) {
|
|||
|
||||
std::cout << network << std::endl;
|
||||
|
||||
bool shouldClose = false;
|
||||
SDL_Event event;
|
||||
|
||||
while (!shouldClose) {
|
||||
while (SDL_PollEvent(&event)) {
|
||||
switch (event.type) {
|
||||
case SDL_EVENT_WINDOW_CLOSE_REQUESTED:
|
||||
case SDL_EVENT_QUIT:
|
||||
shouldClose = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue