optimize imgs a little bit

This commit is contained in:
lachrymaL 2022-08-28 20:54:30 -04:00
parent 94515b0620
commit 0589d92b91
No known key found for this signature in database
GPG key ID: F3640ACFA174B1C1
41 changed files with 21 additions and 52 deletions

View file

@ -127,7 +127,7 @@ namespace {
void check() { anim.check(); }
void change(const NVL::Environment::MarkupString& n, u16 speed) {
current = n;
anim.kickoff(speed * n.length(), [n](NVL::Number x) { return static_cast<size_t>(x * n.length()); });
anim.kickoff(speed * n.length(), [this](NVL::Number x) { return static_cast<size_t>(x * this->current.length()); });
}
void draw() {
if (anim.done)

View file

@ -253,14 +253,14 @@ namespace ADVect::Graphics {
ImageTexture* GetImageTextureFromFile(const std::string& file) {
if (imgs.find(file) == imgs.end()) {
ImageTexture img;
if (auto i = get_image_texture(file)) {
img = *i;
imgs[file] = std::move(img);
imgs[file] = std::move(*i);
return &imgs[file];
}
else return nullptr;
}
return nullptr;
else
return &imgs[file];
}
void DrawTextureStencilAlpha(const bgfx::TextureHandle& tex, i32 pos_x, i32 pos_y, u32 w, u32 h) {

BIN
ADVect/runtime/SDL2.dll Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
ADVect/runtime/grad.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
ADVect/runtime/image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
ADVect/runtime/image2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 KiB

BIN
ADVect/runtime/image3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 KiB

BIN
ADVect/runtime/mmaker.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
ADVect/runtime/terrio.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View file

@ -4,7 +4,7 @@
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64" ],
"inheritEnvironments": [ "clang_cl_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",

View file

@ -113,11 +113,15 @@ namespace NVL::Environment {
return ms;
}
size_t MarkupString::length() const {
size_t r = 0;
for (const auto& s : segments)
r += s.str.length();
return r;
size_t MarkupString::length() const { // you do realize this memoization fails if we change the var
if (mem_length == -1) {
size_t r = 0;
for (const auto& s : segments)
r += s.str.length();
return r;
}
else
return mem_length;
}
MarkupString MarkupString::substr(size_t i) const {

View file

@ -44,6 +44,9 @@ namespace NVL::Environment {
std::vector<std::pair<String, std::vector<String>>> efs;
};
struct MarkupString {
private:
mutable i32 mem_length = -1;
public:
std::vector<MarkupSegment> segments{};
size_t length() const;
MarkupString substr(size_t idx) const;

View file

@ -1,57 +1,19 @@
BEGIN Scene1
Show BG "image3.png"
Show BGDialogue "grad.png"
<<-
*!Show Avatar "mmaker.png"
[MMaker]
*!Show BG "googleplex/1.png"
Park your car in a place that allows you to walk on the sidewalk.
*!Show BG "googleplex/2.jpg"
Wait until everyone is asleep.
*!Show BG "googleplex/3.jpg"
Sneak into the building and head towards the front door.
*!Show BG "googleplex/4.png"
Go through the security gate and walk around the perimeter of the grounds.
*!Show BG "googleplex/5.jpg"
Enter the building using the main entrance.
*!Show BG "googleplex/6.jpg"
Walk to the elevator and take it up to the sixth floor.
*!Show BG "googleplex/7.png"
Enter the stairwell leading to the roof and climb all the way to the top.
*!Show BG "googleplex/8.jpg"
Break open the skylight and enter the room containing the Google logo.
*!Show BG "googleplex/9.jpg"
Find the main server room.
*!Show BG "googleplex/10.jpg"
Kill the power to the server room.
*!Show BG "googleplex/11.jpg"
Search the room for a computer with a USB port.
*!Show BG "googleplex/12.jpg"
Plug the USB cable into the computer.
*!Show BG "googleplex/13.jpg"
Start typing in the password for the administrator account.
*!Show BG "googleplex/14.png"
After the login screen comes up, type in the password "G00gle."
*!Show BG "googleplex/15.png"
When the system reboots, you will see a prompt asking you to install a new program.
Type "Y" and press ENTER.
*!Show BG "googleplex/16.jpg"
The Google search engine will come up. Type in "www.yahoo.com" and hit ENTER.
*!Show BG "googleplex/17.png"
A window will appear saying "You have successfully installed Google Chrome." Click OK.
*!Show BG "googleplex/18.jpg"
A new browser will open. Log in to your Yahoo mail account.
*!Show BG "image3.png"
Go to your inbox and click on the link to download the latest version of Google Chrome.
*!Show BG "googleplex/20.jpg"
Install the update.
*! Show BG "image2.jpg"
Commencing JS hypnosis...
*! Show BG "image.png"
*! Show BG "image3.png"
*!Show Avatar "terrio.png"
[Terrio]