src/camera.c

Thu, 18 Apr 2024 22:53:55 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 18 Apr 2024 22:53:55 +0200
changeset 65
9c44c55d327a
parent 47
44457f6cb0a2
permissions
-rw-r--r--

consistently refer to windows by ID - fixes #381

This change discovered that the font cache is completely broken. We created issue #387 for this.

universe@37 1 /*
universe@37 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
universe@37 3 * Copyright 2023 Mike Becker. All rights reserved.
universe@37 4 *
universe@37 5 * Redistribution and use in source and binary forms, with or without
universe@37 6 * modification, are permitted provided that the following conditions are met:
universe@37 7 *
universe@37 8 * 1. Redistributions of source code must retain the above copyright
universe@37 9 * notice, this list of conditions and the following disclaimer.
universe@37 10 *
universe@37 11 * 2. Redistributions in binary form must reproduce the above copyright
universe@37 12 * notice, this list of conditions and the following disclaimer in the
universe@37 13 * documentation and/or other materials provided with the distribution.
universe@37 14 *
universe@37 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
universe@37 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
universe@37 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
universe@37 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
universe@37 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
universe@37 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
universe@37 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
universe@37 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
universe@37 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
universe@37 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
universe@37 25 * POSSIBILITY OF SUCH DAMAGE.
universe@37 26 */
universe@37 27
universe@37 28 #include "ascension/camera.h"
universe@37 29
universe@47 30 void asc_camera_ortho(AscCamera *camera, asc_recti rect) {
universe@47 31 asc_mat4f_unit(camera->view);
universe@47 32 float left = (float) rect.pos.x;
universe@47 33 float right = left + (float) rect.size.width;
universe@47 34 float top = (float) rect.pos.y;
universe@47 35 float bottom = top + (float) rect.size.height;
universe@41 36 asc_mat4f_ortho(camera->projection, left, right, bottom, top, -1, 1);
universe@37 37 }

mercurial