Allegro.cc - Online Community

Allegro.cc Forums » The Depot » Eagle0pt8 and Allegro 526x binary release

This thread is locked; no one can reply to it. rss feed Print
Eagle0pt8 and Allegro 526x binary release
Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I just made an initial release of my GUI and extension library, Eagle.

Get it here :
https://github.com/EdgarReynaldo/EagleGUI/releases/tag/v0pt8pt0

It's only version 0pt8 because there's still a bunch of housekeeping and development I want to do before I make a stable release of version 1.

On the release page, there is an archive for Eagle 0.8, WIP docs, Allegro 5.2.6+, and all the dependencies necessary to build with Eagle and Allegro.

Suggestions for widgets are welcome.

Read the FAQ for commonly asked questions and answers.

The best way to learn how to use Eagle is probably by reading the headers, as all the docs are contained within the headers anyway.

I will start on a tutorial example program to show Eagle's features. That may be the easiest way to get started.

Eagle builds on Windows, Linux, and should work on OSX too but I don't have a machine to test.

Hope somebody finds my stuff useful.

Edgar 8-)

Direct download links if anyone is lazy :
Eagle0pt8_GCC81_MinGW_W64_i686_posix_dwarf.7z
Eagle0pt8docs.7z
Allegro526x_GCC81_MinGW_W64_i686_posix_dwarf.7z
EagleAndAllegroDeps.7z
mingw-builds/8.1.0/threads-posix/dwarf/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z

Doctor Cop
Member #16,833
April 2018
avatar

I'm on it!

[Edit]
Hi, Edgar.
What version of OpenGL does Eagle require?
I have a very old Dell Laptop which has OpenGL version < 2, which is the main reason why I can't use the latest version of Blender and Godot.

