mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-10-16 10:03:41 -04:00
TS_RA2_Mission_Editor_sourcecode_23.02.2023_1
TS_RA2_Mission_Editor_sourcecode_23.02.2023_1
This commit is contained in:
commit
a547a31a37
377 changed files with 90136 additions and 0 deletions
56
MissionEditor/LineDrawer.h
Normal file
56
MissionEditor/LineDrawer.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
enum class LineStyle: int
|
||||
{
|
||||
Standard,
|
||||
Dotted_2,
|
||||
Dotted_3,
|
||||
Dotted_4,
|
||||
};
|
||||
|
||||
class LineDrawer
|
||||
{
|
||||
public:
|
||||
LineDrawer(void* dest, int bytes_per_pixel, int width, int height, int pitch);
|
||||
|
||||
void MoveTo(int to_x, int to_y);
|
||||
void LineTo(int to_x, int to_y, int color, LineStyle style = LineStyle::Standard);
|
||||
void DrawLine(int from_x, int from_y, int to_x, int to_y, int color, LineStyle style = LineStyle::Standard);
|
||||
void Rectangle(int from_x, int from_y, int to_x, int to_y, int color, LineStyle style = LineStyle::Standard);
|
||||
|
||||
private:
|
||||
void SetPixel(char* dest, int cur_x, int cur_y, int color);
|
||||
void DrawLineImplX(int from_x, int from_y, int to_x, int to_y, int color, LineStyle style);
|
||||
void DrawLineImplY(int from_x, int from_y, int to_x, int to_y, int color, LineStyle style);
|
||||
|
||||
private:
|
||||
void* m_dest;
|
||||
int m_bytes_per_pixel;
|
||||
int m_width;
|
||||
int m_height;
|
||||
int m_pitch;
|
||||
int m_last_x;
|
||||
int m_last_y;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue