Compare commits
3 commits
713d96d770
...
12e5f22929
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12e5f22929 | ||
|
|
6e7e2858d3 | ||
|
|
4b26278543 |
4 changed files with 63 additions and 1 deletions
|
|
@ -2,7 +2,16 @@ BasedOnStyle: LLVM
|
|||
IndentWidth: 4 # Use 4 spaces for indentation
|
||||
TabWidth: 4 # Tab width is also 4 spaces
|
||||
UseTab: Never # Always use spaces instead of tabs
|
||||
ColumnLimit: 80 # Wrap lines after 80 characters
|
||||
ColumnLimit: 120 # Wrap lines after 80 characters
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: false
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
AlignConsecutiveDeclarations:
|
||||
Enabled: true
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
AlignFunctionPointers: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveMacros: true
|
||||
|
|
|
|||
1
break.c
1
break.c
|
|
@ -2,6 +2,7 @@
|
|||
#include <stdio.h>
|
||||
#include <sys/mman.h> // mmap and friends
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
int main(void) {
|
||||
/*
|
||||
|
|
|
|||
12
sdldemo/Makefile
Normal file
12
sdldemo/Makefile
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
CC ?= gcc
|
||||
CFLAGS ?= -Wall -O2 -lSDL2
|
||||
|
||||
TARGET = main.elf
|
||||
SRC = main.c
|
||||
|
||||
$(TARGET): $(SRC)
|
||||
@echo CC $@
|
||||
@$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET)
|
||||
40
sdldemo/main.c
Normal file
40
sdldemo/main.c
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#include <SDL2/SDL.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
|
||||
printf("SDL_Init Error: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_Window *win = SDL_CreateWindow("Simple Window", 100, 100, 640, 480, SDL_WINDOW_SHOWN);
|
||||
if (!win) {
|
||||
printf("SDL_CreateWindow Error: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_Renderer *renderer = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED);
|
||||
if (!renderer) {
|
||||
SDL_DestroyWindow(win);
|
||||
printf("SDL_CreateRenderer Error: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255); // Blue background
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); // Red rectangle
|
||||
SDL_Rect rect = {100, 100, 200, 150};
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
SDL_Delay(3000); // Wait 3 seconds
|
||||
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(win);
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue