A better alternative to solution files

The Partridge Family were neither partridges nor a family. Discuss.
Slidy
Posts: 80
Joined: September 9th, 2017, 1:19 pm

Re: A better alternative to solution files

Post by Slidy » September 29th, 2018, 11:34 pm

FinalL worked on converting the framework to use CMake & OpenGL, I'm not sure if it's in a working state or not though. Link to the repo: https://github.com/FinalL/chili_framewo ... CMakeBuild

PotatoWedgie
Posts: 6
Joined: June 12th, 2017, 10:33 pm

Re: A better alternative to solution files

Post by PotatoWedgie » September 30th, 2018, 11:06 am

well, it configures but it doesn't build. there's a bunch of types not defined

FinalL
Posts: 53
Joined: February 6th, 2014, 3:44 pm
Location: Slovakia

Re: A better alternative to solution files

Post by FinalL » September 30th, 2018, 8:45 pm

I did not make it linux compatible yet, since the sound is still work in progress but I'm gonna try to publish a lightweight version buildable on linux
Many noodles, one sauce.
'Programming rules: #1 - Everything is just a fucking number.' Chili, 2012
Mainly Discord procrastinator

FinalL
Posts: 53
Joined: February 6th, 2014, 3:44 pm
Location: Slovakia

Re: A better alternative to solution files

Post by FinalL » September 30th, 2018, 9:56 pm

Ok I tried making it buildable on linux but GCC just refuses to build it :? https://github.com/FinalL/chili_framewo ... linuxbuild It builds without problems on VS 2017 but GCC keeps bitching about

Code: Select all

/root/chili_framework/Engine/Graphics.h: In member function ‘void Graphics::PutPixel(int, int, int, int, int)’:
/root/chili_framework/Engine/Graphics.h:55:23: error: expected primary-expression before ‘(’ token
   PutPixel( x,y, Color( unsigned char( r ),unsigned char( g ),unsigned char( b ) ) );
I really have no idea what the problem is https://pastebin.com/S0zyfZNM
Many noodles, one sauce.
'Programming rules: #1 - Everything is just a fucking number.' Chili, 2012
Mainly Discord procrastinator

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: A better alternative to solution files

Post by albinopapa » October 1st, 2018, 4:47 am

Don't know why it would matter, but try moving the definition of the PutPixel(int,int,int,int,int) in the .cpp file. It appears it's only seeing this version and not the overload, or it's not understanding how to construct a Color object.

Try creating the color first, then pass the newly created color to the PutPixel( int,int,Color ) overload.

Code: Select all

void PutPixel( int x, int y, int r, int g, int b )
{
  const Color c( unsigned char( r ), unsigned char( g ), unsigned char( b ) );
  PutPixel( x, y, c );
}
Try c++ static_cast<unsigned char>

Code: Select all

void PutPixel( int x, int y, int r, int g, int b )
{
  PutPixel( x, y, Color( static_cast<unsigned char>( r ), static_cast<unsigned char>( g ), static_cast<unsigned char>( b ) ) );
}
Try putting the parentheses around the ( unsigned char ) instead of around the variable names:

Code: Select all

void PutPixel( int x, int y, int r, int g, int b )
{
  PutPixel( x, y, Color( ( unsigned char )r, ( unsigned char )g, ( unsigned char )b ) );
}
Try swapping the order of the PutPixel functions:

Code: Select all

void PutPixel( int x, int y, Color c );
void PutPixel( int x, int y, int r, int g, int b )
{
  PutPixel( x,y, Color( unsigned char( r ),unsigned char( g ),unsigned char( b ) ) );
}
Something Visual Studio had problems with in the beginning of VS2017 life-cycle, was the fact chili used unsigned char for the parameters of the Color constructors and the class is constexpr. So VS complained about, but still compiled, the result of the bitwise or expressions would overflow even thought he result would go into a 32 bit unsigned int. Perhaps this could be the cause as well. To check, change all the Color constructor parameters to unsigned int instead of unsigned char:

Code: Select all

	constexpr Color( unsigned int x,unsigned int r,unsigned int g,unsigned int b )
		:
		dword( (x << 24u) | (r << 16u) | (g << 8u) | b )
	{}
	constexpr Color( unsigned int r,unsigned int g,unsigned int b )
		:
		dword( (r << 16u) | (g << 8u) | b )
	{}
	constexpr Color( Color col,unsigned int x )
		:
		Color( (x << 24u) | col.dword )
	{}
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

FinalL
Posts: 53
Joined: February 6th, 2014, 3:44 pm
Location: Slovakia

Re: A better alternative to solution files

Post by FinalL » October 2nd, 2018, 8:30 am

Thanks for the suggestions papa :) I posted it at the discord as well and Chili took a look at it, and concluded that the GCC had trouble parsing the multi-word typename unsigned char without parentheses surrounding it. I spent some more time with it yesterday and got it now building on Linux. But now it just stays black. I suspect there's some OpenGL/glad error somewhere because the glfw window and 'rendering' loop seems to be running and responding to input. Stronger checking on GL calls would have helped, but I was too lazy. At least I get to learn debugging on Linux. Another new experience from this 'simple' task. :D
Many noodles, one sauce.
'Programming rules: #1 - Everything is just a fucking number.' Chili, 2012
Mainly Discord procrastinator

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: A better alternative to solution files

Post by albinopapa » October 2nd, 2018, 9:00 am

So, static_cast<unsigned char>( value ) or (unsigned char)value or (unsigned char)(value) would work?
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

FinalL
Posts: 53
Joined: February 6th, 2014, 3:44 pm
Location: Slovakia

Re: A better alternative to solution files

Post by FinalL » October 2nd, 2018, 10:29 am

the middle one works just fine (unsigned char)value
Many noodles, one sauce.
'Programming rules: #1 - Everything is just a fucking number.' Chili, 2012
Mainly Discord procrastinator

FinalL
Posts: 53
Joined: February 6th, 2014, 3:44 pm
Location: Slovakia

Re: A better alternative to solution files

Post by FinalL » October 2nd, 2018, 9:30 pm

After a bit more tweaking than I expected, I managed to get it running on my Kali VM, you can test if it works on your machine, master on https://github.com/FinalL/chili_framework It worksruns, but needs proper thorough testing of the mouse and keyboard input, maybe a reorganisation. It's also still missing sound, I unfortunately need some more learning until I'm able to finish that. I might be able to try some more this weekend. ;)
Many noodles, one sauce.
'Programming rules: #1 - Everything is just a fucking number.' Chili, 2012
Mainly Discord procrastinator

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: A better alternative to solution files

Post by chili » October 3rd, 2018, 1:37 am

When you've got a test setup for keyboard and mouse, I'd like to test it out on an Ubuntu VM. One of the things I anticipated as an annoyance would be the fact that tutorials etc. use windows VK_ codes. How does your framework handle the key codes?
Chili

Post Reply