macos and clang changes
parent
af5522ca01
commit
1daf59732f
2
font.c
2
font.c
|
@ -1,6 +1,6 @@
|
|||
#include "EGA8x8.h"
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL.h>
|
||||
|
||||
SDL_Texture *load_font(SDL_Renderer *renderer) {
|
||||
SDL_Surface *s = SDL_LoadBMP_RW(SDL_RWFromConstMem(font_data, font_data_len), 1);
|
||||
|
|
2
font.h
2
font.h
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#define RC(r, c) (c)*font_w, (r)*font_h
|
||||
|
||||
|
|
22
xormod.c
22
xormod.c
|
@ -2,7 +2,7 @@
|
|||
#include "EGA8x8.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#define SWAP(a, b) ({ \
|
||||
__typeof(a) tmp = (a); \
|
||||
|
@ -46,21 +46,19 @@ static Picture *Picture_new(SDL_Renderer *rend,
|
|||
return p;
|
||||
}
|
||||
|
||||
typedef uint32_t uint32_4 __attribute__ ((vector_size (4 * sizeof(uint32_t))));
|
||||
typedef uint32_t uint32_8 __attribute__ ((vector_size (8 * sizeof(uint32_t))));
|
||||
|
||||
static void Picture_render(Picture *p, SDL_Renderer *rend) {
|
||||
|
||||
for (int j = p->y1, r = 0; j < p->y2; j++) {
|
||||
uint32_4 y = {j, j, j, j};
|
||||
for (int i = p->x1; i < p->x2; i+=4, r+=4) {
|
||||
uint32_4 x = {i, i + 1, i + 2, i + 3};
|
||||
uint32_4 z = (x ^ y) % 9;
|
||||
uint32_4 f = (z==0) & p->color;
|
||||
uint32_8 c = p->color - (uint32_8){};
|
||||
uint32_8 y = 0 - (uint32_8){};
|
||||
for (int j = p->y1, r = 0; j < p->y2; j++, y+=1) {
|
||||
uint32_8 x = {0, 1, 2, 3, 4, 5, 6, 7};
|
||||
for (int i = p->x1; i < p->x2; i+=8, r+=8, x+=8) {
|
||||
uint32_8 z = (x ^ y) % 9;
|
||||
uint32_8 f = (z==0) & c;
|
||||
memcpy(&p->pixels[r], (uint32_t*)&f, sizeof(f));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (p->texture) SDL_DestroyTexture(p->texture);
|
||||
p->texture = SDL_CreateTextureFromSurface(rend, p->surface);
|
||||
SDL_SetTextureBlendMode(p->texture, SDL_BLENDMODE_NONE);
|
||||
|
@ -77,7 +75,7 @@ struct int2 { int x; int y; };
|
|||
|
||||
int main() {
|
||||
|
||||
unsigned w = 1280, h = 720;
|
||||
int w = 1280, h = 720;
|
||||
|
||||
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
|
||||
fprintf(stderr, "Can't init: %s\n", SDL_GetError());
|
||||
|
|
Loading…
Reference in New Issue