Set minimum and maximum size for window and use better line terminators
This commit is contained in:
parent
270132a58e
commit
8a3385b15c
2
.gitignore
vendored
2
.gitignore
vendored
@ -52,6 +52,6 @@ Mkfile.old
|
|||||||
dkms.conf
|
dkms.conf
|
||||||
|
|
||||||
SDL3/
|
SDL3/
|
||||||
build/
|
build*/
|
||||||
.cache/
|
.cache/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|||||||
8
main.c
8
main.c
@ -1,4 +1,6 @@
|
|||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
#include <SDL3/SDL_gpu.h>
|
||||||
|
#include <SDL3/SDL_video.h>
|
||||||
|
|
||||||
SDL_GPUShader *loadShader(SDL_GPUDevice *device,
|
SDL_GPUShader *loadShader(SDL_GPUDevice *device,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
@ -90,8 +92,10 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the window
|
// Create the window
|
||||||
window = SDL_CreateWindow("SDL3 Window", 640, 480, SDL_WINDOW_RESIZABLE);
|
window = SDL_CreateWindow("SDL3 GPU", 640, 480, SDL_WINDOW_RESIZABLE);
|
||||||
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
||||||
|
SDL_SetWindowMinimumSize(window, 640, 480);
|
||||||
|
SDL_SetWindowMaximumSize(window, 1280, 720);
|
||||||
|
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
SDL_Log("Could not create window: %s\n", SDL_GetError());
|
SDL_Log("Could not create window: %s\n", SDL_GetError());
|
||||||
@ -142,6 +146,7 @@ int main(int argc, char **argv) {
|
|||||||
// Free up shaders that are now bound to pipeline
|
// Free up shaders that are now bound to pipeline
|
||||||
SDL_ReleaseGPUShader(GPUDevice, vertexShader);
|
SDL_ReleaseGPUShader(GPUDevice, vertexShader);
|
||||||
SDL_ReleaseGPUShader(GPUDevice, fragShader);
|
SDL_ReleaseGPUShader(GPUDevice, fragShader);
|
||||||
|
//SDL_SetGPUSwapchainParameters(GPUDevice, window, SDL_GPU_SWAPCHAINCOMPOSITION_SDR, SDL_GPU_PRESENTMODE_VSYNC);
|
||||||
|
|
||||||
// Now to loop
|
// Now to loop
|
||||||
while (!done) {
|
while (!done) {
|
||||||
@ -166,6 +171,7 @@ int main(int argc, char **argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Handle the swapchain
|
// Handle the swapchain
|
||||||
if(swapchainTexture != NULL) {
|
if(swapchainTexture != NULL) {
|
||||||
// Clear (background) color
|
// Clear (background) color
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user