|
I had been struggling with my render code for days until things went from bad to worse and I was getting artifacts due to corrupt DMA transfers on top of drawing code errors and other messes.
Finally I sat down and rewrote the damned thing. Not only did I do that, I made it so I'm sending with one buffer while drawing to another buffer, then flipping them to maximize the benefit of DMA.
Not only that, it's now basically a coroutine.
All of this and my render code is actually simpler than before, and it appears to work swimmingly so far.
Took me several hours vs. several days.
All the win. Now I just need to implement touch.
Edit: Got touch working. That was easier than I thought it would be. Woo!
if(m_touch_callback!=nullptr) {
point16 locs[2];
size_t locs_size = sizeof(locs);
m_touch_callback(locs,&locs_size,m_touch_callback_state);
if(locs_size>0) {
if(m_last_touched!=nullptr) {
m_last_touched->on_touch(locs_size,locs);
} else {
control_type* target = nullptr;
for(control_type** ctl_it = m_controls.begin();ctl_it!=m_controls.end();++ctl_it) {
control_type* pctl = *ctl_it;
if(pctl->bounds().intersects((spoint16)locs[0])) {
target = pctl;
}
}
if(target!=nullptr) {
m_last_touched = target;
target->on_touch(locs_size,locs);
}
}
} else {
if(m_last_touched!=nullptr) {
m_last_touched->on_release();
m_last_touched = nullptr;
}
}
}
if(m_flush_callback!=nullptr && m_flushing<(1+(m_buffer2!=nullptr)) && m_dirty_rects.size()!=0) {
if(m_it_dirties==nullptr) {
m_it_dirties = m_dirty_rects.cbegin();
size_t bmp_stride = bitmap_type::sizeof_buffer(size16(m_it_dirties->width(),1));
m_bmp_lines = m_buffer_size/bmp_stride;
if(bmp_stride>m_buffer_size) {
return uix_result::out_of_memory;
}
m_bmp_y = 0;
} else {
if(m_bmp_y>=m_it_dirties->height()) {
++m_it_dirties;
if(m_it_dirties==m_dirty_rects.cend()) {
m_it_dirties = nullptr;
m_dirty_rects.clear();
return uix_result::success;
}
size_t bmp_stride = bitmap_type::sizeof_buffer(size16(m_it_dirties->width(),1));
m_bmp_lines = m_buffer_size/bmp_stride;
if(bmp_stride>m_buffer_size) {
return uix_result::out_of_memory;
}
m_bmp_y = 0;
} else {
m_bmp_y+=m_bmp_lines;
}
}
srect16 subrect(m_it_dirties->x1,m_it_dirties->y1+m_bmp_y,m_it_dirties->x2,m_it_dirties->y1+m_bmp_lines+m_bmp_y);
subrect=subrect.crop((srect16)*m_it_dirties);
bitmap_type bmp(size16(subrect.dimensions().width,m_bmp_lines),m_write_buffer,m_palette);
bmp.fill(bmp.bounds(),m_background_color);
for(control_type** ctl_it = m_controls.begin();ctl_it!=m_controls.end();++ctl_it) {
control_type* pctl = *ctl_it;
if(pctl->bounds().intersects(subrect)) {
srect16 surface_rect = pctl->bounds();
surface_rect.offset_inplace(-subrect.x1,-subrect.y1);
control_surface_type surface(bmp,surface_rect);
pctl->on_render(surface);
}
}
++m_flushing;
m_flush_callback((point16)subrect.top_left(),bmp,m_flush_callback_state);
switch_buffers();
}
return uix_result::success;
To err is human. Fortune favors the monsters.
modified 25-Feb-23 3:30am.
|
|
|
|
|
Why are you simpering?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Because I need a copy editor.
To err is human. Fortune favors the monsters.
|
|
|
|
|
Don't we all?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
honey the codewitch wrote: if(pctl->bounds().intersects((spoint16)locs[0])) {
target = pctl;
}
honey the codewitch wrote: if(bmp_stride>m_buffer_size) {
return uix_result::out_of_memory;
} You've used curly braces for your single-line if-statements!
This really makes my day, I'm so proud of you!
|
|
|
|
|
|
#Worldle #399 2/6 (100%)
🟨⬜⬜⬜⬜⬅️
🟩🟩🟩🟩🟩🎉
https://worldle.teuteuf.fr
go lucky did not need map
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Wordle 616 4/6
⬛⬛⬛🟩⬛
⬛🟩⬛🟩⬛
⬛🟩⬛🟩🟩
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 616 4/6
⬛⬛⬛⬛⬛
⬛⬛⬛⬛🟨
🟩🟩⬛🟩⬛
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 616 3/6*
⬜⬜⬜⬜⬜
⬜⬜🟨🟩🟩
🟩🟩🟩🟩🟩
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Wordle 616 5/6
⬜⬜🟨⬜⬜
🟩🟩⬜⬜🟨
🟩🟩⬜⬜🟨
🟩🟩🟨⬜⬜
🟩🟩🟩🟩🟩
|
|
|
|
|
⬜⬜⬜⬜⬜
⬜🟩⬜⬜⬜
🟩🟩⬜⬜🟨
🟩🟩🟩🟩🟩
Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP
|
|
|
|
|
Wordle 616 5/6
⬜⬜🟨⬜⬜
⬜⬜⬜⬜⬜
⬜⬜⬜🟨⬜
🟩🟩⬜⬜🟩
🟩🟩🟩🟩🟩
I had one letter after my third guess, got kind of nervous there
|
|
|
|
|
Wordle 616 4/6
⬛⬛⬛⬛⬛
🟩🟩⬛⬛🟨
🟩🟩🟩🟩⬛
🟩🟩🟩🟩🟩
Get me coffee and no one gets hurt!
|
|
|
|
|
Wordle 616 5/6
⬜⬜⬜⬜⬜
⬜⬜⬜⬜🟨
🟨⬜🟨⬜⬜
⬜🟩⬜🟩🟩
🟩🟩🟩🟩🟩
Hard
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Can we please make game NPCs more interesting?
Also if you asked me in 1993 I'd have never thought the voice synthesis part (with speech patterns and such) would be the most challenging aspect of this given today's existing technology.
To err is human. Fortune favors the monsters.
modified 24-Feb-23 14:29pm.
|
|
|
|
|
Would you like a reply? Press Enter to continue or ESC to quit.
Jeremy Falcon
|
|
|
|
|
Off topic....
For some situations I really like ChatGPT. One is find a regex pattern. Of course ChatGPT is not always right at the first time, but very cooperative to find the correct solution
|
|
|
|
|
Have listen to the NPC's in GTA V sometime - they lead a lot more interesting lives than I do. And boy, do they swear a lot!
But I think those are all pre-recorded rather than on-the-fly generated.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
GTA has always been good about giving the peds you squish character. Smearing them is so much more satisfying when they have a backstory.
I had to write this twice and omit detailed ways of smearing in order to keep with Lounge decorum, but you can get rather creative with these games. The ambulance is best.
To err is human. Fortune favors the monsters.
|
|
|
|
|
For me, it's delivery vans.
Anyone gives me a delivery to do, and somebody always tries to give my vehicle a new paint job on the way. They seem to have a massive preference for red vehicles as well ... can't imagine why. :InnocentWhistleSmilie:
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Are you sure you only drive delivery vans in video games?
|
|
|
|
|
They're more interesting and useful without.
Aight, imagine WarCraft, the brotherhood near the deadmines. Would you prefer some pre-programmed hints and a clear storyline, or a whiny character that keeps generating new stories not relevant to the game or plot?
ChatGPT is said to equal a nine-year old in testing, which makes me wonder which poor handicapped nine-year old is the norm. Imagine it grows enough next year to become a real nine-year old; would you want THAT to narrate Warcraft??
If ChatGPT has any place, then in politics. Mindless blabbering that is easily replaced by a political biased ChatGPT and a lot cheaper. That's the future of democracy; voting which ChatGTP is better. Because any "almost none-year old" in politics would be an improvement.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I dunno - if the NPC's could relate what happened in your specific game to their situation in a "believable" way then that could be a real game changer. Increase the immersion by making the actual script less scripted?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I lately read an article by someone who asked ChatGPT to be a DungeonMaster for a game... at the beginning it was no wanting to help, but the guy kept pushing and it eventually started to help with the game plot.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|