Ooops
May 31, 2020, 08:44:44 PM

Author Topic: Starting with Raylib  (Read 565 times)

guest7581

  • Guest
Re: Starting with Raylib
« Reply #15 on: April 20, 2020, 03:56:12 PM »
Strange. Raylib works smooth on my laptop. Online examples work smooth on every device I've tried (Windows, Linux, Android). And what do you mean by "soft"?

Offline Aurel

  • Full Member
  • ***
  • Posts: 151
    • AurelSoft
Re: Starting with Raylib
« Reply #16 on: April 20, 2020, 04:16:13 PM »
When i catch some time i will show you openGL app created in Oxygenbasic where work far better and smooth than with raylib.
Anyway ..there is also another choice using SFML
Then I'd suggest programming something purely graphical (i.e. not Windows GUIs, just graphics - video games and stuff). You don't need to know anything about Win32 for that. Take a look at SFML. It's a general 2D/3D drawing API. It also offers useful functions for sound, timing, networking, maths, etc.
It'd be WAY more interesting and rewarding than trying to learn win32. It's clean, it's easy to use, it lets you do draw whatever you want however you want. It's not a good tool for designing GUIs, but designing GUIs in win32 is a pain in the butt.
-> this one is not true at all..my comment

To illustrate: here's a complete working C++ app that displays a sprite and allows you to move it around with the arrow keys and rotate it with +/-, using SFML. Doesn't that look fun?

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>

////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
   // Create the main rendering window
   sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
   // Load the sprite image from a file
   sf::Image Image;
   if (!Image.LoadFromFile("sprite.tga"))
      return EXIT_FAILURE;
   // Create the sprite
   sf::Sprite Sprite(Image);
   // Change its properties
   Sprite.SetColor(sf::Color(0, 255, 255, 128));
   Sprite.SetPosition(200.f, 100.f);
   Sprite.SetScale(2.f, 2.f);
   // Start game loop
   while (App.IsOpened())
   {
      // Process events
      sf::Event Event;
      while (App.GetEvent(Event))
      {
         // Close window : exit
         if (Event.Type == sf::Event::Closed)
            App.Close();
      }
      // Get elapsed time
      float ElapsedTime = App.GetFrameTime();
      // Move the sprite
      if (App.GetInput().IsKeyDown(sf::Key::Left))  Sprite.Move(-100 * ElapsedTime, 0);
      if (App.GetInput().IsKeyDown(sf::Key::Right)) Sprite.Move( 100 * ElapsedTime, 0);
      if (App.GetInput().IsKeyDown(sf::Key::Up))   Sprite.Move(0, -100 * ElapsedTime);
      if (App.GetInput().IsKeyDown(sf::Key::Down))  Sprite.Move(0,  100 * ElapsedTime);
      // Rotate the sprite
      if (App.GetInput().IsKeyDown(sf::Key::Add))     Sprite.Rotate(- 100 * ElapsedTime);
      if (App.GetInput().IsKeyDown(sf::Key::Subtract)) Sprite.Rotate(+ 100 * ElapsedTime);
      // Clear screen
      App.Clear();
      // Display sprite in our window
      App.Draw(Sprite);
      // Display window contents on screen
      App.Display();
   }
   return EXIT_SUCCESS;
}

guest7581

  • Guest
Re: Starting with Raylib
« Reply #17 on: April 20, 2020, 05:55:13 PM »
When i catch some time i will show you openGL app created in Oxygenbasic where work far better and smooth than with raylib.

To show me the difference between Raylib and OxygenBasic you would have o make a video. I don't have Windows on my computer and can't be bother with installing anything and compiling on my sons' laptops, since I know there will be no difference. What happens on your machine is a different story, of course.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal