1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#include "raylib.h" #include <cmath> #pragma comment(lib, "raylib.lib") #pragma comment(lib, "winmm.lib")
#ifndef _DEBUG #pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" ) #endif
void TestDraw() { float time = GetTime(); float xValue = std::sin(time) / 2.0f + 0.5f;
Color blue = BLUE; Color skyblue = SKYBLUE;
blue.g *= xValue; blue.b *= xValue;
skyblue.g *= xValue; skyblue.b *= xValue;
DrawPoly(Vector2{ 300, 300 }, 7, 120, 45 * xValue, skyblue); DrawPoly(Vector2{ 300, 300 }, 7, 100, 90 * xValue, blue); DrawPoly(Vector2{ 300, 300 }, 7, 80, 135 * xValue, skyblue); DrawPoly(Vector2{ 300, 300 }, 7, 60, 180 * xValue, blue); DrawPoly(Vector2{ 300, 300 }, 7, 40, 225 * xValue, skyblue); DrawPoly(Vector2{ 300, 300 }, 7, 20, 270 * xValue, blue); }
int main() { const int screenWidth = 800; const int screenHeight = 450; SetConfigFlags(FLAG_MSAA_4X_HINT);
InitWindow(screenWidth, screenHeight, "VS2022 Raylib Demo你好"); SetTargetFPS(60);
while (!WindowShouldClose()) {
BeginDrawing(); ClearBackground(RAYWHITE); DrawText("Hello, Raylib!乱码", 10, 10, 20, DARKGRAY); TestDraw();
EndDrawing(); }
CloseWindow(); return 0; }
|