snapshot: does something

This commit is contained in:
Eric House 2021-02-01 08:30:34 -08:00
parent b62ab69799
commit 947b28f3b3
2 changed files with 51 additions and 0 deletions

9
xwords4/wasm/Makefile Normal file
View file

@ -0,0 +1,9 @@
INPUTS = main.c
all: main.html
main.html: ${INPUTS}
emcc -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' $^ -o $@

42
xwords4/wasm/main.c Normal file
View file

@ -0,0 +1,42 @@
// Copyright 2011 The Emscripten Authors. All rights reserved.
// Emscripten is available under two separate licenses, the MIT license and the
// University of Illinois/NCSA Open Source License. Both these licenses can be
// found in the LICENSE file.
#include <stdio.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <emscripten.h>
#include <unistd.h>
#include <stdlib.h>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
int main(int argc, char** argv)
{
SDL_Init(SDL_INIT_VIDEO);
SDL_Window* window;
SDL_Renderer* renderer;
SDL_CreateWindowAndRenderer(600, 400, 0, &window, &renderer);
int result = 0;
/**
* Set up a white background
*/
SDL_SetRenderDrawColor(renderer, 255, 255, 50, 50);
SDL_RenderClear(renderer);
/**
* Show what is in the renderer
*/
SDL_RenderPresent(renderer);
printf("you should see an image.\n");
return 0;
}