In the #haiku_os_chat on matrix, Gerasim Troeglazov wrote a simple calculator app with GPT. The only thing they added to the generated code was a line to create the BApplication
By the way, which chatroom is the best place for Haiku user, non-dev questions? It’s ok if it’s Telegram, matrix, irc… or should I ask in the dev chat rooms?
#include <Application.h>
#include <Bitmap.h>
#include <File.h>
#include <TranslatorRoster.h>
#include <stdio.h>
int main(int argc, char** argv) {
// Crea un oggetto BApplication per poter utilizzare le API di Haiku
BApplication app("application/x-vnd.Screenshot");
// Prendi lo screenshot dello schermo intero
BRect bounds(BScreen().Frame());
BBitmap bitmap(bounds, B_RGB32, true);
BView* view = new BView(bounds, "Screenshot view", B_FOLLOW_NONE, B_WILL_DRAW);
bitmap.AddChild(view);
view->SetHighColor(0, 0, 0);
view->FillRect(view->Bounds());
view->Sync();
app.Driver()->DrawBitmap(&bitmap, bounds, bounds);
// Salva lo screenshot come file PNG
BFile file("screenshot.png", B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY);
BTranslatorRoster().Translate(&bitmap, NULL, NULL, &file, B_PNG_FORMAT);
return 0;
}
Some comments:
Potentially it takes portions from GitHub. Allegedly GPT-3 is pre-trained with billion lines of code from existing repositories.
The astonishing thing is that it puts comments in the same language of the request