Here's how the example is looking in my machiene :-
{"name":"612749","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/1\/41a378939e50b1820d7c8aa8677402e7.png","w":1280,"h":720,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/1\/41a378939e50b1820d7c8aa8677402e7"}612749

It has a black background and is nothing like :-
{"name":"612750","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/b\/5b6f80c50ecafa4944c1dfad714007c6.png","w":802,"h":633,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/b\/5b6f80c50ecafa4944c1dfad714007c6"}612750

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

That's just a simple test program I was using. It's not really an example you should go off of. I have yet to write a full example for Eagle.

EDIT
Also, Eagle works with any version of allegro 5 it was compiled with. Allegro 5 works with any version of OpenGL. It also works with DX and D3D9, just like and because of, allegro.

EDIT2
There is a small bug in DrawImageFit. It is fixed in git. I will release another set of updated binaries to remedy this. If there are any other bugs you notice I will fix them and re-release.

EDIT3
https://github.com/EdgarReynaldo/EagleGUI/releases/tag/0pt8pt1

The issue is fixed, and new binaries are available in a single monolithic package including eagle, allegro 5, and all its dependencies together in a single file.

https://github.com/EdgarReynaldo/EagleGUI/releases/download/0pt8pt1/MassiveAttack.7z

EDIT4
I'm going to keep editing this post until someone gives me feedback. ;P

Doctor Cop
Member #16,833
April 2018
avatar

Edgar, I will test Eagle 5 after 2nd of Jan of the following year. I have a lots of work right now and I'm thinking of a way to make a decent playable game in the mean time. I have to work on apology card too, but that's aside the fact that I don't have enough time.

One thing I noticed that the mouse click is off by -100 Y axis. I don't know why, maybe there's a problem with the example code, because I have tried both of the examples and in both of them the y axes is messed up.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Doctor Cop
Member #16,833
April 2018
avatar

I made a screenshot of the program and counted the distance in pixels between the mouse cursor and the rectangle drawing pointer(click).

{"name":"612767","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/b\/1baeec9510ace65366613681805f5795.png","w":1280,"h":720,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/b\/1baeec9510ace65366613681805f5795"}612767

[Edit] : But, now it shows the difference of 64pixels so IDK how much pixels it's exactly off.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I don't know what's wrong with the mouse coordinates in your test run. The program runs fine for me. Left click + drag defines rectangle 1, SHIFT Left click + drag defines rectangle 2.

The rectangles follow the mouse for me.

Doctor Cop
Member #16,833
April 2018
avatar

https://youtu.be/wlwN4VHgFTo

Hello Edgar, I recorded the mouse click on my system and uploaded it on YouTube.
And why is the display height so large for the example? It doesn't even show the Taskbar.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

What is your native resolution? Are you on a tablet? I will make them smaller in the future. Those aren't even supposed to be examples, they were just tests I was running. I don't know why your mouse is off, but I suspect it is because the window is offscreen.

Just use the code as an example of how to use the basic system. If you have questions about the code let me know. There's nothing wrong with the code, it's something to do with your monitor / os setup here.

Doctor Cop
Member #16,833
April 2018
avatar

../../mingw32/bin/g++ -I ../../mingw32/include/ -o ../main main.cpp ../allegro_monolith-5.2.dll ../libdumb.dll ../libEagleA5Shared.dll  ../libEagleShared.dll ../libenet.dll ../libFLAC++-6.dll ../libFLAC-8.dll ../libgcc_s_dw2-1.dll ../libgif-7.dll ../libjpeg-62.dll ../libogg-0.dll ../libphysfs.dll ../libpng16.dll ../libstdc++-6.dll ../libtheora-0.dll ../libtheoradec-1.dll ../libtheoraenc-1.dll ../libtiff.dll ../libtiffxx.dll ../libturbojpeg.dll ../libvorbis-0.dll ../libvorbisenc-2.dll ../libvorbisfile-3.dll ../libwinpthread-1.dll ../libzlib.dll ../OpenAL32.dll
In file included from ../../mingw32/include/Eagle.hpp:34,
                 from ../../mingw32/include/Eagle/backends/Allegro5Backend.hpp:28,
                 from main.cpp:1:
../../mingw32/include/Eagle/Area.hpp:270:2: warning: #warning Eagle::Rectangle has issues with OpenGL headers [-Wcpp]
 #warning Eagle::Rectangle has issues with OpenGL headers
  ^~~~~~~
In file included from ../../mingw32/include/Eagle.hpp:36,
                 from ../../mingw32/include/Eagle/backends/Allegro5Backend.hpp:28,
                 from main.cpp:1:
../../mingw32/include/Eagle/Clipboard.hpp:29:2: warning: #warning TODO : Support more than local strings... Use my clipboard
library instead. [-Wcpp]
 #warning TODO : Support more than local strings... Use my clipboard library instead.
  ^~~~~~~

These are the warnings that I get after compiling the Example program.
Will update after trying to fix this issue.

[Edit]

#SelectExpand
1 2 Allegro5System* sys = GetAllegro5System(); 3 ALLEGRO_MONITOR_INFO monitor; 4 al_get_monitor_info(0, &monitor); 5 6 int ret = sys->Initialize(EAGLE_FULL_SETUP); 7 (void)ret; 8 9 EagleGraphicsContext* win; 10 if (monitor.x2 < 768 && monitor.y2 < 1024) 11 win = sys->CreateGraphicsContext("win" , 1024 , 768 , EAGLE_OPENGL | EAGLE_WINDOWED); 12 else 13 win = sys->CreateGraphicsContext("win" , 800 , 600 , EAGLE_OPENGL | EAGLE_WINDOWED); 14 15 EAGLE_ASSERT(win && win->Valid()); 16 17 win->Clear(); 18 win->FlipDisplay();

[Edit]: The problem is obviously in monitor values, IDK why they are larger than your prefilled display values, even though my display size is smaller.
I couldn't workout the solution, maybe you can, if you know why monitor values are so bizarre then let me know.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Ignore all the warnings when building Eagle. They're for development use only. Friendly reminder to get my stuff done.

You're using ALLEGRO_MONITOR_INFO incorrectly. x2 and y2 are the bottom right corners of the window, not the width and height.

I will come up with an example program here in the next week or so. Shouldn't take long.

Doctor Cop
Member #16,833
April 2018
avatar

monitor.x2 1280 monitor.y2 720

These are the values I got from a program without Eagle 5.

monitor.x2 2147483647 monitor.y2 2147483647
These are the values I got from a program with Eagle 5 before Allegro5System* sys = GetAllegro5System();.

Dizzy Egg
Member #10,824
March 2009
avatar

if (monitor.x2 < 768 && monitor.y2 < 1024)

shouldn't that be:

if (monitor.x2 < 1024 && monitor.y2 < 768)

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

No. They're both wrong. x2 and y2 are the bottom right corner, not the width and height. That's x2-x1 and y2-y1.

And of course allegro doesn't work before you call System::Initialize...

Doctor Cop
Member #16,833
April 2018
avatar

#SelectExpand
1 #include <Eagle/backends/Allegro5Backend.hpp> 2#include <Eagle.hpp> 3#include <allegro5/allegro_color.h> 4#include <stdio.h> 5 6int round_by_highest(int); 7 8int main(int argc , char** argv) { 9 (void)argc; 10 (void)argv; 11 12 Allegro5System* sys = GetAllegro5System(); 13 14 int ret = sys->Initialize(EAGLE_FULL_SETUP); 15 (void)ret; 16 17 ALLEGRO_MONITOR_INFO monitor; 18 al_get_monitor_info(0, &monitor); 19 printf("\nmonitor.x2 %d\tmonitor.y2 %d\n", monitor.x2, monitor.y2); 20 21 EagleGraphicsContext* win; 22 if (monitor.x2 < 1024 || monitor.y2 < 768) 23 win = sys->CreateGraphicsContext("win" , 24 round_by_highest(monitor.x2), 25 round_by_highest(monitor.y2), 26 EAGLE_OPENGL | EAGLE_WINDOWED); 27 else 28 win = sys->CreateGraphicsContext("win" , 1024 , 768 , EAGLE_OPENGL | EAGLE_WINDOWED); 29 30 printf("\n%d %d", round_by_highest(monitor.x2), round_by_highest(monitor.y2)); 31 32 EAGLE_ASSERT(win && win->Valid()); 33 34 win->Clear(); 35 win->FlipDisplay(); 36 37 bool quit = false; 38 bool redraw = true; 39 int mx = 0 , sx = 0; 40 int my = 0 , sy = 0; 41 bool drag = false , shiftdrag = false; 42 int x1=0,x2=0,x3=0,x4=0; 43 int y1=0,y2=0,y3=0,y4=0; 44 45 sys->GetSystemTimer()->Start(); 46 47 while (!quit) { 48 if (redraw) { 49 Rectangle r1,r2; 50 r1.SetCorners(x1,y1,x2,y2); 51 r2.SetCorners(x3,y3,x4,y4); 52 std::list<Rectangle> left = SubtractRectangle(r2,r1); 53 54 win->Clear(); 55 win->DrawFilledRectangle(r1 , EagleColor(0,255,0)); 56 win->DrawFilledRectangle(r2 , EagleColor(255,0,0)); 57 float h = 30.0f; 58 float s = 1.0f; 59 float l = 0.5; 60 for (std::list<Rectangle>::iterator it = left.begin() ; it != left.end() ; ++it) { 61 float r,g,b; 62 al_color_hsl_to_rgb(h,s,l,&r,&g,&b); 63 win->DrawFilledRectangle(*it , EagleColor(r,g,b)); 64 65 h += 30.0f; 66 } 67 win->FlipDisplay(); 68 redraw = false; 69 } 70 do { 71 EagleEvent e = sys->WaitForSystemEventAndUpdateState(); 72 if (e.type == EAGLE_EVENT_TIMER) { 73 redraw = true; 74 } 75 if (e.type == EAGLE_EVENT_DISPLAY_CLOSE) { 76 quit = true; 77 } 78 if (e.type == EAGLE_EVENT_KEY_DOWN && e.keyboard.keycode == EAGLE_KEY_ESCAPE) { 79 quit = true; 80 } 81 if (e.type == EAGLE_EVENT_MOUSE_AXES) { 82 mx = e.mouse.x; 83 my = e.mouse.y; 84 if (drag) { 85 x1 = mx; 86 y1 = my; 87 } 88 if (shiftdrag) { 89 x3 = mx; 90 y3 = my; 91 } 92 } 93 if (e.type == EAGLE_EVENT_MOUSE_BUTTON_DOWN) { 94 sx = e.mouse.x; 95 sy = e.mouse.y; 96 if (input_key_held(EAGLE_KEY_ANY_SHIFT)) { 97 shiftdrag = true; 98 x3 = x4 = sx; 99 y3 = y4 = sy; 100 } 101 else { 102 drag = true; 103 x1 = x2 = sx; 104 y1 = y2 = sy; 105 } 106 } 107 if (e.type == EAGLE_EVENT_MOUSE_BUTTON_UP) { 108 drag = shiftdrag = false; 109 } 110 } while (!sys->UpToDate()); 111 112 } 113 114 return 0; 115} 116 117int round_by_highest(int num) 118{ 119 int round_no=1, temp; 120 while(num != 0) { 121 temp = num%10; 122 round_no*=10; 123 num/=10; 124 } round_no*=temp; 125 return round_no/=10; 126}

I did a stupid thing here, guess what!?

Go to: