generated from It-Club/RaylibTemplate-C
Add textures
This commit is contained in:
19
src/main.c
19
src/main.c
@@ -1,22 +1,29 @@
|
||||
#include "main.h"
|
||||
#include "../data/Juno.webp.h"
|
||||
#include "../data/TempFile.jpg.h"
|
||||
#include "consts.h"
|
||||
#include "draw.h"
|
||||
#include "raylib.h"
|
||||
#include "update.h"
|
||||
#include <math.h>
|
||||
|
||||
#if defined(PLATFORM_WEB)
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
static void InitVars();
|
||||
static void MainLoop();
|
||||
|
||||
Texture2D junoTex;
|
||||
Texture2D tempTex;
|
||||
|
||||
int main(void) {
|
||||
SetConfigFlags(FLAG_WINDOW_RESIZABLE | FLAG_VSYNC_HINT);
|
||||
InitWindow(WIN_WIDTH, WIN_HEIGHT, "game");
|
||||
SetTargetFPS(60);
|
||||
SetExitKey(KEY_LEFT_ALT);
|
||||
|
||||
InitVars();
|
||||
|
||||
#if defined(PLATFORM_WEB)
|
||||
emscripten_set_main_loop(MainLoop, 0, 1);
|
||||
#else
|
||||
@@ -28,6 +35,16 @@ int main(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void InitVars() {
|
||||
Image junoImg = LoadImageFromMemory(".webp", Juno_webp, Juno_webp_len);
|
||||
junoTex = LoadTextureFromImage(junoImg);
|
||||
SetTextureFilter(junoTex, TEXTURE_FILTER_POINT);
|
||||
|
||||
Image tempImg = LoadImageFromMemory(".jpg", TempFile_jpg, TempFile_jpg_len);
|
||||
tempTex = LoadTextureFromImage(tempImg);
|
||||
SetTextureFilter(tempTex, TEXTURE_FILTER_POINT);
|
||||
}
|
||||
|
||||
static void MainLoop() {
|
||||
Update();
|
||||
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
#include "raylib.h"
|
||||
|
||||
extern Texture2D junoTex;
|
||||
extern Texture2D tempTex;
|
||||
|
||||
Reference in New Issue
Block a user