Initial commit
This commit is contained in:
commit
e2fe4b5659
7 changed files with 72 additions and 0 deletions
22
README.md
Normal file
22
README.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
# TwiEyes
|
||||
|
||||
<h3 align="center">XEyes but with Twilight Sprakle!</h3>
|
||||
|
||||
Made as simple RayLib try-out project
|
||||
|
||||
Currently needs mouse cursor inside the window to track your mouse, will be remade to use X11 in the future
|
||||
|
||||
#### How it looks
|
||||
|
||||
![TwiEyes](res/twiEyes.gif)
|
||||
|
||||
#### Used art
|
||||
|
||||
- Twilight
|
||||
- [PP](https://ponerpics.org/images/1201365)
|
||||
- [PB](https://ponybooru.org/images/1746069)
|
||||
- [DB](https://derpibooru.org/images/1201365)
|
||||
- [TB](https://twibooru.org/933923)
|
||||
- Twilights Eye
|
||||
- [kindpng](https://www.kindpng.com/imgv/oixoJx_pony-clipart-eye-twilight-sparkle-my-little-pony/)
|
||||
|
BIN
res/twiEyes.gif
Normal file
BIN
res/twiEyes.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 MiB |
2
src/Makefile
Normal file
2
src/Makefile
Normal file
|
@ -0,0 +1,2 @@
|
|||
all:
|
||||
gcc main.c -lraylib
|
BIN
src/eyeLeft.png
Normal file
BIN
src/eyeLeft.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 114 KiB |
BIN
src/eyeRight.png
Normal file
BIN
src/eyeRight.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 102 KiB |
48
src/main.c
Normal file
48
src/main.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "raylib.h"
|
||||
|
||||
// Won't move eyes past than this limit
|
||||
const int maxShiftX = 40, maxShiftY = 80;
|
||||
|
||||
/**Calculates new EyePosition*/
|
||||
void newEyePos(const Vector2* const baseEyePos, const Vector2* const mouse, Vector2* eye) {
|
||||
|
||||
int shiftX = (mouse->x - baseEyePos->x) /4;
|
||||
shiftX = shiftX > maxShiftX ? maxShiftX : (abs(shiftX) > maxShiftX) ? -maxShiftX : shiftX;
|
||||
int shiftY = (mouse->y - baseEyePos->y) /4;
|
||||
shiftY = shiftY > maxShiftY ? maxShiftY : (abs(shiftY) > maxShiftY) ? -maxShiftY : shiftY;
|
||||
|
||||
eye->y = baseEyePos->y + shiftY;
|
||||
eye->x = baseEyePos->x + shiftX;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
const Vector2 leftCenter = {120, 375};
|
||||
const Vector2 rightCenter = {300, 375};
|
||||
|
||||
Image softTwi = LoadImage("./twi.png");
|
||||
InitWindow(softTwi.width/2, softTwi.height/2, "TwiEyes");
|
||||
Texture2D twi = LoadTextureFromImage(softTwi);
|
||||
|
||||
Vector2 twiPos = {0, 0 };
|
||||
Vector2 rightEyePos = rightCenter, leftEyePos = leftCenter;
|
||||
|
||||
Texture2D leftEye = LoadTexture("eyeLeft.png");
|
||||
Texture2D rightEye = LoadTexture("eyeRight.png");
|
||||
|
||||
Vector2 mousePos;
|
||||
while (!WindowShouldClose()) {
|
||||
mousePos = GetMousePosition();
|
||||
newEyePos(&leftCenter, &mousePos, &leftEyePos);
|
||||
newEyePos(&rightCenter, &mousePos, &rightEyePos);
|
||||
BeginDrawing();
|
||||
ClearBackground(WHITE);
|
||||
DrawTextureEx(leftEye, leftEyePos, 0, 0.19, WHITE);
|
||||
DrawTextureEx(rightEye, rightEyePos, 0, 0.19, WHITE);
|
||||
DrawTextureEx(twi, twiPos, 0, 0.5, WHITE);
|
||||
EndDrawing();
|
||||
}
|
||||
CloseWindow();
|
||||
return 0;
|
||||
}
|
BIN
src/twi.png
Normal file
BIN
src/twi.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 209 KiB |
Loading…
Reference in a new issue