vito-Z80

raylibtest

Apr 5th, 2020
573
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.34 KB | None | 0 0
  1. #define RAYGUI_IMPLEMENTATION
  2. #include <raygui.h>
  3. #include <raylib.h>
  4. #include <math.h>
  5.  
  6. // #include "MyButton.c"
  7. // #include "Test.c"
  8. // #include "CastleModel.c"
  9.  
  10.  
  11. int main(void)
  12. {
  13.  
  14.     const int screenWidth = 800;
  15.     const int screenHeight = 800;
  16.     bool fullsize = false;
  17.  
  18.  
  19.     // Camera cam;
  20.  
  21.  
  22.     InitWindow(screenWidth,screenHeight, "raylib [core] example - basic window");
  23.     // SetExitKey(KEY_LEFT_CONTROL & KEY_A);
  24.     // ToggleFullscreen();
  25.    
  26.  
  27.     SetTargetFPS(60);               // Set our game to run at 60 frames-per-second
  28.     //--------------------------------------------------------------------------------------
  29.  
  30.     // GetKeyPressed()
  31.     // if (GetKeyPressed().'a')
  32.     // {
  33.     //     /* code */
  34.     // };
  35.    
  36.    
  37.     double time,x;
  38.     const double w = 300;
  39.     x = 0;
  40.     time = 0;
  41.    
  42.    
  43.     // GuiDefaultProperty defaultProp;
  44.     // defaultProp = TEXT_SIZE;
  45.  
  46.     // *TEXT_SIZE += 34;
  47.    
  48.  
  49.     Image img = LoadImage("game/stars.png");
  50.     Texture2D texture = LoadTextureFromImage(img);
  51.  
  52.     const int realScreenWidth = GetMonitorWidth(0);
  53.     const int realScreenHeight = GetMonitorHeight(0);
  54.     while (!WindowShouldClose())    // Detect window close button or ESC key
  55.     {
  56.         if (IsKeyPressed(KEY_A))
  57.         {
  58.             fullsize = !fullsize;
  59.         };
  60.  
  61.         if (fullsize)
  62.         {
  63.             SetWindowSize(realScreenWidth,realScreenHeight);
  64.             // ToggleFullscreen();
  65.         } else
  66.         {
  67.             SetWindowSize(screenWidth,screenHeight);
  68.         };
  69.        
  70.        
  71.         // Update
  72.         //----------------------------------------------------------------------------------
  73.         // TODO: Update your variables here
  74.         //----------------------------------------------------------------------------------
  75.  
  76.  
  77.         // Vector3 vect;
  78.         // vect.x = 400;
  79.         // vect.y = 200;
  80.         // vect.z = 10;
  81.     // BeginMode3D(cam);
  82.  
  83.     // DrawModel(model,modelPosition,2,WHITE);
  84.     // DrawSphere(vect,100,RED);
  85.     // DrawGrid(32,32);
  86.  
  87.     // EndMode3D();
  88.  
  89.  
  90.         // Draw
  91.         //----------------------------------------------------------------------------------
  92.         time += 0.016;
  93.         x = sin (time)*w;
  94.  
  95.        
  96.  
  97.         if (But())
  98.         {
  99.             DrawText("PRESS",60,60,20,RED);
  100.         };
  101.        
  102.         Fff();
  103.        
  104.         Rectangle rect;
  105.         rect.x = 300;
  106.         rect.y = 300;
  107.         rect.width = 100;
  108.         rect.height = 100;
  109.        
  110.         Color textcolor = GuiColorPicker(rect,WHITE);
  111.        
  112.  
  113.         BeginDrawing();
  114.  
  115.             ClearBackground(BLACK);
  116.  
  117.             DrawText("Congrats! You created your first window!", x+200, 200, 64, textcolor);
  118.             DrawCircle(200,200,50,GREEN);
  119.             DrawFPS(10,10);
  120.  
  121.  
  122.             DrawTexture(texture,250,100,WHITE);
  123.            
  124.  
  125.  
  126.            
  127.  
  128.            
  129.        
  130.  
  131.         EndDrawing();
  132.         //----------------------------------------------------------------------------------
  133.     }
  134.  
  135.     UnloadTexture(texture);
  136.     // De-Initialization
  137.     //--------------------------------------------------------------------------------------
  138.     CloseWindow();        // Close window and OpenGL context
  139.     //--------------------------------------------------------------------------------------
  140.  
  141.     return 0;
  142. }
Advertisement
Add Comment
Please, Sign In to add comment