coastline 0.0.4
Loading...
Searching...
No Matches
paintshop.h
Go to the documentation of this file.
1#pragma once
2
10
11#include <array>
12#include <cstdint>
13#include <filesystem>
14#include <map>
15#include <memory>
16#include <optional>
17#include <span>
18#include <string>
19#include <string_view>
20#include <vector>
21
22#include "common/playerinput.h"
23#include "common/types.h"
24#include "controllerpak.h"
25#include "decalcar.h"
26#include "menutext.h"
27#include "scenerenderer.h"
28
29namespace coastline {
30
31class MenuScreen;
32
50
54 float stickX = 0.0f;
55 float stickY = 0.0f;
58 bool enter = false;
60 bool escape = false;
62 bool undo = false;
64 bool redo = false;
65 bool constrain = false;
71};
72
74struct PaintRect {
75 s32 x = 0;
76 s32 y = 0;
77 s32 width = 0;
78 s32 height = 0;
79};
80
95
101
112
115 f32 x = 0.0f;
116 f32 y = 0.0f;
117 f32 z = 0.0f;
118};
119
122public:
134 const std::filesystem::path &release,
135 MenuScreen &screen,
137 ControllerPak pak);
141 PaintShop(const PaintShop &) = delete;
143 PaintShop &operator=(const PaintShop &) = delete;
144
151 void SetCar(int car, const std::filesystem::path &directory);
152
161 bool Frame(SceneRenderer &renderer, float seconds, const PaintShopInput &input);
162
164 bool TakesText() const;
165
177 float seconds,
178 const PaintShopInput &input,
179 DecalCar &car);
180
189
190private:
191 // The screens of the Controller Pak of the menus draw with the drawing and the pictures of the
192 // paint shop, as the console shares them.
193 friend class Menus;
194
196
197 // The drawing of the console on the 640 by 480 screen.
198 void BeginDraw(SceneRenderer &renderer);
199 void FlushFills();
200 void FillRect(s32 x0, s32 y0, s32 x1, s32 y1, u8 red, u8 green, u8 blue);
201 void DrawFilledRectHiRes(s32 x, s32 y, s32 width, s32 height, u8 red, u8 green, u8 blue);
202 void
203 DrawRectOutline(s32 x, s32 y, s32 width, s32 height, s32 thickness, u8 red, u8 green, u8 blue);
204 void DrawRectBorder(s32 x,
205 s32 y,
206 s32 width,
207 s32 height,
208 s32 border,
209 u8 transparent,
210 u8 sunken,
211 u8 red,
212 u8 green,
213 u8 blue);
214 void DrawPixel(s32 x, s32 y, u8 shade);
215 void DrawSpriteQuad(PaintSprite &sprite,
216 float x,
217 float y,
218 float width,
219 float height,
220 float s0,
221 float t0,
222 float s1,
223 float t1,
224 u8 red,
225 u8 green,
226 u8 blue);
227 void DrawSpriteStrips(PaintSprite &sprite,
228 s32 x,
229 s32 y,
230 s32 drawWidth,
231 s32 drawHeight,
232 u8 red,
233 u8 green,
234 u8 blue);
235 void DrawSpriteAtOrigin(PaintSprite &sprite);
236 void DrawTexturedSprite(PaintSprite &sprite, s32 x, s32 y);
237 void DrawSpriteTinted(PaintSprite &sprite, u8 red, u8 green, u8 blue);
238 void DrawWideBackground(u8 red, u8 green, u8 blue);
239 void DrawSpriteRegion(
240 PaintSprite &sprite, s32 x, s32 y, s32 width, s32 height, u8 red, u8 green, u8 blue);
242 s32 srcX,
243 s32 srcY,
244 s32 srcWidth,
245 s32 srcHeight,
246 s32 x,
247 s32 y,
248 s32 width,
249 s32 height,
250 u8 red,
251 u8 green,
252 u8 blue);
253 void EmitScaledTextureRect(s32 x, s32 y, s32 width, s32 height);
254 static bool JapaneseMessage(std::string_view text);
255 // Lines after a newline are lineHeight below the line before, or as lineGaps lists them.
256 void DrawText(std::string_view text,
257 s32 x,
258 s32 y,
259 int lineHeight = 0,
260 std::span<const int> lineGaps = {});
261 void SetTextCustomColors(u8 red0, u8 green0, u8 blue0, u8 red1, u8 green1, u8 blue1);
262
263 // The input of the player as the console reads it.
264 void TranslateInput(float seconds, const PaintShopInput &input, bool dialog);
265 bool DialogShows() const;
266 void Transfer(u32 mask);
267 void UpdateStickRepeat();
268 void CheckStick(s32 &timer, f32 axis, f32 sign, u32 button);
269
270 // paintshop.c of the console.
271 bool LoadTextureFromRom(PaintSprite &sprite);
273 void SelectDecalTexels(int slot);
274 void SetUpPaintShopCar();
275 void LoadDecalSlotIcons();
276 void LayOutPaintShopButtons();
277 void LoadPaintToolIcons();
278 void LoadStyleIcons();
279 void LayOutPaintShopControls();
280 bool InitPaintShop();
281 void DrawPaintShopButton(const PaintRect &rect, u8 red, u8 green, u8 blue);
282 void DrawBrushSizes(PaintSprite &sizes, const PaintRect &chosen);
283 void DrawPaintShop();
284 void DrawToolCursor();
285 void RunPaintShopPakDialog(u8 operation);
286 void RunPaintShopMenus();
287 void HandlePaintShopB();
288 void ResetPaintShopState();
289 void SaveDecalUndo();
290 void UndoDecalEdit();
291 void RedoDecalEdit();
292 void DrawDialogBox(s32 x, s32 y, s32 width, s32 height);
293 void DrawSunkenFrame(s32 x, s32 y, s32 width, s32 height);
294 void SetPakTextColors(u8 inCarSelect);
295 void DrawPakErrorMessage(s32 error, u8 operation, u8 inCarSelect);
296 void DrawMenuButtons(s32 buttonY, s32 cancelX);
297 void ClearDecal(u8 coloredOption);
301 void FlipDecalPixels();
302 void DrawPakProgressBox(s32 y, std::string_view text, s32 textX, s32 textY);
303 void CopyUnmaskedTexels(u8 *texels, const u8 *mask, s32 width, s32 height);
304 void TransferDecal(DecalCar &car, u8 operation);
305 void LoadDecalPalette(DecalCar &car, std::size_t offset);
306 void DrawPakButtons(s32 buttonY, u32 okTextX, u32 cancelTextX, s32 okX, s32 cancelX);
307 s32 ProcessDecalSaveLoad(DecalCar &car, u8 operation, u8 inCarSelect, bool &done);
309 void PressKeyboardKey(u8 key);
310 void TypeOnKeyboard();
311
312 // decaleditor.c of the console.
313 void SelectDecalSlot(s32 slot);
314 bool HasOppositePanel(int slot) const;
315 PaintRect DecalSlotRect(int slot) const;
316 void LayOutDecalCanvas();
317 ControllerPak DecalPak(const DecalCar &car) const;
318 std::optional<std::vector<u8>> ReadDecalNote(const DecalCar &car) const;
319 s32 AnchorDistance() const;
320 std::array<s32, 2> PaintEndpoint() const;
323 bool PickDecalSlot();
324 bool PickPaletteColor();
325 bool PickPaintTool();
326 void ProcessTextTool();
327 void PaintBrush();
328 bool StartShape();
329 void PaintRectangle();
330 void PaintOval();
331 bool PaintWithTool();
332 void DrawShapeOutline();
334 bool IsCursorInButton(const PaintSprite &sprite) const;
335 bool IsCursorInRect(const PaintRect &rect) const;
336 bool IsCursorOnKeyboardKey(const PaintGlyph &key) const;
337 void ConvertPaletteToRgb();
339 void MoveStyleMenuCursor();
340 void CloseStyleMenu(PaintSprite &tool);
346 void SetPalette(int entry, u8 red, u8 green, u8 blue);
347 void CopyLightPalettes();
348 void PickMenuOption(const PaintRect *options, int count, u8 &cursor);
349
350 // decaldraw.c of the console.
351 u8 GetPixel4Bit(s32 x, s32 y) const;
352 u8 ReadPixel4Bit(const u8 *texels, s32 x, s32 y) const;
353 void FloodFill4Bit(s32 x, s32 y);
354 void StampTextOnDecal(s32 x, s32 y);
355 void DrawLine4Bit(s32 x0, s32 y0, s32 x1, s32 y1);
356 void SetPixel4Bit(s32 x, s32 y, u8 color);
357 void FillTexels(s32 x0, s32 y0, s32 x1, s32 y1);
358 void FillRect4Bit(s32 x0, s32 y0, s32 x1, s32 y1);
359 void StrokeDecalRectangle(s32 x0, s32 y0, s32 x1, s32 y1);
360 void FillDecalRoundRect(s32 x0, s32 y0, s32 x1, s32 y1);
361 void DrawDecalRoundedRectOutline(s32 x0, s32 y0, s32 x1, s32 y1);
362 void DrawDecalFilledEllipse(s32 x0, s32 y0, s32 x1, s32 y1);
363 void DrawDecalEllipseOutline(s32 x0, s32 y0, s32 x1, s32 y1);
364 void FillCircle4Bit(s32 x, s32 y, s32 radius, bool fromScreen);
365 void DrawDecalCircleOutline(s32 x, s32 y, s32 radius);
366 void AdvanceDashes();
367 void DrawDashedLine(s32 x0, s32 y0, s32 x1, s32 y1);
368 void DrawDashedRectangle(s32 x0, s32 y0, s32 x1, s32 y1);
369 void DrawDashedRoundedRect(s32 x0, s32 y0, s32 x1, s32 y1);
370 void DrawDashedEllipse(s32 x0, s32 y0, s32 x1, s32 y1);
371 void DrawDashedCircle(s32 x, s32 y, s32 radius);
372 void DrawDecalTextPreview(s32 x, s32 y);
373 s32 ScreenToTexelX(s32 x) const;
374 s32 ScreenToTexelY(s32 y) const;
375 u8 FontTexel(s32 column, s32 row) const;
376 s32 GlyphAdvance(int glyph, int next) const;
377
378 MenuScreen &m_screen;
380 ControllerPak m_pak;
381 std::filesystem::path m_release;
382 std::filesystem::path m_carDirectory;
383
384 // The drawing of the frame.
385 SceneRenderer *m_renderer = nullptr;
386 Matrix4 m_flat{};
390 TextStyle m_text;
391
392 // The input of the player, and the time of the frame.
393 PlayerInputState m_input{};
394 std::string m_typedText;
395 s32 m_frameMilliseconds = 0;
396 // The counts of frames of the console advance once a 60th of a second at any frame rate: the
397 // time toward the next count, and whether one is due this frame.
398 float m_consoleFrameTime = 0.0f;
399 bool m_consoleFrame = true;
400 // Where the mouse is on the 640 by 480 screen, and whether it moved this frame.
401 std::array<int, 2> m_pointer{};
402 bool m_pointerMoved = false;
403 bool m_pointerSeen = false;
404 bool m_escapeDown = false;
405
406 // The pictures, by their address in the main segment of the console.
407 std::map<u32, PaintSprite> m_sprites;
408 PaintSprite *m_background = nullptr;
409 PaintSprite *m_logo = nullptr;
410 PaintSprite *m_paintWholeCar = nullptr;
411 PaintSprite *m_panel8Overlay = nullptr;
412 PaintSprite *m_panel9Overlay = nullptr;
413 PaintSprite *m_brushSizeRound = nullptr;
414 PaintSprite *m_brushSizeSquare = nullptr;
415 PaintSprite *m_paintCursor = nullptr;
416 PaintSprite *m_fillCursor = nullptr;
417 PaintSprite *m_brushCursor = nullptr;
418 PaintSprite *m_crosshairCursor = nullptr;
419 PaintSprite *m_textCursor = nullptr;
420 PaintSprite *m_eyedropperCursor = nullptr;
421 PaintSprite *m_keyboardPanel = nullptr;
422 PaintSprite *m_keyboardBackground = nullptr;
423 PaintSprite *m_keyboardHighlight = nullptr;
424 PaintSprite *m_buttonA = nullptr;
425 PaintSprite *m_buttonB = nullptr;
426 PaintSprite *m_decalFont = nullptr;
427 PaintSprite *m_shapeFilledCircle = nullptr;
428 std::array<PaintSprite *, DECAL_SLOTS> m_decalSlotIcons{};
429 std::array<PaintSprite *, 13> m_paintToolIcons{};
430 std::array<PaintSprite *, 4> m_rectStyleIcons{};
431 std::array<PaintSprite *, 4> m_ovalStyleIcons{};
432
433 // The tables of the console.
434 PaintRect m_decalCanvasFrame;
435 PaintRect m_paletteFrameLeft;
436 PaintRect m_paletteFrameRight;
437 std::array<PaintRect, 5> m_brushSizeRects{};
438 std::array<PaintRect, 5> m_brushSizeButtonRects{};
439 std::array<PaintGlyph, 50> m_decalGlyphs{};
440 std::array<std::array<u8, 3>, 3> m_colorEditorBars{};
441 std::array<std::string, 3> m_colorChannelNames;
442 std::array<std::string, 2> m_brushStyleNames;
443 std::array<std::string, 2> m_textStyleNames;
444 std::array<std::string, 4> m_rectStyleNames;
445 std::array<std::string, 4> m_ovalStyleNames;
446 std::array<PaintVector, DECAL_SLOTS> m_panelViewDirections{};
447
448 // The state of the paint shop, as the globals of the console.
449 std::optional<DecalCar> m_car;
450 int m_carModel = 0;
451 bool m_initialized = false;
452 bool m_previewDirty = true;
453 int m_previewWait = 0;
454 std::unique_ptr<RenderModel> m_preview;
455 std::unique_ptr<RenderTexture> m_previewReflection;
456 PaintVector m_frameForward;
457 PaintVector m_frameUp;
458 PaintVector m_frameSide;
459 PaintVector m_framePosition;
460 PaintVector m_cameraPosition;
461 std::array<PaintSwatch, 16> m_swatches{};
462 std::array<PaintRect, 13> m_paintToolButtonRects{};
463 std::array<PaintRect, DECAL_SLOTS> m_decalSlotRects{};
464 PaintRect m_decalCanvas;
465 PaintRect m_brush;
466 std::array<int, 16> m_decalTextGlyphs{};
467 std::string m_decalText;
468 std::vector<u8> m_undoBuffer;
469 std::vector<std::vector<u8>> m_undoHistory;
470 std::vector<std::vector<u8>> m_redoHistory;
471 std::optional<std::vector<u8>> m_colorEditorSnapshot;
472 std::vector<u8> m_savedEditableData;
473 std::vector<u8> m_scratchTexels;
474 u8 *m_decalTexels = nullptr;
475 const u8 *m_decalTexelsEnd = nullptr;
476 const u8 *m_decalMask = nullptr;
477 int m_decalPaletteMaterial = 0;
478 u8 m_decalWidth = 0;
479 int m_decalZoom = 4;
480 u8 m_decalHeight = 0;
481 u8 m_dashColorA = 0;
482 u8 m_dashColorB = 0;
483 u8 m_brushSize = 0;
484 u8 m_savedColor = 0;
485 u8 m_decalColor = 0;
486 u8 m_textShadowColor = 0;
487 u8 m_paintTool = 0;
488 u8 m_previousPaintTool = 0;
489 u8 m_decalSlot = 0;
490 u8 m_previousDecalSlot = 0;
491 u8 m_savedDecalSlot = 0;
492 u8 m_decalTextLength = 0;
493 u8 m_decalTextWidth = 0;
494 u8 m_styleMenuCursor = 0;
495 u8 m_paintToolStarted = 0;
496 u8 m_decalDragActive = 0;
497 u8 m_paletteEnabled = 0;
498 u8 m_decalSlotHasMirror = 0;
499 u8 m_decalSlotChanged = 0;
500 u8 m_colorEditorOpen = 0;
501 u8 m_styleMenuOpen = 0;
502 u8 m_textShadowPickerOpen = 0;
503 u8 m_paintShopExiting = 0;
504 u8 m_colorEditorChannel = 0;
505 u8 m_keyboardHoverKey = 0;
506 u8 m_showPreview3D = 0;
507 u8 m_eyedropperActive = 0;
508 u8 m_mirrorTargetPanel = 0;
509 std::array<u8, 3> m_savedSwatchColor{};
510 s32 m_paintAnchorX = 0;
511 s32 m_paintAnchorY = 0;
512 bool m_constrainShape = false;
513 u32 m_lastClickTime = 0;
514 bool m_anchorXInitialized = false;
515 bool m_anchorYInitialized = false;
516 u16 m_screenFrameCount = 0;
517 s32 m_controllerPakState = 0;
518
519 // The dialog of the Controller Pak.
520 u8 m_pakDialogActive = 0;
521 u8 m_pakFileNeedsCreate = 0;
522 u8 m_pakDialogState = 0;
523 u8 m_pakDecalIndex = 0;
524 u8 m_pakWaitFrames = 0;
525 s32 m_pakFileOffset = 0;
526 s32 m_pakError = 0;
527 s32 m_pakChunkSize = 0;
528 std::vector<u8> m_pakNote;
529 bool m_pakDone = false;
530 s32 m_pakResult = 0;
531};
532
533} // namespace coastline
The notes of a Controller Pak, stored in a directory, with the settings note in another.
Definition controllerpak.h:41
Editable console body materials or numbered image layers for an imported car.
Definition decalcar.h:48
The state and the assets of the menu screens, read once from the import of a release.
Definition menuscreen.h:104
PaintShop & operator=(const PaintShop &)=delete
Prevent assignment of active editing and preview resources.
~PaintShop()
Release paint previews and editing resources before the menu screen and GPU device.
friend class Menus
Definition paintshop.h:193
void SetCar(int car, const std::filesystem::path &directory)
Choose the car the paint shop opens with, as the car select screen exits to it.
static std::unique_ptr< PaintShop > Load(SceneRenderer &renderer, const std::filesystem::path &release, MenuScreen &screen, std::optional< std::array< int, 6 > > &textColors, ControllerPak pak)
Read the pictures and the tables of the paint shop from the import of a release.
bool LoadDecalsQuietly(DecalCar &car)
Load the decals of the Controller Pak into a car at once, without the dialog, for the custom decals a...
std::optional< bool > LoadDecalsFrame(SceneRenderer &renderer, float seconds, const PaintShopInput &input, DecalCar &car)
Run a frame of the dialog that loads the decals on the car select screen, as the car select screen of...
bool TakesText() const
bool Frame(SceneRenderer &renderer, float seconds, const PaintShopInput &input)
Run a frame of the paint shop and draw it.
PaintShop(const PaintShop &)=delete
Prevent copying active editing and preview resources.
The renderer of a frame.
Definition scenerenderer.h:467
void UpdateStickRepeat(PlayerInputState *state)
Press the directions of the stick with repeat, as the menus read them.
The Controller Pak of the first controller of the console as a directory of the game,...
Editable car textures reconstructed from imported glTF or GLB assets.
void DrawDashedRoundedRect(s32 x0, s32 y0, s32 x1, s32 y1)
Draw the dashed outline of a rectangle with rounded corners.
void StrokeDecalRectangle(s32 x0, s32 y0, s32 x1, s32 y1)
Paint the outline of a rectangle with the brush.
void FillDecalRoundRect(s32 x0, s32 y0, s32 x1, s32 y1)
Fill a rectangle with rounded corners.
void FillRect4Bit(s32 x0, s32 y0, s32 x1, s32 y1)
Fill a rectangle, excluding its far column and row.
void FillCircle4Bit(s32 x, s32 y, s32 radius, u8 fromScreen)
Fill a circle.
void EmitScaledTextureRect(s32 textureWidth, s32 textureHeight, s32 x, s32 y, s32 width, s32 height)
Draw the texture already loaded over a rectangle of the screen, upside down: the decal being edited.
void DrawDecalFilledEllipse(s32 x0, s32 y0, s32 x1, s32 y1)
Fill the ellipse in a rectangle.
void FloodFill4Bit(s32 x, s32 y)
Fill the area of the color under a point with the color painted with.
void DrawDecalTextPreview(s32 x, s32 y)
Draw the text not yet painted on the screen, centered on a point, with its shadow when the text tool ...
void SetPixel4Bit(s32 x, s32 y, u8 color)
Write a texel of the decal being edited, unless it is outside the decal or the mask protects it.
void DrawLine4Bit(s32 x0, s32 y0, s32 x1, s32 y1)
Paint a line with the brush.
void DrawDashedRectangle(s32 x0, s32 y0, s32 x1, s32 y1)
Draw the dashed outline of a rectangle.
u8 GetPixel4Bit(s32 x, s32 y)
Read a texel of the decal being edited.
void DrawDecalCircleOutline(s32 x, s32 y, s32 radius)
Paint the outline of a circle with the brush.
void DrawDashedCircle(s32 x, s32 y, s32 radius)
Draw the dashed outline of a circle, the part over the decal only.
u8 ReadPixel4Bit(u8 *texels, s32 x, s32 y)
Read a texel of a decal the size of the one being edited.
void DrawDecalRoundedRectOutline(s32 x0, s32 y0, s32 x1, s32 y1)
Paint the outline of a rectangle with rounded corners with the brush.
void DrawDashedEllipse(s32 x0, s32 y0, s32 x1, s32 y1)
Draw the dashed outline of the ellipse in a rectangle.
void DrawDashedLine(s32 x0, s32 y0, s32 x1, s32 y1)
Draw the dashed line from the first point of a line to the cursor.
void StampTextOnDecal(s32 x, s32 y)
Paint the text into the decal, centered on a point, with its shadow when the text tool has it.
void DrawDecalEllipseOutline(s32 x0, s32 y0, s32 x1, s32 y1)
Paint the outline of the ellipse in a rectangle with the brush.
void ProcessPaintShopExitConfirm(void)
Run one frame of the dialog that warns of edits not saved on exit from the paint shop,...
void ProcessBrushStyleMenu(void)
Run one frame of the menu of the styles of the brush tool.
void UndoDecalEdit(void)
Restore the copy of the decal saved for undo.
void SaveDecalUndo(void)
Save a copy of the decal being edited for undo, and count an edit.
void ConvertPaletteToRgb(void)
Set the colors of the swatches from the palette of the decal.
s32 IsCursorInRect(ScreenRect *rect)
Whether the cursor is in a rectangle.
s32 IsCursorInButton(Sprite *sprite)
Whether the cursor is on a sprite as it is drawn.
void ProcessRectStyleMenu(void)
Run one frame of the menu of the styles of the rectangle tool.
void ProcessColorEditorDialog(void)
Run one frame of the color editor of the color in use.
void DrawDecalColorPalette(void)
Draw the palette, with the color in use outlined.
s32 IsCursorOnKeyboardKey(DecalGlyph *key)
Whether the cursor is on a key of the keyboard.
void ProcessDecalEditorInput(void)
Deal with a frame of the input of the decal editor: the decals, the palette, the tools and painting.
void UpdateCursorFromInput(void)
Move the cursor by the stick, the D-pad and the C buttons.
void ProcessTextStyleMenu(void)
Run one frame of the menu of the styles of the text tool, and of its colors of the shadow.
void ProcessTextInputKeyboard(void)
Run one frame of the keyboard of the text tool.
void ProcessOvalStyleMenu(void)
Run one frame of the menu of the styles of the oval tool.
The text of the menus of the console, drawn with the fonts of the import.
void ProcessMirrorFlipMenu(void)
Run one frame of the menu of the mirror tool.
void FlipDecalPixels(void)
Flip the decal being painted by the choice of the menu of the mirror tool.
void DrawPakErrorMessage(s32 error, u8 operation, u8 inCarSelect)
Draw the message of an error of the controller pak in a box.
void ProcessFillClearMenu(void)
Run one frame of the menu of the clear tool.
void RenderDecalPreview3D(void)
Draw the car beside the decal, turning to the decal slot when it changes.
void ResetPaintShopState(void)
Set the tools, the colors, and the cursor back to their state on entering the paint shop.
void MirrorDecalToOppositePanel(void)
Copy the decal being painted mirrored to the slot on the other side of the car, and paint that slot n...
s32 ProcessDecalSaveLoad(VehicleModel *model, u8 player, u8 operation, u8 inCarSelect, u8 *done)
Run one frame of the dialog that loads the decals of a model from the controller pak or saves them to...
Definition assetimport.h:11
std::array< float, 16 > Matrix4
A 4 by 4 matrix, column by column.
Definition scenerenderer.h:28
PaintTool
The tools of the paint shop, each a button, as the console numbers them.
Definition paintshop.h:34
@ PAINT_TOOL_LINE
Definition paintshop.h:38
@ PAINT_TOOL_LOAD
Definition paintshop.h:44
@ PAINT_TOOL_MIRROR
Definition paintshop.h:42
@ PAINT_TOOL_OVAL
Definition paintshop.h:41
@ PAINT_TOOL_RECTANGLE
Definition paintshop.h:40
@ PAINT_TOOL_UNDO
Definition paintshop.h:46
@ PAINT_TOOL_CLEAR
Definition paintshop.h:43
@ PAINT_TOOL_TEXT
Definition paintshop.h:39
@ PAINT_TOOL_FILL
Definition paintshop.h:37
@ PAINT_TOOL_BRUSH
Definition paintshop.h:36
@ PAINT_TOOL_EXIT
Definition paintshop.h:47
@ PAINT_TOOL_SAVE
Definition paintshop.h:45
@ PAINT_TOOLS
Definition paintshop.h:48
@ PAINT_TOOL_BRUSH_SIZE
Definition paintshop.h:35
The renderer of the converted models and of flat pictures and text, on the GPU of SDL.
void DrawSpriteRegion(Sprite *sprite, s32 x, s32 y, s32 width, s32 height, u8 red, u8 green, u8 blue)
Draw a sprite stretched over a rectangle in a colour.
void DrawScaledTexturedRect(Sprite *sprite, s32 srcX, s32 srcY, s32 srcWidth, s32 srcHeight, s32 x, s32 y, s32 width, s32 height, u8 red, u8 green, u8 blue)
Draw a rectangle of the texels of a 4-bit sprite stretched over a rectangle of the screen in a colour...
void DrawFilledRectHiRes(s32 x, s32 y, s32 width, s32 height, u8 red, u8 green, u8 blue)
Fill a rectangle in a colour.
void DrawRectOutline(s32 x, s32 y, s32 width, s32 height, s32 thickness, u8 red, u8 green, u8 blue)
Draw the outline of a rectangle in a colour, inside its edges.
void DrawTexturedSprite(Sprite *sprite, s32 x, s32 y)
Draw a sprite at a position.
void DrawSpriteTinted(Sprite *sprite, u8 red, u8 green, u8 blue)
Draw a sprite at its origin in a colour.
void DrawPixel(s32 x, s32 y, u8 shade)
Fill one pixel in a grey.
void DrawSpriteAtOrigin(Sprite *sprite, u16 *palette)
Draw a sprite at its origin, at its size on the screen.
void DrawRectBorder(s32 x, s32 y, s32 width, s32 height, s32 border, u8 transparent, u8 sunken, u8 red, u8 green, u8 blue)
Draw a box with a bevelled border outside its edges, light at the top and the left and dark at the bo...
void LoadTextureFromRom(Sprite *sprite)
Allocate memory for a sprite and decompress it there from the cartridge.
The input of one player.
Definition playerinput.h:32
A key of the keyboard of the text tool and its glyph, DecalGlyph of the console.
Definition paintshop.h:103
s32 kernLeft
Definition paintshop.h:109
s32 width
Definition paintshop.h:108
s32 y
Definition paintshop.h:105
u8 character
Definition paintshop.h:106
s32 cellX
Definition paintshop.h:107
s32 kernRight
Definition paintshop.h:110
s32 x
Definition paintshop.h:104
A rectangle of the 640 by 480 screen, ScreenRect of the console.
Definition paintshop.h:74
s32 x
Definition paintshop.h:75
s32 height
Definition paintshop.h:78
s32 y
Definition paintshop.h:76
s32 width
Definition paintshop.h:77
The input of the player of the paint shop for a frame.
Definition paintshop.h:52
bool constrain
Definition paintshop.h:65
u32 buttons
Definition paintshop.h:53
std::string text
The characters typed on a keyboard this frame in UTF-8, with Backspace as code point 8 and Enter as c...
Definition paintshop.h:70
std::optional< std::array< int, 2 > > pointer
Where the mouse moved to this frame on the 640 by 480 screen, or none when it is still.
Definition paintshop.h:57
float stickX
Definition paintshop.h:54
bool undo
Whether Ctrl+Z was pressed this frame to undo an edit outside a dialog.
Definition paintshop.h:62
bool enter
Definition paintshop.h:58
bool redo
Whether Ctrl+Shift+Z was pressed this frame to redo an edit outside a dialog.
Definition paintshop.h:64
float stickY
Definition paintshop.h:55
bool escape
Whether Escape is down, B in a dialog and on the keyboard of the text tool.
Definition paintshop.h:60
A picture of the paint shop, Sprite of the console.
Definition paintshop.h:82
std::vector< u8 > pixels
Definition paintshop.h:83
s32 drawWidth
Definition paintshop.h:89
std::string asset
Definition paintshop.h:92
s32 width
Definition paintshop.h:85
s32 drawHeight
Definition paintshop.h:90
s32 originX
Definition paintshop.h:87
s32 height
Definition paintshop.h:86
std::unique_ptr< RenderTexture > texture
Definition paintshop.h:93
u8 bitsPerTexel
Definition paintshop.h:84
s32 originY
Definition paintshop.h:88
u8 style
Definition paintshop.h:91
A colour of the palette of the decals and its swatch, PaletteSwatch of the console.
Definition paintshop.h:97
PaintRect rect
Definition paintshop.h:98
std::array< u8, 3 > color
Definition paintshop.h:99
A direction of the console.
Definition paintshop.h:114
f32 x
Definition paintshop.h:115
f32 y
Definition paintshop.h:116
f32 z
Definition paintshop.h:117
void DrawText(const char *text, s32 x, s32 y)
Draw text at a position, aligned as the last alignment set.
void SetTextCustomColors(s32 red, s32 green, s32 blue, s32 red2, s32 green2, s32 blue2)
Set the colors of the top and the bottom of text.
The integer and floating-point types of the console, for headers shared with Windows.
unsigned int u32
Definition ultratypes.h:20
float f32
Definition ultratypes.h:38
unsigned short u16
Definition ultratypes.h:19
int s32
Definition ultratypes.h:25
unsigned char u8
Definition ultratypes.h:18