/dpt/ - Daily Programming Thread

Old thread: What are you working on, Sup Forums?

Other urls found in this thread:

pastebin.com/rVNyPB4b
github.com/andrewrk/libsoundio
youtube.com/watch?v=7s664NsLeFM
twitter.com/SFWRedditImages

first for javascript

daily reminder that trap is gay and managed language is the future.

It's okay I'm gay too

no u

wow despite the incredible power of inheritance and polymorphism im still not allowed to have any data thats not GLIBOBJECTS and c++ types in my freaking icon buttons so theres no way to do anything without using B*LLSHIT

EVERYTYPE OF DATA HAS TO BE A VIEWABLE TYPE FOR A TREE VIEW YOU CANT PUT DATA IN THE TREE VIEW MEMBERS EXCEPT FOR JUST HIDING A TREE VIEW COLUMN AND PRETENDING ITS A ACTUAL DATA AAAA

Say that to my face nigger

managed meaning bytecode or just GCd?

HAHAHAHAHAAH

lulululululul

owo wats dis?

I wanna do all my vector math on the GPU, what's stopping me from doing all my model view matrix calculations in the vertex shader?
I don't want to switch to c++ just to use glm.

>what's stopping me from doing all my model view matrix calculations in the vertex shader
Nothing, but it's extremely wasteful, as you'll be calculating the same shit over and over for each vertex.

Making a game engine. It's getting pretty scary, and I'm trying to keep it to the minimal.

pastebin.com/rVNyPB4b

>I don't want to switch to c++ just to use glm
Just use linmath, or kazmath, or make your own shit. For 2D stuff you only need 8 functions or so.

void *dgMatIdentity(DgMat4 m); // builds identity matrix
void *dgMatScale(DgMat4 m, float x, float y, float z); // builds scale matrix
void *dgMatTranslate(DgMat4 m, float x, float y, float z); // builds translation matrix
void *dgMatRotateX(DgMat4 m, float angle); // builds X rotation matrix
void *dgMatRotateY(DgMat4 m, float angle); // builds Y rotation matrix
void *dgMatRotateZ(DgMat4 m, float angle); // builds Z rotation matrix
void *dgMatCopy(DgMat4 dst, const DgMat4 src); // copies source matrix to destination matrix
void *dgMatApply(DgMat4 dst, const DgMat4 effect, const DgMat4 src); // applies effect matrix to source matrix

>DG_AUDIO_FORMAT_PCM_F32_LE
But why? 16-bit PCM is all you need, unless you're mixing shit.

>pastebin.com/rVNyPB4b
What libraries are you working off from?

>unless you're mixing shit
How can you not mix shit? Are you literally playing one sound at a time? What about music?

What if I have a separate program with a frag shader that stores the calculation results in the framebuffer object only once as packed pixel data which I read back into numeric arrays?

the human ear can't hear more than 16 bits

Everything audio is libsoundio
github.com/andrewrk/libsoundio
Graphics is OpenGL ES 2.0
Windowing and events are GLFW3
Threads are tinycthread
GUI will be (for now not implemented) a Nuklear wrapper.

I dropped linmath when I thought it was causing a bug but it turns it wasn't, oh well, one less dependency.

so 2 bytes? and 16 bit per second or milisecond?

...

A comment notes that this is how it was stored on the disk. There is no reason to store music that way.
Floating point is useful in mixing because it doesn't clip if you mix two large samples together (but you still need to normalise it).

As stupid as this comment is supposed to sound, you really don't need more dynamic range than 16 bits gives you.

Sample is either any integer or a float/double
Frame is most of the time 2 samples (stereo)
Framerate is 22050/44010 per second

>There is no reason to store music that way.
Well, if you store the same way you process it, there's no need to convert it. And I am veeeeeeeeery lazy.

OpenGL has compute shaders, you know.
But really, you'll be wasting more time uploading data to the GPU than you would save.

that looks like a pain to work with. why not use SDL?

>Graphics is OpenGL ES 2.0
Is there some reason you're limiting yourself to this?
I'm using GLES2 for a wayland compositor, and it's pretty annoying how much shit is missing.

>program with C++ one time
>diagnosed with AIDS

>And I am veeeeeeeeery lazy
Yeah, it sure is a difficult function to write.
void f32_to_i16(size_t n, float *f32, int16_t *i16)
{
for (size_t i = 0; i < n; ++i) {
i16[i] = f32[i] * INT16_MAX;
}
}

not him but it's still pretty common on mobile. webgl is similar to it too.
>it's pretty annoying how much shit is missing
like what?

That's what happens when you sleep around

I just realised I wrote that function going in the wrong direction.
It's still trivial, though.
void i16_to_f32(size_t n, int16_t *i16, float *f32)
{
for (size_t i = 0; i < n; ++i) {
f32[i] = (float)i16[i] / INT16_MAX;
}
}

>Is there some reason you're limiting yourself to this?
I'm a brainlet. When there's a smaller API there's a smaller chance you will do something in a different way than it should have been done if it was coded by an experienced professional. Also, a little bit more portability (iOS, Android, wasm), a little bit easier learning curve for anybody who would be interested in joining me in this little project, a little easier to implement some wrappers / software fallback if there's no OpenGL there (xbox?, wasm) and other perks for using a tinier library. Oh, and there's also GLESv3 when you want to upgrade.

Laugh all you want, but I want to make an alternative to all other modern game engines out there, because they're ALL written in C++/C#. I myself can fathom the complexity of C++ because as I've already said, I'm a brainlet.

It's not that it's so hard, it's just that there are so many more much more important things I have to do before this engine becomes even remotely usable. If it ain't broken, don't fix it. Format support is non-critical.

Hamburgers or tacos?

yes

Sissy cum

Hamburgers. Tacos are too hard, they hurt my mouth.

