sdl-ui-contro-listbox
sdl-ui-contro-listbox

Step-by-Step Guide to Basic SDL UI Controls: UIListBox

After implementing controls like UIButton and UITextField, this article will focus on a very common UI element: the ListBox. It's widely used in interface development for scenarios like file selection, menu options, and displaying data lists. The core features of UIListBox include: Dynamically adding and removing list items. Mouse click…

Continue ReadingStep-by-Step Guide to Basic SDL UI Controls: UIListBox
sdl-ui-control-scrollbar_textfield
sdl-ui-control-scrollbar_textfield

Step-by-Step Guide to Basic SDL UI Controls: UITextField (with Scrollbar and Hyperlinks)

This article details the implementation of a read-only text display control that supports automatic word wrapping, embedded color tags, hyperlink highlighting and clicking, mouse hover underlines, and a vertical scrollbar (with mouse wheel, click, drag, and page-by-page scrolling). The implementation is based on SDL2/SDL_ttf, with rendering and measurement interfaces unified…

Continue ReadingStep-by-Step Guide to Basic SDL UI Controls: UITextField (with Scrollbar and Hyperlinks)

Step-by-Step SDL Basic UI Controls: UIRadioButton

In previous articles, we've implemented common UI controls like UIButton and UICheckBox. This time, we'll continue expanding our UI control system with a very common component used in many applications: the RadioButton. Radio buttons are typically found in forms and settings interfaces, where they're used to select a single option…

Continue ReadingStep-by-Step SDL Basic UI Controls: UIRadioButton
sdl-ui-control-dev-checkbox
sdl-ui-control-dev-checkbox

Step-by-Step Guide to Building a Basic SDL UI Control: UICheckBox

1. Introduction The CheckBox is one of the most common selection controls in graphical user interfaces. It's typically used to represent a binary state, such as "on/off," "yes/no," or "selected/unselected." In a low-level, cross-platform library like SDL, there are no pre-built UI controls. This means we have to manually draw…

Continue ReadingStep-by-Step Guide to Building a Basic SDL UI Control: UICheckBox
sdl-ui-textedit-dev
sdl-ui-textedit-dev

Step-by-Step SDL Basic UI Controls: UITextEdit (1)

1. Introduction In the previous post, we implemented a UIButton and mastered the basics of drawing and interacting with SDL UI controls. In this post, we'll build a single-line text input box, UITextEdit. This is a fundamental component of many UI systems, used for things like login forms, nickname inputs,…

Continue ReadingStep-by-Step SDL Basic UI Controls: UITextEdit (1)
sdl-ui-control-button
sdl-ui-control-button

Building a Basic UI Control in SDL: Step-by-Step with UIButton

In SDL game development, it's common to need custom UI controls. This post will walk you through building a complete UIButton control from scratch, based on an existing Node/UIControl framework. The button will feature text, state changes, click events, and rendering. I. What is a UIButton? A UIButton is one…

Continue ReadingBuilding a Basic UI Control in SDL: Step-by-Step with UIButton

Step-by-Step Guide to Building a Basic SDL UI Control: UILabel

1. Introduction Picking up where we left off, the Label control is arguably the simplest UI component. I once thought TextEdit was the easiest, but after diving deep into custom controls, I realized how complex TextEdit truly is. Building a TextEdit from scratch with all its basic features is quite…

Continue ReadingStep-by-Step Guide to Building a Basic SDL UI Control: UILabel

Implementing Basic SDL UI Controls: A Step-by-Step Guide

The Simple DirectMedia Layer (SDL) is a lightweight, cross-platform multimedia library widely used for 2D game development. However, SDL doesn't natively provide graphical user interface (GUI) controls like buttons, labels, or input fields. While many excellent open-source third-party libraries exist, such as the ones listed below, they can be a…

Continue ReadingImplementing Basic SDL UI Controls: A Step-by-Step Guide