I have never eaten a taco in my entire life. Hamburgers I guess.

>like what?
Standard GLES2 doesn't even have geometry shaders or VAOs.
I also remember it missing a lot of little convenience functions (like glOrtho).
I ended up pulling in a crapload of extensions, because all I'm targeting was GNU/Linux with Mesa.

tacos are really bad
burritos though is like eating pure human food, its warm gooey protein goodness just the perfect food

i hate hard shell tacos. hamburgers are tastier when freshly cooked. burritos are comfy to just pull out of the fridge for a quick meal.

What are soft tacos

Brush your damn teeth, nigger

the fuck you need geometry shaders for a wayland compositor
glOrtho is deprecated as fuck

Im using c++ with windows form. One thing I cant seem to figure out is how to get access to a controls children.
Anyone know how to do this.

Jesus christ, take your pedo shit to Sup Forums

fuckkk this how do i sue gnime for lost tieme

Actually, we don't use geometry shaders, but I just remember it being interesting that they were missing.
>glOrtho is deprecated as fuck
Yes, I know. At the time, it forced us to use trivial shaders, but now what we're doing is ever-so-slightly more advanced, so glOrtho wouldn't have worked.

I miss !WiNdowsNME - I always wonder if he ever finished that tribes rpg.

SDL is a framework library, not an engine. It's written in C and works perfectly fine with an app written in C.
Unless you have a specific need for more development freedom you should look into it, it might make things easier for you. SDL. SDL doesn't restrict you much anyways.

You can use SDL to build your enigne.

To make sure, you're just building a custom engine for spefici game(s), or is this for a unity/unreal competitor?

>/dpt/ told me that C++ is shit
>go in for job interview
>they ask me about my experience with C++
>I tell them that it's a Pajeet-tier language for niggers
>they ask me to leave the building

>talking about meme in real life
> in real life
you deserve it user

No, as I've said, I want to make an alternative to all C++/C# engines out there. There's Corange, but it seems to have been abandoned.
I want to make as simple as I can. I don't want to bring huge dependencies that I will barely utilize.
I'm writing a game at the same time too, as a proof-of-concept for my engine.

Is there something wrong with what I said?

>/dpt/ told me that JS is shit
>go in for job interview
>they ask me about my experience with JS
>I tell them that it's a kiddie-tier language for moronic hipsters
>they ask me to leave the building

I gave up on gtkmm when trying to deal with it's list/tree bullshit too.
I fucking hate GUI libraries, they're all trash.

why does C++ have to suck?

fair enough good luck

you want access to children

well cheer to you for attempting a new alternative game engine.

Just use SDL. AAA studios use SDL. There's literally no reason not to use SDL.

can you really say its your own game engine if you don't write your own compiler to compile it?

Actually looks fucking great, man I love C

wut compiler and game engine is 2 separate entity.
it's like "can you really say its your own program if you don't write your own compiler to compile it?"
the phrase "your own program" can also be subtituted by "your own compiler"

this is why I transferred the copyright of my game engine to the FSF

now in this case. you did the right thing

There was one guy who got interviewed at our place.
>interview
>Lead: "So we mainly use C++ and Javascript. A bit of Java and C# here and there. There is also one project in pure C"
>Guy: "Wow"
>"?"
>"I am kinda disappointed in your company but ok"
>"Umm, ok, here you go. make this thing, you have 4 weeks"
>4 weeks later
Literally never wrote a single line of code. He spent 4 weeks writing in his blog and toying with his opensource pet projects in (I kid you not) Haskell. Boss was mad af but we had a good laugh

all talk no code. typical

Wow, that sucks. Did they fire you?

youtube.com/watch?v=7s664NsLeFM

>>cout

pretty comfy desu

>>cout

functional languages are worse

Agreed. Streams are the worst abuse of operator overloading in the standard library.

Arithmetic types, containers and iterators use it tastefully.

If this is 2D array [,] then what is this [][]?

Yeah, but he goes on for hundreds of pages about the importance of consistency, then all of a sudden he throws a bunch of magic iostream syntax at you.

C#? Jagged array/array of array.

Bjarne's a fag and C++ is anything but consistent.

cout

XBF

yet another attempt at systematizing general knowledge

logic, grammar, rhetoric
->
arithmos, chronos, topos
->
astronomy et al
->
dialectics

I'm a pretty disorganized person and I generally have like 100 windows open so I often find myself spending seconds looking through the alt-tab list. I guess this issue could be mitigated by using a multiple desktops but that would require organizing effort on my part anyway. So I wanted to be able to press a certain key combination and enter a string to switch to a given program based on its title. This is basically a bash script using wmctrl but with some extras which makes it faster for me to use and more suitable to my needs.

Boring stuff for work, exporting some DB data into CSVs for management to use in their Google Sheets.

Did I mention I'm the only backend developer in this 100% IT company that also makes the Android app and the web frontend? Somehow it works out, without me even working much, but I don't understand how.

nice app there user

But it's the same thing

Not in C#, which is the only language I'm aware of which uses [,] syntax.

nice one user

Just use printf lmao

source code when tho

>Want to print 1

at that point you are using C and you might just as well write the whole thing in C.

>want to print string
>1 and 16 is int
>WHY SHIT NOT WORKING THE WAY I WANT IT TO WORK

But user, that's the point. C++ gives you std::string, hashtables built in, advanced template fuckery and some other stuff, it's pure garbage if you try to use the real "features".

cout

>what are parens

Unecessary if you didn't go overboard with operator overloading

>hashtables
use a library
>template
why do you want to make unreadable code?

>have sepples class
>first few weeks go to getting visual studio installed for everyone
>check schedule
>last class (in 9 months)
>"loops, conditional statements"
What the fuck is wrong with these people?